Example #1
0
void MainMenuScene::onPlayButtonClicked(Ref* sender, TouchEventType type)
{
    if (TOUCH_EVENT_ENDED==type && GLOBALDATA()->isMapResourceLoaded())
    {
        switchScene(SceneBuilder::buildScene(ST_GAME_SCENE));
    }
}
void Mainpage::menuSettingsCallback(cocos2d::Ref* pSender) {
    cocos2d::log("setting"); // test
	switchScene();
	// 创建新场景
	auto SettingsScene = Settings::createScene();
	// 特效切换场景
    Director::getInstance()->pushScene(TransitionSlideInR::create(0.25f, SettingsScene));
}
void Mainpage::menuStoreCallback(cocos2d::Ref* pSender) {
    cocos2d::log("store"); // test
	switchScene();
	// 创建新场景
	auto StoreScene = Store::createScene();
	// 特效切换场景
	Director::getInstance()->replaceScene(TransitionSlideInR::create(0.25f, StoreScene));
}
void Mainpage::menuInventoryCallback(cocos2d::Ref* pSender) {
    cocos2d::log("inventory"); // test
	switchScene();
	// 创建新场景
	auto InventoryScene = Inventory::createScene();
	// 特效切换场景
	Director::getInstance()->replaceScene(TransitionSlideInR::create(0.25f, InventoryScene));
}
Example #5
0
void ofApp::onMessage(ofxLibwebsockets::Event & e){
    cout << "message: " << e.message <<endl;
    vector<string> msg = ofSplitString( e.message , " ");
    if (msg[0] == "/time"){
        remoteTime = ofToInt(msg[1]);
        if( abs( localTime-remoteTime ) > 10 ){
            resync(remoteTime);
        }
    } else if (msg[0] == "/trigger"){
        twinkle->triggerPulse(ofToInt(msg[1]));
    } else if (msg[0] =="/welcome"){
        socket.send("/imHost");
        switchScene(ofToInt(msg[1]));

    } else if (msg[0] == "/sceneChange" ){
        switchScene(ofToInt(msg[1]));
        
    } else if(msg[0] == "/home"){
        noPlace->addHome(msg[1]);
    }
    
}
Example #6
0
/**
 * Shutdown game
 */
void CGEEngine::startCountDown() {
	debugC(1, kCGEDebugEngine, "CGEEngine::startCountDown()");

	switchScene(-1);
}
Example #7
0
void MainMenuScene::jumpToNextScene()
{
    switchScene(SceneBuilder::buildScene(ST_GAME_SCENE));
}