yichael před 3 roky
rodič
revize
d924a5d85f

+ 7 - 17
assets/Scripts/Game/GameMode.js

@@ -50,23 +50,9 @@ cc.Class({
     {
     {
         this.TimeLabelScp.InitTime(this.GameStatesScp.totalTime);
         this.TimeLabelScp.InitTime(this.GameStatesScp.totalTime);
     },
     },
-    //页面退出回调
-    onQuit(data)
-    {
-        console.log('onQuit=',data);
-    },
-    //弹出框回调
-    onQuitModal(res)
-    {
-        if (res.data.confirm) {
-            console.log("退出");
-        }else if(res.data.cancel){
-            console.log("取消退出");
-        }
-    },
     StarGame(target,param)
     StarGame(target,param)
     {
     {
-        if(this.GameStatesScp.progress != this.GameStatesScp.progressTag.ready) return; //1 ready to start
+        if(this.GameStatesScp.progress != this.GameStatesScp.progressTag.default) return;
 
 
         this.GameStatesScp.progress = this.GameStatesScp.progressTag.ready; //1 ready to start
         this.GameStatesScp.progress = this.GameStatesScp.progressTag.ready; //1 ready to start
 
 
@@ -84,11 +70,15 @@ cc.Class({
 
 
             this.TimeLabelScp.CountDown(function(){
             this.TimeLabelScp.CountDown(function(){
 
 
-                this.GameStatesScp.progress = this.GameStatesScp.progressTag.ready;
+                this.GameStatesScp.progress = this.GameStatesScp.progressTag.result;
                 this.GameStatesScp.PunchTimes = 0;
                 this.GameStatesScp.PunchTimes = 0;
                 this.StartButtonNode.active = true;
                 this.StartButtonNode.active = true;
                 this.TenSecondChallengeBG.active = true;
                 this.TenSecondChallengeBG.active = true;
-                
+
+                this.scheduleOnce(function(){
+                    this.GameStatesScp.progress = this.GameStatesScp.progressTag.default;
+                }.bind(this),1);
+
             }.bind(this));
             }.bind(this));
         }.bind(this));
         }.bind(this));
         this.StartButtonNode.active = false;
         this.StartButtonNode.active = false;

+ 3 - 3
assets/Scripts/Game/GameStates.js

@@ -5,12 +5,12 @@ cc.Class({
       
       
     },
     },
     onLoad () {
     onLoad () {
-        this.progress = 0;
+        this.progress = -1;
         this.progressTag = {
         this.progressTag = {
-            defalt: -1,
+            default: -1,
             ready: 0,
             ready: 0,
             start: 1,
             start: 1,
-            finish: 2,
+            result: 2,
         };
         };
   
   
         this.startPosition = {'x':0,'y':0};
         this.startPosition = {'x':0,'y':0};

+ 17 - 2
assets/Scripts/Game/PlayerController.js

@@ -71,13 +71,28 @@ cc.Class({
              self.node.on('onBoxingPostHit',self.onBoxingPostHit,self);
              self.node.on('onBoxingPostHit',self.onBoxingPostHit,self);
          });
          });
     },
     },
+    //页面退出回调
+    onQuit(data)
+    {
+        console.log('onQuit=',data);
+    },
+    //弹出框回调
+    onQuitModal(res)
+    {
+        if (res.data.confirm) {
+            console.log("退出");
+        }else if(res.data.cancel){
+            console.log("取消退出");
+        }
+    },
     onBoxingPostHit(data)
     onBoxingPostHit(data)
     {
     {
-        if(this.GameStatesScp.progress != this.GameStatesScp.progressTag.start)//2 start game
+        if(this.GameStatesScp.progress == this.GameStatesScp.progressTag.default)
         {
         {
             this.GameModeScp.StarGame();
             this.GameModeScp.StarGame();
         }
         }
-        else
+
+        if(this.GameStatesScp.progress == this.GameStatesScp.progressTag.start)
         {
         {
             this.Run(1);
             this.Run(1);
         }
         }