菜单;播放声音;转换场景;场景退出时,删除触摸机制;

// 1. add switch Buttons

CCSprite* tabImgFrame1 = CCSprite::create("main.png", CCRectMake(700, 600, 120, 100));

CCSprite* tabImgFrame2 = CCSprite::create("main.png",CCRectMake(700, 600, 120, 100));


CCMenuItemSprite* uiHandgunTabBtn = CCMenuItemSprite::create(
            tabImgFrame1,
            tabImgFrame1,
    abImgFrame1,
            this,
            menu_selector(ArsenalScene::arsenalSwitchPageCallback));
uiHandgunTabBtn->setTag(PAGE_HANDGUN);// 1
uiHandgunTabBtn->setPosition(ccp( TAB_BTN_POSITION_X1,TAB_BTN_POSITION_Y ));
//
CCMenuItemSprite* uiShotgunTabBtn = CCMenuItemSprite::create(
            tabImgFrame2,
            tabImgFrame2,
    tabImgFrame2,
            this,
            menu_selector(ArsenalScene::arsenalSwitchPageCallback));
uiShotgunTabBtn->setTag(PAGE_SHOTGUN);// 2
uiShotgunTabBtn->setPosition(ccp( TAB_BTN_POSITION_X2,TAB_BTN_POSITION_Y ));

// Create a menu with the all buttons, it's an auto release object.
CCMenu* uiMenu = CCMenu::create(uiHandgunTabBtn,,uiShotgunTabBtn,uiMacgunTabBtn,uiSniperTabBtn,uiHandcanTabBtn, NULL);
uiMenu->setPosition(CCPointZero);
this->addChild(uiMenu, 2);

2///////////////////

SimpleAudioEngine::sharedEngine()->playEffect("sound_btn_click.mp3");

3////////////

CCScene* pScene = LevelupScene::scene();
CCDirector::sharedDirector()->pushScene(pScene);

4、、、、、

void ArsenalScene::onExit()
{
	CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);
<span style="white-space:pre">	</span>//
	CCLayer::onExit();
}


你可能感兴趣的:(菜单;播放声音;转换场景;场景退出时,删除触摸机制;)