bool TimeExchangeView::init() { CCLoadSprite::doResourceByCommonIndex(11, true); setCleanFunction([](){ CCLoadSprite::doResourceByCommonIndex(11, false); }); auto temCCB = CCBLoadFile("TimeExchangeView", this, this); setContentSize(temCCB->getContentSize()); auto size = CCDirector::sharedDirector()->getWinSize(); float dh = size.height - 852 - 8; m_infoList->setContentSize(CCSize(m_infoList->getContentSize().width, m_infoList->getContentSize().height + dh)); m_data = CCArray::create(); m_tabView = CCMultiColTableView::create(this, m_infoList->getContentSize()); m_tabView->setDirection(kCCScrollViewDirectionVertical); m_tabView->setVerticalFillOrder(kCCTableViewFillTopDown); m_tabView->setMultiColTableViewDelegate(this); m_tabView->setTouchPriority(Touch_Popup); m_infoList->addChild(m_tabView); string msg = _lang("105082"); m_infoLabel->setString(msg); m_st = true; m_maxRwdLv = PortActController::getInstance()->getMaxRwdLv(); generateData(NULL); onEnterFrame(0); return true; }
void Framework::play() { onSceneStart(); mTimer.reset(); while(mIsRunning) { mTimer.markTime(); onEnterFrame(mTimer.getTimeSinceLastMark()); mGraphicsManager->renderFrame(); } onSceneFinish(); }
bool ToolCreateView::init() { if (!ArcPopupBaseView::init(TYPE_POS_MID)) { return false; } CCLoadSprite::doResourceByCommonIndex(4, true); CCLoadSprite::doResourceByCommonIndex(11, true); setCleanFunction([](){ CCLoadSprite::doResourceByCommonIndex(4, false); CCLoadSprite::doResourceByCommonIndex(11, false); }); int buildId = FunBuildController::getInstance()->getMaxLvBuildByType(FUN_BUILD_WORKSHOP); if (buildId==0) { return false; } auto& buildInfo = FunBuildController::getInstance()->getFunbuildById(buildId); int bdPara1 = atoi(buildInfo.para[1].c_str()); int bdPara2 = atoi(buildInfo.para[2].c_str()); startPt = ccp(0, 0); auto bg = CCBLoadFile("ToolCreateView",this,this); int extH = getExtendHeight(); setContentSize(CCDirector::sharedDirector()->getWinSize()); m_flyNode->setVisible(false); int tmpPoxY = 70; if (extH/4 < tmpPoxY) { tmpPoxY = extH/4; } m_queueNode->setPositionY(m_queueNode->getPositionY()-tmpPoxY); m_buildId = buildId; m_toolNodeVec.push_back(m_tool1Node); m_toolNodeVec.push_back(m_tool2Node); m_toolNodeVec.push_back(m_tool3Node); m_toolNodeVec.push_back(m_tool4Node); m_toolNodeVec.push_back(m_tool5Node); m_toolNodeVec.push_back(m_tool6Node); m_toolNodeVec.push_back(m_tool7Node); m_toolNodeVec.push_back(m_tool8Node); m_toolNodeVec.push_back(m_tool9Node); m_toolNodeVec.push_back(m_tool10Node); m_toolNodeVec.push_back(m_tool11Node); m_toolNodeVec.push_back(m_tool12Node); m_makeTools = ToolController::getInstance()->m_makeTools; for (int i=0; i<m_makeTools.size(); i++) { if (i<m_toolNodeVec.size()) { CCLoadSpriteType loadType = CCLoadSpriteType_GOODS; string iconPath = CCCommonUtils::getIcon(CC_ITOA(m_makeTools[i])); auto icon = CCLoadSprite::createSprite(iconPath.c_str(),true,loadType); icon->setPosition(ccp(58, 58)); CCCommonUtils::setSpriteMaxSize(icon, 90); m_toolNodeVec[i]->addChild(icon); } } m_tipNode->setVisible(false); m_spdIcon->setVisible(false); m_cancelBtn[0]->setVisible(false); m_cancelBtn[1]->setVisible(false); m_cancelBtn[2]->setVisible(false); m_cancelBtn[3]->setVisible(false); m_cancelBtn[4]->setVisible(false); m_sumGold = 99999; m_oldSumTime = 1; m_qid = QID_MAX; int tqid = QueueController::getInstance()->getMinTimeQidByType(TYPE_MATE); if (tqid!=QID_MAX) { auto& qInfo = GlobalData::shared()->allQueuesInfo[tqid]; int TmpItemId = QueueController::getInstance()->getItemId(qInfo.key); m_curCreatingItemId = TmpItemId; m_qid = tqid; CCLoadSpriteType loadType = CCLoadSpriteType_GOODS; string iconPath = CCCommonUtils::getIcon(CC_ITOA(m_curCreatingItemId)); auto icon = CCLoadSprite::createSprite(iconPath.c_str(),true,loadType); CCCommonUtils::setSpriteMaxSize(icon, 120); m_curIconNode->addChild(icon); CCFadeTo* fadeTo1 = CCFadeTo::create(0.5, 120); CCFadeTo* fadeTo2 = CCFadeTo::create(0.5, 255); CCActionInterval * repeatForever =CCRepeatForever::create(CCSequence::create(fadeTo1,fadeTo2,NULL)); icon->runAction(repeatForever); auto& toolInfo = ToolController::getInstance()->getToolInfoById(m_curCreatingItemId); m_sumGold = toolInfo.crt_gold; m_oldSumTime = toolInfo.crt_cd; updateWaitCells(qInfo.allId); } //设置空位 m_canUse[0]=true; m_canUse[1]=true; m_canUse[2]=true; m_canUse[3]=true; m_canUse[4]=true; int j=GlobalData::shared()->playerInfo.materialBackup-2; for (int i=4; i>j; i--) { if (i<0) { break; } auto lock_pic = CCLoadSprite::createSprite("iron_lock.png"); m_waitInNode[i]->addChild(lock_pic); m_cancelBtn[i]->setVisible(false); m_canUse[i]=false; } onEnterFrame(0); _openNum = 0; m_curOptIdx = -1; m_willIconPath = ""; m_waitInterface = NULL; m_buyTouchNode->setVisible(false); m_buyItemId=0; fromView=0; moreItemId=0; onExchangeMate=false; return true; }