本文整理汇总了C++中CCMenuItemImage::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemImage::setEnabled方法的具体用法?C++ CCMenuItemImage::setEnabled怎么用?C++ CCMenuItemImage::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemImage
的用法示例。
在下文中一共展示了CCMenuItemImage::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool StartScene::init(){
if(!CCLayer::init()) {
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
// create background image
CCSprite* pSprite = CCSprite::create("backgrounds/background0.png");
// set position
pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// set scale
CCSize bgimgSize = pSprite->getContentSize();
pSprite->setScaleX(visibleSize.width/bgimgSize.width);
pSprite->setScaleY(visibleSize.height/bgimgSize.height);
// add bgSprite to bgLayer
this->addChild(pSprite, 0);
CCMenuItemImage *startGameItem = CCMenuItemImage::create("buttons/playbut.png", "buttons/playbut.png",this,menu_selector(StartScene::StartGameCallback));
//startGameItem->setScale(0.1);
startGameItem->setPosition(ccp(visibleSize.width-190 ,130));
startGameItem->setEnabled(true);
CCMenu* mainmenu = CCMenu::create(startGameItem,NULL);
mainmenu->setPosition(ccp(0,0));
this->addChild(mainmenu,1,3);
return true;
}
示例2: checkCard
void MarketScene::checkCard(int index)
{
CCMenu *pMenu = (CCMenu *)this->getChildByTag(TAG_MENU);
char szFileName[32] = { 0 };
for (int i = 0; i < CARD_COUNT; i++)
{
int tag = BTN_CARD + i;
CCMenuItemToggle *pToggle = (CCMenuItemToggle *)pMenu->getChildByTag(tag);
if (tag == index)
{
selectedIndex = index;
pToggle->setSelectedIndex(1);
pToggle->setEnabled(false);
sprintf(szFileName, s_pathCardInfo.m_strPath, i);
int price = getPrice(tag);
updateLabelAtlas(price, LabelAtlas_PRICE);
CCMenuItemImage *pMenuItem = (CCMenuItemImage *)pMenu->getChildByTag(BTN_BUY);
if (g_Control.cards[i] <= 0 && g_Control.m_nCoin > price)
{
pMenuItem->setEnabled(true);
}
else
{
pMenuItem->setEnabled(false);
}
}
else
{
pToggle->setSelectedIndex(0);
pToggle->setEnabled(true);
}
}
this->removeChildByTag(CARD_INFO);
CCSprite *pcdSprite = CCSprite::create(szFileName);
pcdSprite->setPosition(s_pathCardInfo.m_Position);
pcdSprite->setTag(CARD_INFO);
this->addChild(pcdSprite);
pcdSprite->runAction(CCSequence::create(CCSpawn::create(CCScaleTo::create(0.2f, 1.0f), CCFadeTo::create(0.2f, 255), NULL), NULL));
}
示例3: init
bool GameMenu::init()
{
if (!CCLayer::init())
{
return false;
}
CCSize size = CCDirector::sharedDirector()->getWinSize();
//菜单背景
CCSprite *bg = CCSprite::create("MainMenu.png");
bg->setScale(0.5);
bg->setPosition(ccp(size.width/2, size.height/2));
this->addChild(bg,0,0);
//按钮
CCMenuItemImage *newGameItem = CCMenuItemImage::create("newgameA.png", "newgameB.png",this,menu_selector(GameMenu::menuNewGameCallback));
newGameItem->setScale(0.5);
newGameItem->setPosition(ccp(size.width/2 + 40, size.height/2 - 20));
newGameItem->setEnabled(false);
CCMenuItemImage *continueItem = CCMenuItemImage::create("continueA.png", "continueB.png",this,menu_selector(GameMenu::menuContinueCallback));
continueItem->setScale(0.5);
continueItem->setPosition(ccp(size.width/2 + 40, size.height/2 - 60));
continueItem->setEnabled(false);
CCMenuItemImage *aboutItem = CCMenuItemImage::create("aboutA.png", "aboutB.png",this,menu_selector(GameMenu::menuAboutCallback));
aboutItem->setScale(0.5);
aboutItem->setPosition(ccp(size.width/2 + 40, size.height/2 - 100));
aboutItem->setEnabled(false);
soundItem = CCMenuItemImage::create("sound-on-A.png", "sound-on-B.png",this,menu_selector(GameMenu::menuSoundCallback));
soundItem->setScale(0.5);
soundItem->setEnabled(false);
soundItem->setPosition(ccp(40, 40));
CCMenu *mainmenu = CCMenu::create(newGameItem,continueItem,aboutItem,soundItem,NULL);
mainmenu->setPosition(ccp(0, 0));
this->addChild(mainmenu,1,3);
issound = true;
//初始化声音
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3"));
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5);
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3")).c_str(), true);
return true;
}
示例4: init
bool GameOverLayer::init() {
if (!CCLayerColor::initWithColor(ccc4(0,0,0,150))) {
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
// create background sprite
CCSprite* pSprite = CCSprite::create(m_bgImage);
pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
CCSize bgimgSize = pSprite->getContentSize();
pSprite->setScaleX(visibleSize.width/bgimgSize.width);
pSprite->setScaleY(visibleSize.height/bgimgSize.height);
this->addChild(pSprite, 0);
// create buttons
CCMenuItemImage *newGameItem = CCMenuItemImage::create("buttons/restart.png", "buttons/restart.png",this,menu_selector(GameOverLayer::StartNewGameCallback));
newGameItem->setPosition(ccp(visibleSize.width - 165,222));
newGameItem->setEnabled(true);
CCMenuItemImage *nextItem = CCMenuItemImage::create("buttons/next.png", "buttons/next.png",this,menu_selector(GameOverLayer::StartNextCallback));
nextItem->setPosition(ccp(visibleSize.width - 165,177));
nextItem->setEnabled(true);
CCMenuItemImage *homeItem = CCMenuItemImage::create("buttons/return.png", "buttons/return.png",this,menu_selector(GameOverLayer::ReturnHomeCallback));
homeItem->setPosition(ccp(visibleSize.width - 165,137));
homeItem->setEnabled(true);
CCMenuItemImage *exitGameItem = CCMenuItemImage::create("buttons/exit.png", "buttons/exit.png",this,menu_selector(GameOverLayer::ExitGameCallback));
exitGameItem->setPosition(ccp(visibleSize.width-165,80));
exitGameItem->setEnabled(true);
CCMenu* mainmenu = CCMenu::create(newGameItem,nextItem,exitGameItem,homeItem,NULL);
mainmenu->setPosition(ccp(0,0));
this->addChild(mainmenu,1,3);
return true;
}
示例5: init
bool GameMenuLayer::init()
{
if (!CCLayer::init())
return false;
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
CCPoint originPoint = CCDirector::sharedDirector()->getVisibleOrigin();
CCSprite *bg = CCSprite::create("MainMenu.png");
bg->setPosition(ccp(size.width/2, size.height/2));
this->addChild(bg, 0, 0);
CCMenuItemImage *newGameItem = CCMenuItemImage::create("newgameA.png", "newgameB.png", this, menu_selector(GameMenuLayer::menuNewGameCallback));
newGameItem->setPosition(ccp(size.width/2 + 40, size.height/2));
newGameItem->setEnabled(false);
CCMenuItemImage *continueItem = CCMenuItemImage::create("continueA.png", "continueB.png", this, menu_selector(GameMenuLayer::menuContinueCallback));
continueItem->setPosition(ccp(size.width/2 + 40, size.height/2 - 60));
continueItem->setEnabled(false);
CCMenuItemImage *aboutItem = CCMenuItemImage::create("aboutA.png", "aboutB.png", this, menu_selector(GameMenuLayer::menuAboutCallback));
aboutItem->setPosition(ccp(size.width/2 + 40, size.height/2 - 120));
aboutItem->setEnabled(false);
soundItem = CCMenuItemImage::create("sound-on-A.png", "sound-on-B.png", this, menu_selector(GameMenuLayer::menuSoundCallback));
soundItem->setPosition(ccpAdd(ccp(40, 40), originPoint));
soundItem->setEnabled(false);
CCMenu *mainMenu = CCMenu::create(newGameItem,continueItem,aboutItem,soundItem,NULL);
mainMenu->setPosition(CCPointZero);
this->addChild(mainMenu, 1, 3);
this->isSound = CCUserDefault::sharedUserDefault()->getBoolForKey(kBackgroundSound, false);
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(CCFileUtils::sharedFileUtils()->fullPathForFilename("background.mp3").c_str());
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5f);
if (this->isSound) {
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(CCFileUtils::sharedFileUtils()->fullPathForFilename("background.mp3").c_str(), true);
}
return true;
}
示例6: init
bool GameAbout::init()
{
if (!CCLayer::init()) {
return false;
}
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCSprite *bg = CCSprite::create("bg.png");
bg->setPosition(ccp(size.width/2, size.height/2));
bg->setScale(0.5f);
this->addChild(bg, 0, 0);
CCSprite *bgStar = CCSprite::create("moon.png");
bgStar->setAnchorPoint(ccp(0.5, 0));
bgStar->setPosition(ccp(size.width/3, 0));
bgStar->setScale(0.5f);
this->addChild(bgStar, 1, 1);
CCSprite *frame = CCSprite::create("tb.png");
frame->setPosition(ccp(size.width/2, size.height/2));
frame->setScale(0.5f);
this->addChild(frame, 2, 2);
char info[256];
sprintf(info, "name: meow war\n\nprogram: aiyiai\n\nart design: wa wa\n\ncompany: xi an men\n\n powered by cocos2d-x");
CCLabelTTF *label = CCLabelTTF::create(info, "Marker Felt", 40, CCSizeMake(400, 400), kCCTextAlignmentLeft);
label->setAnchorPoint(ccp(0, 1));
label->setPosition(ccp(50, 600));
label->setColor(ccc3(200, 200, 200));
frame->addChild(label);
CCSprite *aboutTitle = CCSprite::create("about.png");
aboutTitle->setPosition(ccp(size.width/2, size.height - 20));
aboutTitle->setScale(0.5f);
this->addChild(aboutTitle, 3, 3);
CCMenuItemImage *backItem = CCMenuItemImage::create("backA.png", "backB.png", this, menu_selector(GameAbout::menuBackCallback));
backItem->setPosition(ccp(size.width - 20, size.height - 20));
backItem->setScale(0.5f);
backItem->setEnabled(false);
CCMenu *mainMenu = CCMenu::create(backItem, NULL);
mainMenu->setPosition(CCPointZero);
this->addChild(mainMenu, 3, 4);
return true;
}
示例7: createPillar
CCMenuItemImage* HelloWorld::createPillar(int posX, int tag)
{
CCMenu* menu = CCMenu::create();
CCMenuItemImage* pillar = CCMenuItemImage::create("/pillar.png","/pillar.png",this,menu_selector(HelloWorld::selectPillar));
pillar->setScaleX(float(0.2));
pillar->setScaleY(float(0.4));
pillar->setPosition(ccp(posX,-75));
pillar->setTag(tag);
pillar->setEnabled(false);
menu->setTag(tag);
menu->addChild(pillar);
this->addChild(menu);
return pillar;
}
示例8: init
bool GameAbout::init()
{
if ( !CCLayer::init() )
{
return false;
}
CCSize size = CCDirector::sharedDirector()->getWinSize();
//初始化背景
CCSprite* bg = CCSprite::create("bg.png");
bg->setScale(0.5);
bg->setPosition( ccp(size.width/2, size.height/2) );
this->addChild(bg, 0,0);
//初始化星球
CCSprite*bgstar = CCSprite::create("moon.png");
bgstar->setAnchorPoint(ccp(0.5,0));
bgstar->setScale(0.5);
bgstar->setPosition(ccp(size.width/3 * 1, 0));
this->addChild(bgstar,1,1);
//初始化关于框
CCSprite*kuang = CCSprite::create("tb.png");
kuang->setScale(0.5);
kuang->setPosition(ccp(size.width/2, size.height/2));
this->addChild(kuang,2,2);
char inf[256];
sprintf(inf,"name:meow war\n\nprogram:shuoquan man\n\nart design:peng xu\n\ncompany:hz books\n\n powered by cocos2D-x");
CCLabelTTF * myjineng = CCLabelTTF::create(inf,CCSizeMake(400,400),kCCTextAlignmentLeft, "Marker Felt", 40);
myjineng->setAnchorPoint(ccp(0,1));
myjineng->setColor(ccc3(200,200,200));
myjineng->setPosition(ccp(50,600));
kuang->addChild(myjineng);
//初始化关于标题
CCSprite*abouttitle = CCSprite::create("about.png");
abouttitle->setScale(0.5);
abouttitle->setPosition(ccp(size.width/2, size.height - 20));
this->addChild(abouttitle,3,3);
//初始化返回按钮
CCMenuItemImage *back = CCMenuItemImage::create("backA.png", "backB.png",this,menu_selector(GameAbout::menuBackCallback));
back->setScale(0.5);
back->setPosition(ccp(size.width - 20,size.height - 20));
back->setEnabled(false);
CCMenu* mainmenu = CCMenu::create(back,NULL);
mainmenu->setPosition(ccp(0,0));
this->addChild(mainmenu,3,4);
return true;
}
示例9: initMenu
void LevelSelection::initMenu()
{
const int levels = GlobalColaboration::getInstance()->getAvaliablesLevels();
m_menuItems = CCArray::createWithCapacity(levels);
m_menuItems->retain();
for (int i = 1; i <= 5; i++)
{
char filenameOff[40]{0};
sprintf(filenameOff, "Interfaz/numero%d-of.png", i);
char filenameOn[40]{0};
sprintf(filenameOn, "Interfaz/numero%d-on.png", i);
CCMenuItemImage *number = CCMenuItemImage::create(
filenameOff,
filenameOn,
"Interfaz/lock.png",
this,
menu_selector(LevelSelection::menuPlayCallback));
number->setTag(i);
if (i > levels)
{
number->setEnabled(false);
}
number->setPosition (CCPoint{m_visibleSize.width*.65f - i%2*(m_visibleSize.width*.4f),
m_visibleSize.height - i*m_visibleSize.height*.15f});
m_menuItems->addObject(number);
}
CCMenuItemImage *pBackItem = CCMenuItemImage::create(
"Interfaz/Flecha-of.png",
"Interfaz/Flecha-on.png",
this,
menu_selector(LevelSelection::menuBackCallback));
pBackItem->setPosition (CCPoint{m_visibleSize.width*.5f,
m_visibleSize.height*.05f});
m_menuItems->addObject(pBackItem);
CCMenu *pMenu = CCMenu::createWithArray(m_menuItems);
pMenu->setPosition(ccp(0.f, 0.f));
this->addChild(pMenu, static_cast<int>(zOrder::zIndex_6));
}
示例10: buyCard
void MarketScene::buyCard(CCNode * pNode)
{
int price = getPrice(selectedIndex);
if (g_Control.m_nCoin >= price)
{
CCMenuItemImage *pItem = (CCMenuItemImage *)pNode;
pItem->setEnabled(false);
//¹´Ñ¡ÒÑÂòÏî
CCMenu *pMenu = (CCMenu *)this->getChildByTag(TAG_MENU);
CCMenuItemToggle *pToggle = (CCMenuItemToggle *)pMenu->getChildByTag(selectedIndex);
CCSprite *sprite = CCSprite::create(s_pathCardbuy.m_strPath);
sprite->setPosition(s_pathCardbuy.m_Position);
pToggle->addChild(sprite, TAG_CARD_BUY, TAG_CARD_BUY);
//¿ÛÇ®
g_Control.m_nCoin -= price;
updateLabelAtlas(g_Control.m_nCoin, LabelAtlas_COIN);
g_Control.cards[selectedIndex - BTN_CARD] = 1;
g_Control.save();
}
}
示例11: makeResumeDaialog
void MainGameScene::makeResumeDaialog()
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
//CCSpriteで作ると、タッチ判定無効とかめんどくさいからBGもMenuItemで作る
CCMenuItemImage* resumeBG = CCMenuItemImage::create("logo_Info2.png","logo_Info2.png");
resumeBG->setScale(0.7);
resumeBG->setPosition(ccp(winSize.width * 0.5, winSize.height * 0.5));
resumeBG->setEnabled(false);
CCSize pResumeBGSize = resumeBG->getContentSize();
CCLabelTTF* resumeLabel;
resumeLabel = CCLabelTTF::create(NKLocalizedString::LocalizedString("resume", "RESUME"), "Copperplate", 60.0);
resumeLabel->setColor(ccc3(0, 0, 0));
resumeLabel->setPosition(ccp(pResumeBGSize.width * 0.5 ,pResumeBGSize.height * 0.7));
resumeBG->addChild(resumeLabel);
CCMenuItemImage* titleItem = CCMenuItemImage::create("button1.png","button1.png" ,this, menu_selector(MainGameScene::tapTitleButton));
titleItem->setPosition(ccp(winSize.width * 0.3, winSize.height * 0.47));
CCLabelTTF* titleLabel;
titleLabel = CCLabelTTF::create("TITLE", "Arial", 30.0);
CCSize pTitleItemSize = titleItem->getContentSize();
titleLabel->setPosition(ccp(pTitleItemSize.width / 2 ,pTitleItemSize.height / 2));
titleItem->addChild(titleLabel);
titleItem->setScale(0.8);
CCMenuItemImage* returnGameItem = CCMenuItemImage::create("button2.png","button2.png" ,this, menu_selector(MainGameScene::returnMainGame));
returnGameItem->setPosition(ccp(winSize.width * 0.7, winSize.height * 0.47));
CCLabelTTF* returnGameLabel;
returnGameLabel = CCLabelTTF::create("CANCEL", "Arial", 30.0);
CCSize pReturnGameSize = returnGameItem->getContentSize();
returnGameLabel->setPosition(ccp(pReturnGameSize.width / 2 ,pReturnGameSize.height / 2));
returnGameItem->addChild(returnGameLabel);
returnGameItem->setScale(0.8);
CCMenuItemImage* retryGameItem = CCMenuItemImage::create("button3.png","button3.png" ,this, menu_selector(MainGameScene::doRetry));
retryGameItem->setPosition(ccp(winSize.width * 0.5, winSize.height * 0.39));
CCLabelTTF* retryGameLabel;
retryGameLabel = CCLabelTTF::create("RETRY", "Arial", 30.0);
CCSize pRetryGameSize = retryGameItem->getContentSize();
retryGameLabel->setPosition(ccp(pRetryGameSize.width / 2 ,pRetryGameSize.height / 2));
retryGameItem->addChild(retryGameLabel);
retryGameItem->setScale(0.8);
CCMenu* resumeDialog = CCMenu::create(resumeBG, titleItem, returnGameItem,retryGameItem,NULL);
resumeDialog->setPosition(CCPointZero);
resumeDialog->setTag(tagResumeDialog);
resumeDialog->setOpacity(0);
resumeDialog->setZOrder(Z_ORDER_RESUME_DIALOG);
resumeDialog->setEnabled(false);
this->addChild(resumeDialog);
}
示例12: init
bool GameMenu::init()
{
if ( !CCLayer::init() )
{
return false;
}
CCSize size = CCDirector::sharedDirector()->getWinSize();
//初始化背景
CCSprite* bg = CCSprite::create("bg.png");
bg->setScale(0.5);
bg->setPosition( ccp(size.width/2, size.height/2) );
this->addChild(bg, 0,0);
//初始化背景星球
CCSprite*bgstar = CCSprite::create("moon.png");
bgstar->setAnchorPoint(ccp(0.5,0));
bgstar->setScale(0.5);
bgstar->setPosition(ccp(size.width/3 * 2, 0));
this->addChild(bgstar,1,1);
//初始化标题
CCNode *title = CCNode::create();
title->setContentSize(CCSizeMake(size.width - 40,50));
CCSprite *ptmLabel = CCSprite::create("meowstar.png");
ptmLabel->setScale(0.5);
ptmLabel->setPosition( ccp(0,30) );
title->addChild(ptmLabel);
CCSprite *ptbLabel = CCSprite::create("battle.png");
ptbLabel->setScale(0.5);
ptbLabel->setPosition( ccp(0,-30) );
title->addChild(ptbLabel);
title->setPosition(ccp(size.width / 2, size.height - 80));
this->addChild(title,2,2);
//初始化按钮
CCMenuItemImage *newGameItem = CCMenuItemImage::create("newGameA.png", "newGameB.png",this,menu_selector(GameMenu::menuNewGameCallback));
newGameItem->setScale(0.5);
newGameItem->setPosition(ccp(size.width / 2,size.height / 2 - 20));
newGameItem->setEnabled(false);
CCMenuItemImage *continueItem = CCMenuItemImage::create("continueA.png", "continueB.png",this,menu_selector(GameMenu::menuContinueCallback));
continueItem->setScale(0.5);
continueItem->setPosition(ccp(size.width / 2,size.height / 2 - 80));
continueItem->setEnabled(false);
CCMenuItemImage *aboutItem = CCMenuItemImage::create("aboutA.png", "aboutB.png",this,menu_selector(GameMenu::menuAboutCallback));
aboutItem->setScale(0.5);
aboutItem->setPosition(ccp(size.width / 2,size.height / 2 - 140));
aboutItem->setEnabled(false);
soundItem = CCMenuItemImage::create("sound-on-A.png", "sound-on-B.png",this,menu_selector(GameMenu::menuSoundCallback));
soundItem->setScale(0.5);
soundItem->setEnabled(false);
soundItem->setPosition(ccp(40,40));
//使用按钮创建菜单
CCMenu* mainmenu = CCMenu::create(newGameItem,continueItem,aboutItem,soundItem,NULL);
mainmenu->setPosition(ccp(0,0));
this->addChild(mainmenu,1,3);
//初始化声音部分
issound = true;//是否开启声音参数
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3") );
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5);
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3")).c_str(), true);
return true;
}
示例13: buildHeader
void BaseScene::buildHeader(int highlightIndex, const char* title, const char* description)
{
_currentMenuIndex = highlightIndex;
CCMenuItemImage* homeButton = CCMenuItemImage::create();
homeButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_nrl"));
homeButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_prd"));
homeButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_prd"));
homeButton->setTarget(this, menu_selector(BaseScene::loadHomeScene));
homeButton->setAnchorPoint(ccp(1.0f, 1.0f));
CCMenuItemImage* fbActionButton = CCMenuItemImage::create();
fbActionButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_nrl"));
fbActionButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_prd"));
fbActionButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_dis"));
fbActionButton->setTarget(this, menu_selector(BaseScene::loadFBActionScene));
fbActionButton->setAnchorPoint(ccp(1.0f, 1.0f));
if (EziSocialObject::sharedObject()->isFacebookSessionActive() == false)
{
fbActionButton->setEnabled(false);
}
CCMenuItemImage* helpButton = CCMenuItemImage::create();
helpButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_nrl"));
helpButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_prd"));
helpButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_prd"));
helpButton->setTarget(this, menu_selector(BaseScene::loadHelpScene));
helpButton->setAnchorPoint(ccp(1.0f, 1.0f));
switch (highlightIndex)
{
case 0:
homeButton->setEnabled(false);
break;
case 1:
fbActionButton->setEnabled(false);
break;
case 2:
helpButton->setEnabled(false);
break;
default:
break;
}
CCMenu* homeMenu = CCMenu::create(homeButton, fbActionButton, helpButton, NULL);
homeMenu->alignItemsHorizontally();
this->addChild(homeMenu);
PlaceNode(homeMenu, 0.88, 0.98);
// Add a line.
CCLayerColor* lineLayer = CCLayerColor::create(ccc4(204, 204, 204, 204),
CCDirector::sharedDirector()->getVisibleSize().width,
1.0 * AppDelegate::SCREEN_SCALE_FACTOR);
this->addChild(lineLayer);
PlaceNode(lineLayer, 0.0, 0.8);
lineLayer->setPositionY(homeMenu->getPositionY() - homeButton->getContentSize().height - (7 * AppDelegate::SCREEN_SCALE_FACTOR));
// Add Title
CCLabelTTF* titleLabel = CCLabelTTF::create(title, "Arial", 50.0 * AppDelegate::SCREEN_SCALE_FACTOR);
this->addChild(titleLabel);
titleLabel->setAnchorPoint(ccp(0.0f, 0.0f));
//PlaceNode(titleLabel, 0.02, 0.98);
CCLabelTTF* descriptionLabel = CCLabelTTF::create(description,
"Arial", SCALED_VALUE(22.0f));
this->addChild(descriptionLabel);
descriptionLabel->setAnchorPoint(ccp(0.0f, 0.0f));
PlaceNode(descriptionLabel, 0.02, 0.98);
descriptionLabel->setPositionY(homeMenu->getPositionY() - homeButton->getContentSize().height);
descriptionLabel->setColor(ccc3(204, 204, 204));
titleLabel->cocos2d::CCNode::setPosition(descriptionLabel->getPositionX(),
descriptionLabel->getPositionY() + descriptionLabel->getContentSize().height - 2.0f);
}
示例14: displayXiangQing
void MailInfoListLayer::displayXiangQing(Flat_DuanzaoGroupZBInfo zbInfo)
{
//this->disableAllTouchBegin();
mCurTaoZhuang_Info = zbInfo;
BaseSprite *board = BaseSprite::create("zhuangbei_xiangxi_mianban.png");
/*BaseLayer *layer = new BaseLayer();
layer->setContentSize(board->getContentSize());
layer->setPosition(board->getPosition());
layer->addChild(board);*/
CCDirector::sharedDirector()->getRunningScene()->addChild(board,1030);
//MainLayerBase::getCurrentMainBase()->getHeader()->setContent(BaseSprite::create());
//MainLayerBase::getCurrentMainBase()->setContaintLayer(layer,false);
//layer->release();
refreshEquipBoard(board, zbInfo);
board->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2 + 106));
ListMenu *menu = ListMenu::create();
board->addChild(menu, 10);
menu->setPosition(CCPointZero);
// menu->setTouchPriority(-131);
BaseSprite *norImg = BaseSprite::create("close.png");
BaseSprite *selImg = BaseSprite::create("close_select.png");
CCMenuItemSprite *item = CCMenuItemSprite::create(norImg, selImg, NULL, this, menu_selector(MailInfoListLayer::menuItemClicked_close));
menu->addChild(item, 0);
item->setPosition(ccp(board->getContentSize().width-44+12, board->getContentSize().height-36+2));
//底纹
ImageData diWenData = ImageManager::getManager()->getImageData_DiWen_XiangQing(
zbInfo.zhuangbei_colour
, false
, SuitPool::getPool()->isSuit(zbInfo.zb_group_id));
BaseSprite* diWen = BaseSprite::create(diWenData.getCurrentImageFile());
diWen->setScale(0.7f);
board->addChild(diWen);
diWen->setPosition(ccp(123, 838-240+122));
// 装备图片
string equipfile = zbInfo.zhuangbei_pic;
equipfile = "minute_" + equipfile + ".png";
BaseSprite *s = BaseSprite::create(equipfile);
diWen->addChild(s);
s->setPosition(ccp(diWen->getContentSize().width/2,diWen->getContentSize().height/2));
//套装按钮
if(SuitPool::getPool()->isSuit(zbInfo.zb_group_id))
{
string norStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang.png";
string selStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_select.png";
// if (ChuanqiPool::getPool()->isShenBing(mEquipVec.at(idx).zb_group_id))
// {
// norStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_shenbing.png";
// selStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_shenbing_select.png";
// }
CCMenuItemImage *taozhuangItem = CCMenuItemImage::create(
norStr.c_str()
, selStr.c_str()
, this ,menu_selector(MailInfoListLayer::menuItemClicked_equipDetailMenu));
menu->addChild(taozhuangItem, 0);
taozhuangItem->setAnchorPoint(ccp(1, 0));
taozhuangItem->setPosition(ccp(diWen->getPositionX()+diWen->getContentSize().width/2*diWen->getScaleX()
, diWen->getPositionY()-diWen->getContentSize().height/2*diWen->getScaleY()));
taozhuangItem->setEnabled(false);
}
m_dEquimentDialog = board;
m_mDEquipmentMenu = menu;
}
示例15: menuStartCallback
void LevelSelectScene::menuStartCallback(CCObject *pSender)
{
CCMenu* levelSelectMenu = (CCMenu*)this->getChildByTag(tagLevelSelectMenuDialog);
if(levelSelectMenu){
levelSelectMenu->setOpacity(128);
levelSelectMenu->setEnabled(false);
}
CCMenuItemImage* targetLevelImage = (CCMenuItemImage*)pSender;
m_level = targetLevelImage->getTag();
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCMenuItemImage* startMenuBG = CCMenuItemImage::create("logo_Info2.png","logo_Info2.png");
startMenuBG->setScale(0.7);
startMenuBG->setPosition(ccp(winSize.width * 0.5, winSize.height * 0.5));
startMenuBG->setEnabled(false);
CCString* levelStr = CCString::createWithFormat("Lv:%d",m_level);
CCSize pStartBGSize = startMenuBG->getContentSize();
CCLabelTTF* levelLabel;
levelLabel = CCLabelTTF::create(levelStr->getCString(), "Copperplate", 60.0);
levelLabel->setColor(ccc3(0, 0, 0));
levelLabel->setPosition(ccp(pStartBGSize.width * 0.5 ,pStartBGSize.height * 0.75));
startMenuBG->addChild(levelLabel);
//ハイスコアを表示
CCString* bestStr = CCString::createWithFormat("MIN:%d BEST:%d",min_score[m_level-1],best_score[m_level-1]);
CCLabelTTF* bestLabel;
bestLabel = CCLabelTTF::create(bestStr->getCString(), "Copperplate", 60.0);
bestLabel->setColor(ccc3(0, 0, 0));
bestLabel->setPosition(ccp(pStartBGSize.width * 0.5 ,pStartBGSize.height * 0.5));
startMenuBG->addChild(bestLabel);
CCMenuItemImage* titleItem = CCMenuItemImage::create("button1.png","button1.png" ,this, menu_selector(LevelSelectScene::startGame));
titleItem->setPosition(ccp(winSize.width * 0.3, winSize.height * 0.42));
CCLabelTTF* titleLabel;
titleLabel = CCLabelTTF::create("START", "Arial", 30.0);
CCSize pTitleItemSize = titleItem->getContentSize();
titleLabel->setPosition(ccp(pTitleItemSize.width / 2 ,pTitleItemSize.height / 2));
titleItem->addChild(titleLabel);
titleItem->setScale(0.8);
CCMenuItemImage* returnGameItem = CCMenuItemImage::create("button2.png","button2.png" ,this, menu_selector(LevelSelectScene::hiddenStartMenu));
returnGameItem->setPosition(ccp(winSize.width * 0.7, winSize.height * 0.42));
CCLabelTTF* returnGameLabel;
returnGameLabel = CCLabelTTF::create("CANCEL", "Arial", 30.0);
CCSize pReturnGameSize = returnGameItem->getContentSize();
returnGameLabel->setPosition(ccp(pReturnGameSize.width / 2 ,pReturnGameSize.height / 2));
returnGameItem->addChild(returnGameLabel);
returnGameItem->setScale(0.8);
CCMenu* resumeDialog = CCMenu::create(startMenuBG, titleItem, returnGameItem, NULL);
resumeDialog->setPosition(CCPointZero);
resumeDialog->setTag(tagStartMenuDialog);
resumeDialog->setScale(winSize.width/640);
this->addChild(resumeDialog);
}