KeypadDispatchCenter::KeypadDispatchCenter()
{
    log("%s", __FUNCTION__);
    m_pKeyBoardListener = EventListenerKeyboard::create();
    m_pKeyBoardListener->onKeyPressed = [this](EventKeyboard::KeyCode code, Event*){
        log("%s %d onKeyPressed", __FUNCTION__, code);
        switch (code) {
            case EventKeyboard::KeyCode::KEY_BACK:
                keyBackClicked();
                break;
                
            default:
                break;
        }
    };
    m_pKeyBoardListener->onKeyReleased = [this](EventKeyboard::KeyCode code, Event*){
        log("%s %d onKeyReleased", __FUNCTION__, code);
        switch (code) {
            case EventKeyboard::KeyCode::KEY_BACK:
                keyBackClicked();
                break;
                
            default:
                break;
        }
    };
    Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(m_pKeyBoardListener, 1);
}
void SelectStageScene::onClickBtn(cocos2d::CCNode *node){
    
    int tag = node->getTag();
    
    if(tag == -1){
        keyBackClicked();
    }else if (tag >= 0){
        CCLOG("clicked %d level %d, stage %d", tag, _selectLevel, tag + 1);
        LevelGameScene* levelGame = LevelGameScene::create();
        levelGame->setData(_selectLevel, tag + 1);
        CCTransitionFade* trans = CCTransitionFade::create(Constants::REPLACE_SCENE_TIME, levelGame);
        CCDirector::sharedDirector()->replaceScene(trans);
    }
}
void SelectLevelScene::onClickBtn(cocos2d::CCNode *node){
    
    int tag = node->getTag();
    
    if(tag == -1){
        keyBackClicked();
    }else if (tag == 1){
        SelectStageScene* selectLevel = SelectStageScene::create(_curLevel + 1);
        
        CCTransitionFade* trans = CCTransitionFade::create(Constants::REPLACE_SCENE_TIME, selectLevel);
        
        CCDirector::sharedDirector()->replaceScene(trans);
    }
}
Beispiel #4
0
void MazeScene::menuSoundSettingCallback(CCObject* pSender)					//关闭开启声音
{
	//GlobalSetting::setSoundStatus(!GlobalSetting::getSoundStatus());
	keyBackClicked();
}
Beispiel #5
0
void GameSceneLayer::onPause(CCObject *pSender)
{
	//showSplashAd();
	keyBackClicked();
}