bool SetPanel::init() { bool res = CCNode::init(); do { if(!res)break; CWidgetWindow* layout = CWidgetWindow::create(); layout->setTag(1); layout->setTouchPriority(-4); addChild(layout); m_panel = LoadComponent("SetPanel.xaml"); if(!m_panel) break; m_panel->retain(); m_panel->setPosition(CCSizeCenter(m_panel->getContentSize())); this->setContentSize(m_panel->getContentSize()); this->setAnchorPoint(CCPointCenter); layout->addChild(m_panel); for(int i = 1; i <=5; ++i) { CButton* button = (CButton*)m_panel->getChildByTag(i); button->setOnClickListener(this,ccw_click_selector(SetPanel::onClick)); } res = true; } while (0); return res; }
CWidgetWindow *TuiManager::createPanel(float tag, float x, float y, int w, int h,float rotation){ CWidgetWindow *pPanel = CWidgetWindow::create(); pPanel->setContentSize(Size(w, h)); pPanel->setPosition(Point(x,y)); pPanel->setRotation(rotation); pPanel->setTag(tag); return pPanel; }
void TuiManager::doAdapterResolution(Node* pScene){ for (auto node : pScene->getChildren()) { CWidgetWindow *pWindow = dynamic_cast<CWidgetWindow*>(node); if (pWindow != nullptr){ pWindow->setPosition(Arp(pWindow->getPosition())); for (auto child : pWindow->getChildren()) { child->setPosition(Arp(child->getPosition())); } } } }
CWidgetWindow* CWidgetWindow::create() { CWidgetWindow *pRet = new CWidgetWindow(); if( pRet && pRet->init() ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
void CWidget::setLongClickTouchHandlerWidget(CCNode* pWidget, int id) { for(CCNode* pNode = (CCNode*)m_pThisObject; pNode != NULL; pNode = pNode->getParent()) { CWidgetWindow* pWidgetWindow = dynamic_cast<CWidgetWindow*>(pNode); if( pWidgetWindow != NULL ) { pWidgetWindow->setLongClickTouchHandlerWidget(pWidget, id); return; } } }
void CWidgetWindow::setModalable(bool bModalable) { m_bModalable = bModalable; for (Node* pChild : _children) { CWidgetWindow *pWindow = dynamic_cast<CWidgetWindow *>(pChild); if (pWindow != nullptr) pWindow->setModalable(bModalable); //EidtBox mixture components, etc extension::Control *pControl = dynamic_cast<extension::Control*>(pChild); if (pControl != nullptr) pControl->setEnabled(!bModalable); } }
void LoadScene::onCreate() { CWidgetWindow* layout = CWidgetWindow::create(); layout->setTag(1); addChild(layout); m_ui = LoadComponent("loading.xaml"); m_ui->setPosition(VCENTER); this->addChild(m_ui); CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("skill/9049.plist"); AnimationManager::sharedAction()->ParseAnimation("9049"); }