void TanSuoLayer::refreshDisconverTime(unsigned int count, unsigned int tansuoCount) { //unsigned int iTotalCount = CS::getDiscoverLimitTimes(MyselfManager::getManager()->getMyZhuJueData()->getVipLevel()); CCLabelTTF *label = (CCLabelTTF*)mBg->getChildByTag(Tag_Label_CurNum); if (label) { CCString temp; temp.initWithFormat("%u", count); label->setString(temp.getCString()); } int xunBaoCount = CS::getDiscoverLimitTimes(MyselfManager::getManager()->getMyZhuJueData()->getVipLevel());//寻宝次数上限 if (m_nHadCount == xunBaoCount) { m_nRefreshTime = 360; } m_nHadCount = count; if (count < xunBaoCount) { schedule(SEL_SCHEDULE(&TanSuoLayer::refreshTime),1.0f); } if (tansuoCount >= MAX_TANSUOTIMES) { mBg->removeChildByTag(Tag_Label_Haixu); mBg->removeChildByTag(Tag_Label_ShengyuNum); mBg->removeChildByTag(Tag_Label_DianLiang); m_tHaixuTTF = NULL; CCLabelTTF *pTTF = (CCLabelTTF*)mBg->getChildByTag(Tag_Label_YiDianLiang); if (pTTF) { pTTF->removeFromParent(); } CCString* temp = CCString::create(LFStrings::getValue("XunBaoYiJing_DianLiang_String").c_str()); CCLabelTTF *yidianliangLabel = CCLabelTTF::create(temp->getCString(), fontStr_kaiti, m_nFontSize, CCSize(0,0), kCCTextAlignmentCenter); mBg->addChild(yidianliangLabel, 1, Tag_Label_YiDianLiang); //yidianliangLabel->setAnchorPoint(ccp(0,0.5)); yidianliangLabel->setPosition(ccp( mBg->getContentSize().width / 2, 44)); yidianliangLabel->setColor(fonColor_PuTong); } else { int shengyuTimes = MAX_TANSUOTIMES - tansuoCount; //CCString *str = CCString::createWithFormat("%s%d%s",LFStrings::getValue("XunBaoHaixu_String").c_str(),shengyuTimes,LFStrings::getValue("XunBaoDianLiang_String").c_str()); CCLabelTTF *usedNum = (CCLabelTTF*)mBg->getChildByTag(Tag_Label_Haixu); if (usedNum) { usedNum->setString(CCString::createWithFormat("%d",shengyuTimes)->getCString()); } } }
void GamePan::refreshWorldPad() { CCNode* pBaseNode = m_pCcbNode->getChildByTag(kTagGamePanWordPan); CCNode* tabNode = pBaseNode->getChildByTag(kTagGamePanWordPanTabBase); CCNode* itemNode = pBaseNode->getChildByTag(kTagGamePanWordPanItemBase); CCLabelTTF* itemTemp = dynamic_cast<CCLabelTTF*>(itemNode->getChildByTag(kTagGamePanWordPanItemTitle)); CCControlButton* tabItem = dynamic_cast<CCControlButton*>(tabNode->getChildByTag(kTagGamePanWordPanTabBaseItem)); float itemWidth = tabItem->getContentSize().width+ITEM_SPACE; float itemHeight = tabItem->getContentSize().height+ITEM_SPACE; for(int i =0;i<MAX_LINE;i++) { for(int j =0;j<MAX_ROW;j++) { CCControlButton* item = CCControlButton::create(); Utils::copyCCControlButton(item,tabItem); item->setPosition(ccp(tabItem->getPositionX()+j*itemWidth,tabItem->getPositionY()-i*itemHeight)); item->setTag(j+i*MAX_ROW); tabNode->addChild(item); CCLabelTTF* title = Utils::copyCCLabelTTF(itemTemp); title->setPosition(item->getPosition()); title->setTag(j+i*MAX_ROW); itemNode->addChild(title); CCString* str = (CCString*)_wordList->randomObject(); title->setString(str->getCString()); _wordList->removeObject(str); } } for(int i =0;i<MAX_LINE;i++) { for(int j =0;j<MAX_ROW;j++) { CCControlButton* item = dynamic_cast<CCControlButton*>(tabNode->getChildByTag(j+i*MAX_ROW)); XCheckBox* pCheckBox = XCheckBox::create(item); pCheckBox->setTag(item->getTag()); pCheckBox->setToggle(false); pCheckBox->setTarget(this, cccontrol_selector(GamePan::wordSelectCallbackCCControl)); tabNode->addChild(pCheckBox); item->removeFromParent(); } } itemTemp->removeFromParent(); tabItem->removeFromParent(); refreshLetter(); }
void GameLayer::countdownSeconds() { CCLabelTTF *label = (CCLabelTTF *)getChildByTag(TagCountdown); if (label) { setCountdownNum(getCountdownNum() - 1); if (getCountdownNum() < 1) { label->removeFromParent(); label = NULL; this->unschedule(schedule_selector(GameLayer::countdownSeconds)); countdonwDone(); return; } label->setString(CCString::createWithFormat("%d", getCountdownNum())->getCString()); doCountdownAnimation(label); } }