本文整理汇总了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);
}
}
}
示例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;
}
示例3: finishLoading
void MainLoadingScene::finishLoading()
{
Scene *scene = MainMenuScene::create();
Director *pDirector = Director::getInstance();
TransitionFade *tscene = TransitionFade::create(0.5, scene);
pDirector->replaceScene(tscene);
}
示例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);
}
示例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);
}
示例6: backToMenu
void CreditsScene::backToMenu()
{
PLAYEFFECT;
Director *director = Director::getInstance();
Scene *scene = MainMenuScene::scene();
TransitionFade *transitionScene = TransitionFade::create(0.5, scene);
director->replaceScene(transitionScene);
}
示例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);
}
示例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;
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}