Browse Source

装备生成

FantasyUFG 5 years ago
parent
commit
618af91905

File diff suppressed because it is too large
+ 247 - 128
assets/scene/Game.fire


+ 3 - 1
assets/script/Game/Base/BaseGameStates.js

@@ -17,7 +17,9 @@ cc.Class({
 
     },
 
-    // update (dt) {},
+    update(dt) {
+
+    },
     InformationChanges(state, indel, info) {
         if (state == "set") {
             if (indel == 0) {

+ 12 - 1
assets/script/Game/Base/BasePlayerStates.js

@@ -100,6 +100,17 @@ cc.Class({
             return oneself_endurance;
         }
         //}
-    }
+    },
     //#endregion
+    //结果
+    Result_Show(playerHp, AiHp) {
+        if (playerHp <= 0) {
+            console.log("ai胜利");
+            return false;
+        }
+        if (AiHp <= 0) {
+            console.log("玩家胜利");
+            return true;
+        }
+    }
 });

+ 11 - 2
assets/script/Game/GameStates.js

@@ -5,10 +5,13 @@ cc.Class({
         Player_infoArr: {
             default: [],
             type: cc.Label,
-        }
+        },
+
+
 
     },
     onLoad() {
+
         this._super();
         this._restTime = this.restTime;
         this._currentTime = this.currentTime;
@@ -43,6 +46,12 @@ cc.Class({
         //console.log("金币", this.player_gold);
 
     },
-    // update (dt) {},
+    update(dt) {
 
+    },
+    init() {
+        //角色脚本
+
+
+    },
 });

+ 3 - 1
assets/script/Game/Player/PlayerController.js

@@ -133,5 +133,7 @@ cc.Class({
         }
     },
 
-    // update (dt) {},
+    update(dt) {
+
+    },
 });

+ 33 - 2
assets/script/Game/Player/PlayerStates.js

@@ -7,8 +7,27 @@ cc.Class({
 
         progressBar_hp: cc.Node,
         progressBar_endur: cc.Node,
+
+        //PlayerState: cc.Node,
+        AiPlayerState: cc.Node,
+
+        PanelResult: cc.Node,
+
+        ResultArr: {
+            default: [],
+            type: cc.Prefab,
+        },
+        interface_game: cc.Node,
     },
     onLoad() {
+        // cc.loader.loadResDir("prefab/Result", cc.Prefab, (err, ResultArr) => {
+        //     // ...
+        //     console.log("belt预设:", );
+        //     for (let i = 0; i < ResultArr.length; i++) {
+        //         this.ResultArr[i] = ResultArr[i];
+        //     }
+
+        // });
         this._super();
         this._hp = this.hp;
         this._maxhp = this.maxhp; //血量
@@ -76,12 +95,24 @@ cc.Class({
         }, 1);
     },
     start() {
-
+        this.init();
     },
     init() {
         //角色脚本
         this.controScp = this.playerController.getComponent('PlayerController');
         this.charactortroScp = this.Charactor.getComponent('Charactor');
+
+        //this.playerStateScp = this.PlayerState.getComponent('PlayerStates');
+        this.aiplayerStateScp = this.AiPlayerState.getComponent('AiPlayerStates');
+    },
+    update(dt) {
+        let result = this.Result_Show(this._hp, this.aiplayerStateScp._hp);
+        if (result) {
+            this.PanelResult.addChild(cc.instantiate(this.ResultArr[1]));
+            this.interface_game.active = false;
+            this.scheduleOnce(function() {
+
+            }, 2);
+        }
     },
-    update(dt) {},
 });

Some files were not shown because too many files changed in this diff