Ver Fonte

完善各个界面

FantasyUFG há 5 anos atrás
pai
commit
b4776578af

Diff do ficheiro suprimidas por serem muito extensas
+ 267 - 152
assets/scene/Game.fire


+ 6 - 6
assets/script/Game/Ai/AiCharactor.js

@@ -29,36 +29,36 @@ cc.Class({
             //右拳
             this.armatureDisplay.node.scaleX = 1;
             this.armature.animation.play("attack", 1);
-            this.node.emit("attack");
+            this.node.emit("attack1");
         } else if (bLeft == 1) {
             //左拳
             this.armatureDisplay.node.scaleX = -1;
             this.armature.animation.play("attack", 1);
-            this.node.emit("attack");
+            this.node.emit("attack2");
         }
         //暴击右
         else if (bLeft == 2) {
             this.armatureDisplay.node.scaleX = -1;
             this.armature.animation.play("critical_strike", 1);
-            this.node.emit("attack_critical_strike");
+            this.node.emit("attack_critical_strike1");
         }
         //暴击左
         else if (bLeft == 3) {
             this.armatureDisplay.node.scaleX = 1;
             this.armature.animation.play("critical_strike", 1);
-            this.node.emit("attack_critical_strike");
+            this.node.emit("attack_critical_strike2");
         }
         //连击
         else if (bLeft == 4) {
             this.armatureDisplay.node.scaleX = -1;
             this.armature.animation.play("double-hit", 1);
-            this.node.emit("attack_double-hit");
+            this.node.emit("attack_double-hit1");
         }
         //连击
         else if (bLeft == 5) {
             this.armatureDisplay.node.scaleX = 1;
             this.armature.animation.play("double-hit", 1);
-            this.node.emit("attack_double-hit");
+            this.node.emit("attack_double-hit2");
         }
     },
     dodge(bLeft) { //躲闪

+ 10 - 4
assets/script/Game/Ai/AiPlayerController.js

@@ -29,14 +29,17 @@ cc.Class({
     start() {
         this.init();
         // this.scheduleOnce(function() {
-
+        this._rate = this.stateScp._combo_rate + this.stateScp._crit_rate;
         this.schedule(function() {
-            this.onAttck_Ai();
+            if (this.GameMode._gamestart) { this.onAttck_Ai(); }
+
         }, 1);
 
         //}, 5.5);
     },
     init() {
+        this.GameMode = cc.find("GameMode").getComponent("GameMode");
+
         //角色脚本
         this.ctorScp = this.charactor.getComponent('AiCharactor');
         this.PlayerControScp = this.PlayerController.getComponent('PlayerController');
@@ -44,6 +47,8 @@ cc.Class({
         this.playerctorScp = this.PlayerctorScp.getComponent('Charactor');
 
         this.stateScp = this.states.getComponent('AiPlayerStates');
+
+
     },
     update(dt) {
 
@@ -115,7 +120,8 @@ cc.Class({
 
             this._LeftJayShow = true;
             this._RightJayShow = false;
-            if (randomnum_1 >= 1 && randomnum_1 <= 10) {
+            if (randomnum_1 >= 1 && randomnum_1 <= this._rate) {
+
                 //出现暴击或者连击
                 if (randomnum_2 == 1) {
                     //暴击
@@ -152,7 +158,7 @@ cc.Class({
             direction = -1;
             this._RightJayShow = true;
             this._LeftJayShow = false;
-            if (randomnum_1 >= 1 && randomnum_1 <= 10) {
+            if (randomnum_1 >= 1 && randomnum_1 <= this._rate) {
                 //出现暴击或者连击
                 if (randomnum_2 == 1) {
                     //暴击

+ 35 - 11
assets/script/Game/Ai/AiPlayerStates.js

@@ -39,19 +39,36 @@ cc.Class({
     },
 
     start() {
-        this.Charactor.on("attack", () => {
-            //console.log("检测到攻击2");
-
+        this.Charactor.on("attack1", () => {
+            //console.log("检测到攻击2");
+            this.UiController.Ui_Shake(2);
             cc.audioEngine.playEffect(this.UiController.audioArr[3]);
         });
-        this.Charactor.on("attack_critical_strike", () => {
-            //console.log("检测到暴击2");
-
+        this.Charactor.on("attack2", () => {
+            //console.log("检测到攻击2 左");
+            this.UiController.Ui_Shake(1);
+            cc.audioEngine.playEffect(this.UiController.audioArr[3]);
+        });
+        this.Charactor.on("attack_critical_strike1", () => {
+            //console.log("检测到暴击2右");
+            this.UiController.Ui_Shake(2);
             cc.audioEngine.playEffect(this.UiController.audioArr[3]);
         });
-        this.Charactor.on("attack_double-hit", () => {
-            //console.log("检测到连击2");
+        this.Charactor.on("attack_critical_strike2", () => {
+            //console.log("检测到暴击2左");
+            this.UiController.Ui_Shake(1);
+            cc.audioEngine.playEffect(this.UiController.audioArr[3]);
+        });
+        this.Charactor.on("attack_double-hit1", () => {
+            //console.log("检测到连击2右");
+            this.UiController.Ui_Shake(2);
+            cc.audioEngine.playEffect(this.UiController.audioArr[3]);
+            cc.audioEngine.playEffect(this.UiController.audioArr[3]);
 
+        });
+        this.Charactor.on("attack_double-hit2", () => {
+            //console.log("检测到连击2左");
+            this.UiController.Ui_Shake(1);
             cc.audioEngine.playEffect(this.UiController.audioArr[3]);
             cc.audioEngine.playEffect(this.UiController.audioArr[3]);
 
@@ -72,21 +89,22 @@ cc.Class({
         });
         this.Charactor.on("hurt_ord", () => {
             // console.log("检测到受普攻");
-
+            this.UiController.Shake(this.Charactor, 1);
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
             this._hp = this.minusblood(this._hp);
             this.progressBar_hp.getComponent(cc.Sprite).fillRange = this._hp / this._maxhp;
         });
         this.Charactor.on("hurt_critical", () => {
             //console.log("检测到受暴击");
-
+            this.UiController.Shake(this.Charactor, 1);
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
             this._hp = this.minusblood_critical(this._hp);
             //console.log("暴击后的血量:", this._hp);
             this.progressBar_hp.getComponent(cc.Sprite).fillRange = this._hp / this._maxhp;
         });
         this.Charactor.on("hurt_double", () => {
-
+            this.UiController.Shake(this.Charactor, 1);
+            this.UiController.Shake(this.Charactor, 1);
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
 
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
@@ -110,6 +128,12 @@ cc.Class({
                 self.PanelResult.addChild(cc.instantiate(ResultArr));
             });
         }
+        if (this._hp <= this._damage) {
+            this.UiController.Ui_Shake(4); //气血不足
+        }
+        if (this._endurance <= this._block_minus_endurance) {
+            this.UiController.Ui_Shake(5); //能量不足不足
+        }
     },
     init() {
         this.gamestate = cc.find("Canvas/Game/Interface_Game").getComponent('Interface_game');

+ 3 - 0
assets/script/Game/Base/BaseGameMode.js

@@ -5,6 +5,9 @@ cc.Class({
         gameStates: cc.Node,
     },
     start() {
+        this.initgame = false; //进入游戏
+        this.gamestart = false; //游戏开始
+
         this.gStatSt = this.gameStates.getComponent('GameStates');
     },
     startGame() {

+ 2 - 0
assets/script/Game/Base/BaseGameStates.js

@@ -12,6 +12,8 @@ cc.Class({
         this.player_energy = 10001;
         this.player_sex = 0;
         this.game_time = 720; //战斗时间
+
+        this.currPass = 0;
     },
     start() {
 

+ 3 - 2
assets/script/Game/Base/BasePlayerStates.js

@@ -11,8 +11,8 @@ cc.Class({
         this.maxendurance = 100; //蓝量
         this.damage = 11; //攻击力
         this.defense = 3; //防御
-        this.combo_rate = 5; //连击率
-        this.crit_rate = 5; //暴击率
+        this.combo_rate = 30; //连击率
+        this.crit_rate = 30; //暴击率
         this.dodge_endurance = 10; //闪避回蓝
         this.defense_hp = 11; //格挡回血
         this.recover_hp = 1; //被动回血1/s
@@ -101,6 +101,7 @@ cc.Class({
         }
         //}
     },
+
     //#endregion
     // //结果
     // Result_Show(playerHp, AiHp) {

+ 5 - 1
assets/script/Game/GameMode.js

@@ -4,11 +4,15 @@ cc.Class({
     properties: {
 
     },
-    // onLoad () {},
+    onLoad() {
+        this._gamestart = this.gamestart;
+        this._initgame = this.initgame;
+    },
 
     start() {
 
     },
 
     // update (dt) {},
+
 });

+ 4 - 0
assets/script/Game/GameStates.js

@@ -19,6 +19,10 @@ cc.Class({
         this._player_gold = this.player_gold;
         this._player_energy = this.player_energy;
         this._player_sex = this.player_sex;
+
+        this._currPass = this.currPass; //当前关卡
+
+
         //#region 
         // this.InformationChanges("set", "name", "小明");
         //let name = this.InformationChanges("get", "name");

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

@@ -34,6 +34,7 @@ cc.Class({
     },
     start() {
         this.init();
+        this._rate = this.stateScp._combo_rate + this.stateScp._crit_rate;
     },
     init() {
         //角色脚本
@@ -45,9 +46,9 @@ cc.Class({
     Gesture(name) {
         var randomnum_1 = parseInt(Math.round(Math.random() * 98 + 1)); //(0-100]
         var randomnum_2 = parseInt(Math.round(Math.random() + 1)); //[1-2]
-        //console.log(randomnum_1, randomnum_2);
+        console.log(randomnum_1, randomnum_2);
         if (name == 'right_top') {
-            if (randomnum_1 >= 1 && randomnum_1 <= 10) {
+            if (randomnum_1 >= 1 && randomnum_1 <= this._rate) {
                 //出现暴击或者连击
                 if (randomnum_2 == 1) {
                     //暴击
@@ -69,7 +70,7 @@ cc.Class({
 
 
         } else if (name == 'left_top') {
-            if (randomnum_1 >= 1 && randomnum_1 <= 10) {
+            if (randomnum_1 >= 1 && randomnum_1 <= this._rate) {
                 //出现暴击或者连击
                 if (randomnum_2 == 1) {
                     //暴击
@@ -113,6 +114,7 @@ cc.Class({
         } else if (name == 'left_down') {
             this.AiControScp._Statepassivity = false;
             if (this.AiControScp._LeftJayShow) {
+
                 //被左拳打中
                 if (this.AiControScp._CriticalStrike) {
                     //被左拳打中 暴击

+ 10 - 0
assets/script/Game/Player/PlayerStates.js

@@ -68,17 +68,20 @@ cc.Class({
             this.progressBar_endur.getComponent(cc.Sprite).fillRange = this._endurance / this._maxendurance;
         });
         this.Charactor.on("hurt_ord", () => {
+            this.UiController.Ui_Shake(3);
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
             this._hp = this.minusblood(this._hp);
             this.progressBar_hp.getComponent(cc.Sprite).fillRange = this._hp / this._maxhp;
         });
         this.Charactor.on("hurt_critical", () => {
+            this.UiController.Ui_Shake(3);
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
             this._hp = this.minusblood_critical(this._hp);
             //console.log("暴击后的血量:", this._hp);
             this.progressBar_hp.getComponent(cc.Sprite).fillRange = this._hp / this._maxhp;
         });
         this.Charactor.on("hurt_double", () => {
+            this.UiController.Ui_Shake(3);
             cc.audioEngine.playEffect(this.UiController.audioArr[4]);
             this._hp = this.minusblood(this._hp);
 
@@ -108,6 +111,7 @@ cc.Class({
         this.aiplayerStateScp = this.AiPlayerState.getComponent('AiPlayerStates');
         this.UiController = cc.find("Canvas/UiController").getComponent('UiController');
 
+
     },
     update(dt) {
 
@@ -120,5 +124,11 @@ cc.Class({
             });
             // this.interface_game.active = false;
         }
+        if (this._hp <= this._damage) {
+            this.UiController.Ui_Shake(4); //气血不足
+        }
+        if (this._endurance <= this._block_minus_endurance) {
+            this.UiController.Ui_Shake(5); //能量不足不足
+        }
     },
 });

+ 9 - 2
assets/script/Game/Touch.js

@@ -6,9 +6,8 @@ cc.Class({
         touchEndPoint: cc.Vec2,
     },
     onLoad() {
+        this.GameMode = cc.find("GameMode").getComponent("GameMode");
 
-        this.node.on(cc.Node.EventType.TOUCH_START, this.ontouch_start, this);
-        this.node.on(cc.Node.EventType.TOUCH_END, this.ontouch_End, this);
 
         this.nodeArr = [];
     },
@@ -22,6 +21,14 @@ cc.Class({
         this.touchEndPoint = event.getLocation();
         this.calcDir();
     },
+    update(dt) {
+        this.scheduleOnce(function() {
+            if (this.GameMode._gamestart) {
+                this.node.on(cc.Node.EventType.TOUCH_START, this.ontouch_start, this);
+                this.node.on(cc.Node.EventType.TOUCH_END, this.ontouch_End, this);
+            }
+        }, 4);
+    },
     calcDir: function() {
         let dirvecX = this.touchEndPoint.x - this.touchStartPoint.x;
         let dirvecY = this.touchEndPoint.y - this.touchStartPoint.y;

+ 27 - 5
assets/script/Loading/Loading.js

@@ -25,12 +25,34 @@ cc.Class({
         //let bundle = cc.assetManager.getBundle('01_graphics');
         this.ProgressBar.node.parent.active = true;
         //开始加载远程资源
-        cc.loader.loadResDir('', cc.Asset, (completeCount, totalCount) => {
-            this.ProgressBar.fillRange = completeCount / totalCount;
-        }, () => {
+        for (let i = 0; i < 100; i++) {
+
+            this.schedule(function() {
+                //对Sprite组件上的属性修改
+                this.ProgressBar.fillRange += 0.01;
+                cc.resources.loadDir("assets", (completeCount, totalCount) => {
+
+                }, () => {
+                    cc.director.loadScene('Game');
+                });
+
+            }, (4 / 100) * i);
+        }
+        // cc.resources.loadDir("assets", (completeCount, totalCount) => {
+        //     this.ProgressBar.fillRange = completeCount / totalCount;
+
+        // }, () => {
+
+        //     cc.director.loadScene('Game');
+        // });
+        // cc.loader.loadResDir('assets', cc.Asset, (completeCount, totalCount) => {
+        //     this.ProgressBar.fillRange = completeCount / totalCount;
+        // }, () => {
+
+        //     cc.director.loadScene('Game');
+        // });
+
 
-            cc.director.loadScene('Game');
-        });
     }
     // update (dt) {},
 });

+ 3 - 1
settings/project.json

@@ -1 +1,3 @@
-{}
+{
+  "last-module-event-record-time": 1615348349908
+}

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff