future 1 年之前
父節點
當前提交
aa4c69f9d7
共有 4 個文件被更改,包括 14 次插入8 次删除
  1. 6 1
      assets/script/edit/edit_scene.ts
  2. 4 3
      assets/script/run/gameManager.ts
  3. 2 2
      assets/script/run/game_run.ts
  4. 2 2
      assets/script/tools.ts

+ 6 - 1
assets/script/edit/edit_scene.ts

@@ -77,7 +77,12 @@ export class edit_scene extends Component {
             if(curScene.is_child_scene){
                 return tools.showToast("子场景不可以运行")
             }
-            tools.game_run()
+            // tools.game_run()
+            tools.show_loading(()=>{
+                tools.game_run(()=>{
+                    tools.hide_loading()
+                })
+            })
         })
         this.btn_run_all.on(Node.EventType.TOUCH_END,()=>{
             tools.game_run_all()

+ 4 - 3
assets/script/run/gameManager.ts

@@ -249,7 +249,7 @@ export class gameManager extends Component {
         gameManager.mp3_cache.clear()
     }
 
-    public init(gr:game_run,data:scene_item_data[]){
+    public init(gr:game_run,data:scene_item_data[],callback=null){
         this.mGameRun = gr;
         gameManager.Singleton  = this;
         this.mSceneManager.init(this)
@@ -261,7 +261,7 @@ export class gameManager extends Component {
         if( this.mGameData.length<=0){
            return tools.showToast("错误的场景信息")
         }
-        this.startLevelGame()
+        this.startLevelGame(callback)
     }
 
     public runGame(data:scene_item_data[]){
@@ -292,8 +292,9 @@ export class gameManager extends Component {
         ClientEvent.off(config.EventRun.WIDGET_FINISH,this.onWidgetFinishEvent.bind(this),this)
     }
 
-    public startLevelGame(){
+    public startLevelGame(callback=null){
         this.initEvent()
+        callback()
         console.log("this.mGameData",this.mGameData,this.mCurSceneIndex)
         this.mSceneManager.startLevelGame(this.mGameData[this.mCurSceneIndex])
         taskServce.initTask(this.mGameData[this.mCurSceneIndex]._task_data)

+ 2 - 2
assets/script/run/game_run.ts

@@ -45,8 +45,8 @@ export class game_run extends Component {
         this.node.removeFromParent()
     }
 
-    public run(){
-        this.mGameManger.init(this,control.Singleton.get_bag_data().content)
+    public run(callback=null){
+        this.mGameManger.init(this,control.Singleton.get_bag_data().content,callback)
     }
 
     public runAll(){

+ 2 - 2
assets/script/tools.ts

@@ -320,11 +320,11 @@ export class tools  {
     }
 
 
-    public static game_run(){
+    public static game_run(callback=null){
         resources.load("prefab/run/game_run",Prefab,(err, prefab)=>{
             let node:Node = instantiate(prefab);
             node.parent = main.g_canvas.node;
-            node.getComponent(game_run).run()
+            node.getComponent(game_run).run(callback)
         }) 
     }