当前位置: 首页>>代码示例>>C++>>正文


C++ Director::replaceScene方法代码示例

本文整理汇总了C++中Director::replaceScene方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::replaceScene方法的具体用法?C++ Director::replaceScene怎么用?C++ Director::replaceScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Director的用法示例。


在下文中一共展示了Director::replaceScene方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: changeScene

void SceneManager::changeScene( EnumSceneType enScenType, bool isTrans, float time )
{
    Scene* pScene = getSceneByType(enScenType);
    
    if(pScene == NULL)
    {
        return;
    }
    //TextureCache::sharedTextureCache()->removeUnusedTextures();
    Director* pDirector = Director::getInstance();
    Scene* curScene = pDirector->getRunningScene();
    if(curScene == NULL)
    {
        pDirector->runWithScene(pScene);
    }
    else
    {
        if(isTrans)
        {
            pDirector->replaceScene(TransitionFade::create(time, pScene));
        }
        else
        {
            pDirector->replaceScene(pScene);
        }
    }
}
开发者ID:Eqistyre,项目名称:Osmanthus,代码行数:27,代码来源:SceneManager.cpp

示例2: go

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;
}
开发者ID:Gamex,项目名称:GameX,代码行数:59,代码来源:CGameSceneManager.cpp

示例3: finishLoading

void MainLoadingScene::finishLoading()
{
    Scene *scene = MainMenuScene::create();

    Director *pDirector = Director::getInstance();
    TransitionFade *tscene = TransitionFade::create(0.5, scene);
    pDirector->replaceScene(tscene);
}
开发者ID:irontec,项目名称:Jakina-mobile,代码行数:8,代码来源:MainLoadingScene.cpp

示例4: backButton

void LevelScene::backButton(Ref* sender)
{
    SimpleAudioEngine::getInstance()->playEffect(std::string(FileUtils::getInstance()->fullPathForFilename("sounds/button.wav")).c_str());
    CategoryScene *scene = CategoryScene::create();
    Director *pDirector = Director::getInstance();
    TransitionFade *tscene = TransitionFade::create(0.5, scene);
    pDirector->replaceScene(tscene);
}
开发者ID:irontec,项目名称:Auskalo,代码行数:8,代码来源:LevelScene.cpp

示例5: buttonClicked

void BukatutaLayer::buttonClicked(Ref *pSender, cocos2d::extension::Control::EventType pCCControlEvent) {
    
    CategoryScene *scene = CategoryScene::create();
    
    Director *pDirector = Director::getInstance();
    TransitionFade *tscene = TransitionFade::create(0.5, scene);
    pDirector->replaceScene(tscene);
}
开发者ID:irontec,项目名称:Auskalo,代码行数:8,代码来源:BukatutaLayer.cpp

示例6: backToMenu

void CreditsScene::backToMenu()
{
    PLAYEFFECT;
    
    Director *director = Director::getInstance();
    Scene *scene = MainMenuScene::scene();
    TransitionFade *transitionScene = TransitionFade::create(0.5, scene);
    director->replaceScene(transitionScene);
}
开发者ID:jxa184971,项目名称:Telepathy,代码行数:9,代码来源:CreditsScene.cpp

示例7: menuCallback

void menuCallback(Object *sender)
{
    Scene *s = Scene::create();
    BackgroundLayer *gLayer = BackgroundLayer::create();
    s->addChild(gLayer);

    GameLayer *pLayer = GameLayer::create();
    s->addChild(pLayer, 1);

    Director *pDirector = Director::getInstance();
    pDirector->replaceScene(s);
}
开发者ID:sydnash,项目名称:wexin_planefight,代码行数:12,代码来源:gameover_layer.cpp

示例8: fillStack

void SceneManager::fillStack()
{
	// Get instance of director
	Director* director = Director::getInstance();

	// Empty the stack
	director->popToRootScene();

	// Add scenes to stack
	director->replaceScene(TransitionFade::create(4, generateLevel(1, 0), Color3B::BLACK));
	level = 1;
}
开发者ID:Totolin,项目名称:cultus-cocos2d,代码行数:12,代码来源:SceneManager.cpp

示例9: menuTouchCallBack

void MainMenuScene::menuTouchCallBack(cocos2d::CCObject *pSender)
{
    CCMenuItem* pMenuItem = (CCMenuItem *)pSender;
    
    Director *director = Director::getInstance();
    
    switch (pMenuItem->getTag()) {
        case 1: {
            CocosDenshion::SimpleAudioEngine::sharedEngine()->stopBackgroundMusic();
            CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sound/MainBGM.mp3", true);
            
			MapScene* gameScene = MapScene::create();
            director->replaceScene(TransitionFade::create(1.0f, gameScene));
            break;
        }
        case 2:{
            Scene* creditScene = CreditScene::createScene();
            director->replaceScene(TransitionFade::create(1.0f,creditScene));
            break;
        }
    }
}
开发者ID:kms1837,项目名称:IndieGameWeekend_TeamAnimalForest,代码行数:22,代码来源:MainMenuScene.cpp

示例10: backButton

void GalderaScene::backButton(Ref* sender)
{
    multzoa->kalifikazioa = kalifikazioa;
    multzoa->currentGaldera = currentGalderaPosition;
    multzoa->bukatuta = 0;
    
    pSQL->updateErabiltzaileMultzoa(multzoa);
    
    CategoryScene *scene = CategoryScene::create();
    
    Director *pDirector = Director::getInstance();
    TransitionFade *tscene = TransitionFade::create(0.5, scene);
    pDirector->replaceScene(tscene);
}
开发者ID:irontec,项目名称:Jakina-mobile,代码行数:14,代码来源:GalderaScene.cpp

示例11: finish

void GalderaScene::finish()
{
    multzoa->kalifikazioa = kalifikazioa;
    multzoa->currentGaldera = currentGalderaPosition;
    multzoa->bukatuta = 1;
    
    pSQL->updateErabiltzaileMultzoa(multzoa);
    
    BukatutaScene *scene = BukatutaScene::create(multzoa);
    
    Director *pDirector = Director::getInstance();
    TransitionFade *tscene = TransitionFade::create(0.5, scene);
    pDirector->replaceScene(tscene);
}
开发者ID:irontec,项目名称:Jakina-mobile,代码行数:14,代码来源:GalderaScene.cpp

示例12: init

bool TimeUpMenuLayer::init() {
    if(!LayerColor::init()) {
        return false;
    }
    
    Director* director = Director::getInstance();
    Vec2 visibleOrigin = director->getVisibleOrigin();
    Size visibleSize = director->getVisibleSize();
    
    //    setContentSize(visibleSize);
    
    Widget* mainMenuLayer = GUIReader::getInstance()->widgetFromJsonFile("ui/connect/time_up_menu.json");
    addChild(mainMenuLayer);
    mainMenuLayer->setContentSize(visibleSize);
    
    Node* mainMenu = mainMenuLayer->getChildByName("content");
    mainMenu->setPositionY((visibleSize.height-mainMenu->getContentSize().height)/2);
    
    Util::registerButton(mainMenu, "tryAgain", [&](Ref* ref,Widget::TouchEventType event){
        switch (event) {
            case cocos2d::ui::Widget::TouchEventType::ENDED:
            {
                m_gameLayer->reset();
                removeFromParent();
            }
                break;
            default:
                break;
        }
    }, "time_up_menu_try_again");
    
    Util::registerButton(mainMenu, "toMainMenu", [=](Ref* ref,Widget::TouchEventType event){
        switch (event) {
            case cocos2d::ui::Widget::TouchEventType::ENDED:
            {
                auto scene = MainMenuLayer::createScene();
                director->replaceScene(scene);
            }
                break;
            default:
                break;
        }
    }, "pause_menu_back_to_main_menu");
    
    Text* title = dynamic_cast<Text*>(mainMenu->getChildByName("title"));
    title->setString(LANG->getLang("time_up_menu_title"));
    
    return true;
}
开发者ID:newcl,项目名称:connect,代码行数:49,代码来源:time_up_menu_layer.cpp

示例13: go

void SceneManager::go(Scene* scene)
{
	Layer* layer = (Layer*)scene;

	Director *director = Director::getInstance();
	Scene *newScene = SceneManager::wrap(layer);
	if ( director->getRunningScene() )
	{
		director->replaceScene(newScene);
	}
	else
	{
		director->runWithScene(newScene);
	}
}
开发者ID:Cocos2dxGame,项目名称:MHE,代码行数:15,代码来源:SceneManager.cpp

示例14: levelSelected

void LevelScene::levelSelected(Ref* sender)
{
    SimpleAudioEngine::getInstance()->playEffect(std::string(FileUtils::getInstance()->fullPathForFilename("sounds/button.wav")).c_str());
    SpriteButton *b = (SpriteButton*) sender;
    int position = b->getTag();
    MultzoaModel *multzoa = (MultzoaModel*) multzoak->at(position);
    if (multzoa->bukatuta == 1) {
        multzoa->bukatuta = 0;
        multzoa->kalifikazioa = 0;
        multzoa->currentGaldera = 1;
        SQLHelper *pSQLHelper = SQLHelper::getInstance();
        pSQLHelper->resetLevel(multzoa);
    }
    GalderaScene *scene = GalderaScene::create(multzoa);
    Director *pDirector = Director::getInstance();
    TransitionFade *tscene = TransitionFade::create(0.5, scene);
    pDirector->replaceScene(tscene);
}
开发者ID:irontec,项目名称:Auskalo,代码行数:18,代码来源:LevelScene.cpp

示例15: go

bool CGameSceneManager::go(SCENE_TYPE st)
{
    Scene* scene = nullptr;
    switch (st)
    {
        case ST_LOGIN:
        {
            scene = CCBReadHelper::readScene("login_layer.ccbi");
            break;
        }
        case ST_LOBBY:
        {
            scene = CCBReadHelper::readScene("lobby_layer.ccbi");
            break;
        }
        case ST_MATCH:
        {
            scene = CCBReadHelper::readScene("pitch_layer.ccbi");
            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;
}
开发者ID:FootBallX,项目名称:FootBallXClient,代码行数:39,代码来源:CGameSceneManager.cpp


注:本文中的Director::replaceScene方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。