Пример #1
0
bool CGameSceneManager::go(SCENE_TYPE st)
{
    Scene* scene = nullptr;
    switch (st)
    {
        case ST_LOGIN:
        {
            CCBReader* pReader = new CCBReader(NodeLoaderLibrary::getInstance());
            scene = pReader->createSceneWithNodeGraphFromFile("login_layer.ccbi");
            delete pReader;
            break;
        }
        case ST_LOBBY:
        {
            CCBReader* pReader = new CCBReader(NodeLoaderLibrary::getInstance());
            scene = pReader->createSceneWithNodeGraphFromFile("lobby_layer.ccbi");
            delete pReader;
            break;
        }
        case ST_FORMATION:
        {
            scene = Scene::create();
            scene->addChild(CFormationLayer::create());
            break;
        }
        case ST_BATTLE_FIELD:
        {
            scene = Scene::create();
            scene->addChild(CBattleFieldLayer::create());       // call init in create()
            break;
        }
        case ST_SETTINGS:
            break;
        case ST_HOME:
        {
            CCBReader* pReader = new CCBReader(NodeLoaderLibrary::getInstance());
            scene = pReader->createSceneWithNodeGraphFromFile("home_layer.ccbi");
            delete pReader;
            break;
        }
        default:
            break;
    }
    if (scene)
    {
        Director* pDirector = Director::getInstance();
        if (pDirector->getRunningScene())
        {
            TransitionFade* trans = TransitionFade::create(.2f, scene, Color3B(255, 255, 255));
            pDirector->replaceScene(trans);
        }
        else
        {
            pDirector->runWithScene(scene);
        }
    }
    
    return true;
}
CCScene* MainScene::getMainScene() {
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::sharedNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerCCNodeLoader("MainScene", MainSceneLoader::loader());

    CCBReader *ccbReader = new CCBReader(ccNodeLoaderLibrary);

    return ccbReader->createSceneWithNodeGraphFromFile("ccb/MainScreen.ccbi");
}
CCScene* StoreBScene::getStoreBScene() {
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerCCNodeLoader("StoreBScene", StoreBSceneLoader::loader());

    CCBReader *ccbReader = new CCBReader(ccNodeLoaderLibrary);
    ccbReader->retain();
    CCScene *pScene = ccbReader->createSceneWithNodeGraphFromFile("ccb/StoreBScene.ccbi");
    ccbReader->release();
    return pScene;
}
Пример #4
0
CCScene* BattleScene::scene(){
    CCNodeLoaderLibrary *nodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
    CCBReader *reader = new CCBReader(nodeLoaderLibrary);
    
    // 'scene' is an autorelease object.
    CCScene *scene = reader->createSceneWithNodeGraphFromFile("BattleScene.ccbi");

    reader->release();
    
    // return the scene
    return scene;
}