Ejemplo n.º 1
0
CCLayer* Utils::layerWithTag(int tag) {
    CCScene *sc = CCDirector::sharedDirector()->getRunningScene();
    if (sc->getTag() == TAG_GAME_SCENE) {
        CCLayer *layer = (CCLayer *)sc->getChildByTag(tag);
        return layer;
    }
    return NULL;
}
Ejemplo n.º 2
0
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
    CCDirector::sharedDirector()->stopAnimation();

    // if you use SimpleAudioEngine, it must be pause
    // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
//    Alert::create(ALERTTEXT_UNCONNECT,"",this,touchesureventselector(AppDelegate::clickedSureCallback))->show();
    
    CCScene* scene = CCDirector::sharedDirector()->getRunningScene();
    if (SceneTypeStart != scene->getTag())
    {
        SceneManager::getInstance()->replaceScene(SceneTypeStart);
    }
}
Ejemplo n.º 3
0
InGameScene* InGameScene::getGameLayer() {
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCScene* pScene = pDirector->getRunningScene();
    int tag = pScene->getTag();
    if(tag == TAG_INGAMESCENE) {
        CCNode* pNode = pScene->getChildByTag(TAG_INGAMELAYER);
        if(pNode != NULL) {
            return (InGameScene*)pNode;
        } else {
            return NULL;
        }
    } else {
        return NULL;
    }
}