当前位置: 首页>>代码示例>>C++>>正文


C++ CCMenu::setEnabled方法代码示例

本文整理汇总了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);
				}
			}
		}
	}

}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:27,代码来源:MainLayerHerosBaseBody.cpp

示例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);
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:27,代码来源:MainLayerZhuangBeiBaseBody.cpp

示例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;
    }
}
开发者ID:jonesgithub,项目名称:OzgGameRPG,代码行数:33,代码来源:RPGStartSceneLayer.cpp

示例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 );
    

}
开发者ID:hzming,项目名称:MyMoonWarrior,代码行数:30,代码来源:PauseLayer.cpp

示例5: returnMainGame

void MainGameScene::returnMainGame()
{
    setTouchEnabled(true);
    CCMenu* resumeDialog = (CCMenu*)this->getChildByTag(tagResumeDialog);
    if(resumeDialog){
        resumeDialog->setOpacity(0);
        resumeDialog->setEnabled(false);
    }
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:9,代码来源:MainGameScene.cpp

示例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;
}
开发者ID:kyoky82,项目名称:LuoLiRun,代码行数:11,代码来源:GameMainScene.cpp

示例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);
    }
    
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:14,代码来源:LevelSelectScene.cpp

示例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);
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:15,代码来源:MainGameScene.cpp

示例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;
}
开发者ID:zhu410289616,项目名称:LoliRun,代码行数:15,代码来源:GameMainLayer.cpp

示例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);
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:17,代码来源:MainGameScene.cpp

示例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);
    }
    
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:18,代码来源:MainGameScene.cpp

示例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);
							}
						}
					}
开发者ID:niuzb,项目名称:hellopet,代码行数:43,代码来源:UIScrollLayer.cpp

示例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;
}
开发者ID:zhu410289616,项目名称:LoliRun,代码行数:43,代码来源:GameMainLayer.cpp

示例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);
}
开发者ID:jonesgithub,项目名称:OzgGameRPG,代码行数:22,代码来源:RPGStartSceneLayer.cpp

示例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();
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:23,代码来源:MainLayerZhuangBeiBaseBody.cpp


注:本文中的CCMenu::setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。