本文整理汇总了C++中CCMenu::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenu::setEnabled方法的具体用法?C++ CCMenu::setEnabled怎么用?C++ CCMenu::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenu
的用法示例。
在下文中一共展示了CCMenu::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disableAllTouchBegin
void MainLayerHerosBaseBody::disableAllTouchBegin()
{
mTableView->setTouchEnabled(false);
int cellNum = numberOfCellsInTableView(mTableView);
for (int i=0;i<cellNum;i++)
{
CCTableViewCell* cell = mTableView->cellAtIndex(i);
if (cell)
{
CCNode* bg = cell->getChildByTag(TAG_BaseBody_TABLE_ITEM);
if (bg)
{
CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_TABLE_HERO_IMG);
if (menu)
{
menu->setEnabled(false);
}
menu = (CCMenu*)bg->getChildByTag(TAG_Menu);
if(menu)
{
menu->setEnabled(false);
}
}
}
}
}
示例2: disableAllTouchEnd
void MainLayerZhuangBeiBaseBody::disableAllTouchEnd()
{
mTableView->setTouchEnabled(true);
int cellNum = numberOfCellsInTableView(mTableView);
for (int i=0; i<cellNum; i++)
{
CCTableViewCell* cell = mTableView->cellAtIndex(i);
if (cell)
{
CCNode* bg = cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
if (bg)
{
CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_MENU);
if (menu)
{
menu->setEnabled(true);
}
}
}
}
CCPoint beg = mTableView->getContentOffset();
if (mOffset.y < beg.y) mOffset.y = beg.y;
if (mOffset.y > tableCellSizeForIndex(mTableView,0).height*3) mOffset.y = tableCellSizeForIndex(mTableView,0).height*3;
mTableView->setContentOffset(mOffset);
}
示例3: onDialog
void RPGStartSceneLayer::onDialog(cocos2d::CCObject *pObject)
{
SimpleAudioEngine::sharedEngine()->playEffect("audio_effect_btn.wav");
CCMenuItem *menuItem = (CCMenuItem*)pObject;
switch (menuItem->getTag())
{
case kRPGStartSceneLayerTagDialogCancel:
{
this->removeChildByTag(kRPGStartSceneLayerTagDialog, true);
CCMenu *mainMenu = (CCMenu*)this->getChildByTag(kRPGStartSceneLayerTagMainMenu);
mainMenu->setEnabled(true);
}
break;
default:
{
//kRPGStartSceneLayerTagMenuItemDialogOK
//清除数据
this->m_db.execDML("delete from save_data");
this->m_db.execDML("delete from items_existing");
this->m_db.execDML(GAME_INIT_SQL);
//默认设置
CCUserDefault::sharedUserDefault()->setStringForKey(GAME_STYLE, this->m_styleData[1].first);
this->goToMapScene();
}
break;
}
}
示例4: play_logic
// 恢复逻辑
void PauseLayer::play_logic( CCObject* pSender){
CCLOG("点击恢复");
GamingLayer* fatherNode = (GamingLayer*)getParent();
// 1. 将这个暂停层进行移植
fatherNode->removeChildByTag( 99, true );
// 2. 设定CCMenu(父节点中)enable 为true
CCMenu* menu = (CCMenu*) fatherNode->getChildByTag( 156 );
menu->setEnabled( true );
fatherNode->mWarrior->setTouchEnabled( true );
// 3.调用 CCDirector 的 resume 方法
CCDirector::sharedDirector()->resume();
// 4.恢复背景音乐
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
setTouchEnabled( true );
}
示例5: returnMainGame
void MainGameScene::returnMainGame()
{
setTouchEnabled(true);
CCMenu* resumeDialog = (CCMenu*)this->getChildByTag(tagResumeDialog);
if(resumeDialog){
resumeDialog->setOpacity(0);
resumeDialog->setEnabled(false);
}
}
示例6: setover
void GameMain::setover() {
CCMenu* pMenu = (CCMenu *)this->getChildByTag(25);
pMenu->setVisible(true);
pMenu->setEnabled(true);
gameover->setVisible(true);
gameover->setScale(0);
pMenu->setScale(0);
pMenu->runAction(CCScaleTo::create(0.5,1));
gameover->runAction(CCScaleTo::create(0.5,0.5));
isover = true;
}
示例7: hiddenStartMenu
void LevelSelectScene::hiddenStartMenu()
{
CCMenu* startMenu = (CCMenu*)this->getChildByTag(tagStartMenuDialog);
if(startMenu){
this->removeChild(startMenu);
}
CCMenu* levelSelectMenu = (CCMenu*)this->getChildByTag(tagLevelSelectMenuDialog);
if(levelSelectMenu){
levelSelectMenu->setOpacity(255);
levelSelectMenu->setEnabled(true);
}
}
示例8: makeRetryButton
void MainGameScene::makeRetryButton()
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCMenuItemImage* retryItem = CCMenuItemImage::create("menu_waku.png","menu_waku.png" ,this, menu_selector(MainGameScene::showResumeDialog));
retryItem->setScale(0.5);
CCSize pRetryItemSize = retryItem->getContentSize();
retryItem->setPosition(ccp( pRetryItemSize.width * 0.4, winSize.height - pRetryItemSize.height * 0.4));
CCMenu* retryButton = CCMenu::create(retryItem,NULL);
retryButton->setPosition(CCPointZero);
retryButton->setTag(tagRetryButton);
retryButton->setEnabled(false);
this->addChild(retryButton);
}
示例9: setOver
void GameMainLayer::setOver()
{
//游戏结束
CCMenu *pMenu = (CCMenu *)this->getChildByTag(25);
pMenu->setVisible(true);
pMenu->setEnabled(true);
pMenu->setScale(0);
pMenu->runAction(CCScaleTo::create(0.5f, 1));
gameOver->setVisible(true);
gameOver->setScale(0);
gameOver->runAction(CCScaleTo::create(0.5f, 0.5f));
this->isOver = true;
}
示例10: makeClearDaialog
void MainGameScene::makeClearDaialog()
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCMenuItemImage* titleItem = CCMenuItemImage::create("logo_menu.png","logo_menu.png" ,this, menu_selector(MainGameScene::tapTitleButton));
titleItem->setPosition(ccp(winSize.width * 0.3, winSize.height * 0.3));
CCMenuItemImage* retryItem = CCMenuItemImage::create("logo_restart.png","logo_restart.png" ,this, menu_selector(MainGameScene::tapRetryButton));
retryItem->setPosition(ccp(winSize.width * 0.8, winSize.height * 0.3));
CCMenu* clearDialog = CCMenu::create(titleItem,retryItem,NULL);
clearDialog->setPosition(CCPointZero);
clearDialog->setTag(tagClearDialog);
clearDialog->setOpacity(0);
clearDialog->setEnabled(false);
this->addChild(clearDialog);
}
示例11: startGame
void MainGameScene::startGame()
{
//タッチを有効に
setTouchEnabled(true);
//リトライボタンを有効に
CCMenu* retryButton = (CCMenu*)this->getChildByTag(tagRetryButton);
if(retryButton){
retryButton->setEnabled(true);
}
//startInfoを消す
CCMenu* startInfo = (CCMenu*)this->getChildByTag(tagStartInfo);
if(startInfo){
this->removeChild(startInfo);
}
}
示例12: checkChildrenPos
void UIScrollLayer::checkChildrenPos()
{
//CCArray* array = m_PageLayer->getChildren();
CCObject* obj;
CCARRAY_FOREACH(m_PageLayer,obj)
{
CCLayer* layer = dynamic_cast<CCLayer*>(obj);
if(layer)
{
CCArray* itemArray = layer->getChildren();
CCObject* itemObj;
CCARRAY_FOREACH(itemArray,itemObj)
{
CCNode* iconButton = dynamic_cast<CCNode*>(itemObj);
if(iconButton)
{
CCArray* menuArray = iconButton->getChildren();
CCObject* menuObj;
CCARRAY_FOREACH(menuArray,menuObj)
{
CCMenu* menu = dynamic_cast<CCMenu*>(menuObj);
if(menu)
{
CCArray* menuItemArray = menu->getChildren();
CCObject* menuItmeObj;
bool claim = false;
CCARRAY_FOREACH(menuItemArray,menuItmeObj)
{
CCMenuItem* item = dynamic_cast<CCMenuItem*>(menuItmeObj);
if(item)
{
CCPoint pt = layer->convertToWorldSpace(menu->getPosition());
claim = touchIsInContent(pt);
if(claim)
{
break;
}
}
}
menu->setEnabled(claim);
}
}
}
示例13: init
bool GameMainLayer::init()
{
if (!CCLayer::init())
return false;
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
CCPoint originPoint = CCDirector::sharedDirector()->getVisibleOrigin();
map = new GameObjMap();
map->setAnchorPoint(ccp(0, 1));
map->setPosition(ccpSub(ccp(0, size.height), originPoint));
this->addChild(map, 0);
hero = new GameObjHero();
hero->setScale(0.5f);
hero->setPosition(ccpAdd(ccp(100, 160), originPoint));
this->addChild(hero, 1);
gameMark = new GameMark();
this->addChild(gameMark, 4);
//游戏结束
gameOver = CCSprite::create("gameover.png");
gameOver->setScale(0.5f);
gameOver->setPosition(ccp(size.width/2, size.height/2 + 70));
gameOver->setVisible(false);
this->addChild(gameOver, 5);
//菜单项
CCMenuItemImage *pCloseItem = CCMenuItemImage::create("back.png", "back.png", this, menu_selector(GameMainLayer::menuBackCallback));
pCloseItem->setPosition(ccp(size.width/2, size.height/2 - 50));
pCloseItem->setScale(0.5f);
CCMenu *pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 5, 25);
pMenu->setVisible(false);
pMenu->setEnabled(false);
this->isOver = false;
this->scheduleUpdate();
return true;
}
示例14: goToMapScene
//public
void RPGStartSceneLayer::goToMapScene()
{
CCArray *loadTextures = CCArray::create();
loadTextures->addObject(CCString::create("map.png"));
loadTextures->addObject(CCString::create("main.png"));
loadTextures->addObject(CCString::create("joystick.png"));
loadTextures->addObject(CCString::create("actor4_0.png"));
loadTextures->addObject(CCString::create("actor111.png"));
loadTextures->addObject(CCString::create("actor113.png"));
loadTextures->addObject(CCString::create("actor114.png"));
loadTextures->addObject(CCString::create("actor115.png"));
loadTextures->addObject(CCString::create("actor117.png"));
loadTextures->addObject(CCString::create("actor120.png"));
CCMenu *mainMenu = (CCMenu*)this->getChildByTag(kRPGStartSceneLayerTagMainMenu);
mainMenu->setEnabled(false);
CCScene *s = RPGLoadingSceneLayer::scene(loadTextures, NULL, "single_map");
CCTransitionFade *t = CCTransitionFade::create(GAME_SCENE, s);
CCDirector::sharedDirector()->replaceScene(t);
}
示例15: disableAllTouchBegin
void MainLayerZhuangBeiBaseBody::disableAllTouchBegin()
{
mTableView->setTouchEnabled(false);
int cellNum = numberOfCellsInTableView(mTableView);
for (int i=0; i<cellNum; i++)
{
CCTableViewCell* cell = mTableView->cellAtIndex(i);
if (cell)
{
CCNode* bg = cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
if (bg)
{
CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_MENU);
if (menu)
{
menu->setEnabled(false);
}
}
}
}
mOffset = mTableView->getContentOffset();
}