//设置按钮显示 void CStar97UILayer::setBtnVisible(enGameBtnTag eBtnTag, bool bVisible) { CCMenuItem * pItem = dynamic_cast<CCMenuItem *>(m_pMenuLayer->getChildByTag(eBtnTag)); CCAssert(pItem != NULL, "this tag button don't have"); if (pItem->isVisible() != bVisible) pItem->setVisible(bVisible); }
void RPGBattleMenu::showMenu() { CCTMXTiledMap *bgLayer = (CCTMXTiledMap*)this->m_parentNode->getChildByTag(kRPGBattleMenuTagBg); bgLayer->setVisible(true); CCLabelTTF *nameLab = (CCLabelTTF*)this->m_parentNode->getChildByTag(kRPGBattleMenuTagNameLab); nameLab->setVisible(true); CCSprite *separate = (CCSprite*)this->m_parentNode->getChildByTag(kRPGBattleMenuTagSeparate); separate->setVisible(true); CCMenuItem *menuAttack = (CCMenuItem*)this->getChildByTag(kRPGBattleMenuTagAttack); menuAttack->setVisible(true); CCMenuItem *menuSkill = (CCMenuItem*)this->getChildByTag(kRPGBattleMenuTagSkill); menuSkill->setVisible(true); CCMenuItem *menuItems = (CCMenuItem*)this->getChildByTag(kRPGBattleMenuTagItems); menuItems->setVisible(true); CCMenuItem *menuEscape = (CCMenuItem*)this->getChildByTag(kRPGBattleMenuTagEscape); menuEscape->setVisible(true); }
// 父类把手指和点击效果都准备好的,但是都是全透明的,到时子类用就是了 GuideLayer_SuperTool::GuideLayer_SuperTool(int seasonId, int sectionId) :BaseGuideLayer(seasonId,sectionId), m_nClickCount(0), m_bIsUseTeaching(false), m_tLabel(NULL), m_sGuide_arrowsSpr(NULL) { if (!CCUserDefault::sharedUserDefault()->getBoolForKey(FirstSuperTool,true)) { return; } m_bIsUseTeaching = true; CCUserDefault::sharedUserDefault()->setBoolForKey(FirstSuperTool,false); CCUserDefault::sharedUserDefault()->flush(); BaseScense::getCurrentScene()->getMenuLayer()->beginTeachUseSuperTool(); BaseScense::getCurrentScene()->getMenuLayer()->setTeachCallBack(this,SEL_CallFunc(&GuideLayer_SuperTool::usedEnd)); CCMenuItem *item = BaseScense::getCurrentScene()->getMenuLayer()->getRestartItem(); item->setVisible(false); CCPoint dest = ccp(180,500); CCSprite* guide_arrows = CCSprite::create(getImageFile("teach_arrows.png").c_str()); addChild(guide_arrows); m_sGuide_arrowsSpr = guide_arrows; guide_arrows->setPosition(ccp(dest.x+50, dest.y+65)); guide_arrows->setRotationX(20); guide_arrows->setOpacity(0); guide_arrows->runAction(CCSequence::create( CCDelayTime::create(0.2f), CCFadeTo::create(1.0f,255), NULL)); CCLabelTTF *guide_txt = CCLabelTTF::create(LFStrings::getValue("TeachUseSuperToolOne").c_str(), fontStr_katong,27.0f);//, CCSize(270,0), kCCTextAlignmentCenter); guide_txt->setColor(ccBLACK); guide_txt->setHorizontalAlignment(kCCTextAlignmentLeft); addChild(guide_txt); guide_txt->setPosition(ccp(dest.x + 225,guide_arrows->getPositionY() + guide_arrows->getContentSize().height-20)); m_tLabel = guide_txt; BaseScense::getCurrentScene()->getMenuLayer()->getStarState()->teach_scaleChange(m_nClickCount); }