From 0346fccbc39c87c25067875dc673663e7a69c695 Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Tue, 15 Jul 2014 15:07:01 +0800 Subject: [PATCH] fixed bug runtime --- .../frameworks/runtime-src/Classes/runtime/Runtime.cpp | 5 +---- templates/lua-template-runtime/src/main.lua | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp index a053d9298e..53e246faa0 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp @@ -94,10 +94,7 @@ bool reloadScript(const string& modulefile) director->getTextureCache()->removeAllTextures(); } FileUtils::getInstance()->purgeCachedEntries(); - - director->getScheduler()->unscheduleAll(); - director->getScheduler()->scheduleUpdate(director->getActionManager(), Scheduler::PRIORITY_SYSTEM, false); - + return (LuaEngine::getInstance()->reload(strfile.c_str())==0); } diff --git a/templates/lua-template-runtime/src/main.lua b/templates/lua-template-runtime/src/main.lua index c17b3f79b1..6d88fc84d9 100644 --- a/templates/lua-template-runtime/src/main.lua +++ b/templates/lua-template-runtime/src/main.lua @@ -30,11 +30,11 @@ local function main() gameScene = scene.create() gameScene:playBgMusic() - if cc.Director:getInstance():getRunningScene() then + if cc.Director:getInstance():getRunningScene() then cc.Director:getInstance():replaceScene(gameScene) - else + else cc.Director:getInstance():runWithScene(gameScene) - end + end end