Browse Source

结算调整

woso_javan 2 tháng trước cách đây
mục cha
commit
6e4b01ed34

+ 44 - 1
assets/module_basic/config/music_config.json

@@ -1 +1,44 @@
-{"1":{"name":"bgm","type":1,"cd":0,"content":"背景音乐,只在游戏中播放"},"2":{"name":"dianji","type":2,"cd":0,"content":"UI按钮点击音效"},"3":{"name":"shengji","type":2,"cd":0,"content":"升级音效"},"4":{"name":"pohuai","type":2,"cd":0,"content":"摧毁物品音效"},"5":{"name":"xishou","type":2,"cd":0,"content":"吸收龙卷风音效"},"6":{"name":"shengli","type":2,"cd":0,"content":"胜利音效"},"7":{"name":"shibai","type":2,"cd":0,"content":"失败音效"}}
+{
+    "1": {
+        "name": "bgm",
+        "type": 1,
+        "cd": 0,
+        "content": "背景音乐,只在游戏中播放"
+    },
+    "2": {
+        "name": "dianji",
+        "type": 2,
+        "cd": 0,
+        "content": "UI按钮点击音效"
+    },
+    "3": {
+        "name": "shengji",
+        "type": 2,
+        "cd": 0,
+        "content": "升级音效"
+    },
+    "4": {
+        "name": "pohuai",
+        "type": 2,
+        "cd": 0,
+        "content": "摧毁物品音效"
+    },
+    "5": {
+        "name": "xishou",
+        "type": 2,
+        "cd": 0,
+        "content": "吸收龙卷风音效"
+    },
+    "6": {
+        "name": "shengli",
+        "type": 2,
+        "cd": 0,
+        "content": "胜利音效"
+    },
+    "7": {
+        "name": "shibai",
+        "type": 2,
+        "cd": 0,
+        "content": "失败音效"
+    }
+}

+ 2 - 2
assets/module_storm_sunder/Prefabs/UI/Result/UI_BattleResult.prefab

@@ -364,7 +364,7 @@
         "__id__": 105
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 119
@@ -2907,7 +2907,7 @@
         "__id__": 155
       }
     ],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 169

+ 5 - 4
assets/module_storm_sunder/Prefabs/UI/Result/UI_BattleResult_Impl.ts

@@ -1,5 +1,4 @@
 import { isValid, Label, tween, v3, Vec3, Node, Tween } from "cc";
-import { EventDispatcher } from "../../../../core_tgx/easy_ui_framework/EventDispatcher";
 import { tgxModuleContext } from "../../../../core_tgx/tgx";
 import { GameUILayers } from "../../../../scripts/GameUILayers";
 import { UI_BattleResult } from "../../../../scripts/UIDef";
@@ -7,7 +6,7 @@ import { Layout_BattleResult } from "./Layout_BattleResult";
 import { GtagMgr, GtagType } from "db://assets/core_tgx/base/GtagMgr";
 import { GameEvent } from "../../../Script/Enum/GameEvent";
 import { StormSunderAudioMgr } from "../../../Script/Manager/StormSunderAudioMgr";
-import { GameMgr } from "../../../Script/Manager/GameMgr";
+import { GameMgr, GameStatus } from "../../../Script/Manager/GameMgr";
 
 export class UI_BattleResult_Impl extends UI_BattleResult {
     timeoutIds: Array<number> = [];
@@ -23,7 +22,7 @@ export class UI_BattleResult_Impl extends UI_BattleResult {
 
     protected onCreated(): void {
         this.win = GameMgr.inst.isWin;
-        const soundId = this.win ? 7 : 8;
+        const soundId = this.win ? 6 : 7;
         StormSunderAudioMgr.playOneShot(StormSunderAudioMgr.getMusicIdName(soundId), 1.0);
 
         let layout = this.layout as Layout_BattleResult;
@@ -59,8 +58,10 @@ export class UI_BattleResult_Impl extends UI_BattleResult {
     }
 
     private emitEvent(): void {
+        this.node.active = false;
         if (this.win) {
-            EventDispatcher.instance.emit(GameEvent.EVENT_BATTLE_SUCCESS_LEVEL_UP);
+        } else {
+            GameMgr.inst.setGameStatus(GameStatus.Playing);
         }
     }
 

+ 2 - 0
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -48,6 +48,7 @@ export class TornadoAIComponent extends TornadoComponent {
         //text:名称 range:检测半径 move_juge:移动概率 move_time:移动时间 escape_time:逃跑时间 pursuit_1:追击玩家概率 pursuit_2:追击AI概率 pursuit_time:追击时间
         const { text, range, move_judge, move_time, escape_time, pursuit_1, pursuit_2, pursuit_time } = aiConfig.data;
         this.playerInfo.nickName = text;
+        this.currentLv = 3;
         this.playerInfo.level = this.currentLv;
 
         this.moveDuration = Math.floor(move_time[0] + Math.random() * (move_time[1] - move_time[0] + 1));
@@ -133,6 +134,7 @@ export class TornadoAIComponent extends TornadoComponent {
 
             const isPlayer = targetTornado instanceof TornadoComponent;
             if (this.currentLv > targetTornado.currentLv && isPlayer) {
+                GameMgr.inst.isWin = false;
                 GameMgr.inst.setGameStatus(GameStatus.End);
             }
         }

+ 3 - 5
assets/module_storm_sunder/Script/Component/TornadoComponent.ts

@@ -176,19 +176,17 @@ export class TornadoComponent extends Component {
             if (!targetTornado) return;
 
             if (this.currentLv > targetTornado.currentLv) {
-                console.log('撒日朗++++++++');
                 this.curHitObj = targetTornado.node;
                 this.addExpByKill();
                 this.killed(targetTornado.node);
-
-                targetTornado.node.removeFromParent();
-                targetTornado.node.destroy();
             }
         }
     }
 
     //被击杀
-    killed(targetNode: Node) {
+    async killed(targetNode: Node) {
+        targetNode.removeFromParent();
+        targetNode.destroy();
         Effect2DUIMgr.inst.removePlayerInfo(targetNode);
     }
 

+ 2 - 1
assets/module_storm_sunder/Script/Manager/GameMgr.ts

@@ -34,7 +34,7 @@ export class GameMgr {
     }
 
     //游戏状态更新UI
-    public updateGameStatusUI() {
+    public async updateGameStatusUI() {
         const homeUI = StormSunderGlobalInstance.instance.homeUI;
         const battleUI = StormSunderGlobalInstance.instance.battleUI;
 
@@ -44,6 +44,7 @@ export class GameMgr {
                 battleUI.active = false;
                 break;
             case GameStatus.Playing:
+                await PlayerMgr.inst.setPlayerVisible(true);
                 homeUI.active = false;
                 battleUI.active = true;
                 break;

+ 6 - 0
assets/module_storm_sunder/Script/Manager/PlayerMgr.ts

@@ -64,6 +64,12 @@ export class PlayerMgr {
         })
     }
 
+    //设置玩家隐藏显示
+    async setPlayerVisible(visible: boolean) {
+        const tornado = await this.getTornadoNode();
+        tornado.active = visible;
+    }
+
     async playerAddComponent(): Promise<void> {
         return new Promise((resolve, reject) => {
             this.getTornadoNode().then(node => {

+ 2 - 2
assets/module_storm_sunder/Script/Manager/PropMgr.ts

@@ -72,7 +72,7 @@ export class PropMgr {
         for (let index = 0; index < this.propInitNum; index++) {
             let spawnPos = this.getValidSpawnPosition();
             // 进行四向物理检测
-            if (!this.isPositionBlocked(spawnPos)) {
+            if (spawnPos && !this.isPositionBlocked(spawnPos)) {
                 const propPrefab = await resLoader.loadAsync(resLoader.gameBundleName, propRes[Math.floor(Math.random() * propRes.length)]);
                 let newMonster = instantiate(propPrefab) as any;
                 newMonster.setParent(propsUI);
@@ -134,7 +134,7 @@ export class PropMgr {
 
     /** 检测当前位置是否有障碍物 */
     isPositionBlocked(position: Vec3): boolean {
-        if (!position.x || !position.y || !position.z) return false;
+        if (!position) return false;
 
         let ray = new geometry.Ray(position.x, position.y, position.z, 0, 0, 0);
 

+ 1 - 0
assets/module_storm_sunder/Script/Manager/TimerMgr.ts

@@ -52,6 +52,7 @@ export class TimerMgr {
         if (this.timerId) {
             clearInterval(this.timerId);
             this.timerId = 0;
+            GameMgr.inst.isWin = true;
             GameMgr.inst.setGameStatus(GameStatus.End);
         }
     }