Browse Source

TTTTTTTTTTTTTTTTT

woso_javan 2 months ago
parent
commit
21e20659e0

+ 12 - 1
assets/module_basic/config/map_config.json

@@ -1 +1,12 @@
-{"1":{"text":"地图1","time":90,"name":"map_1","item":[1,2],"number":2}}
+{
+    "1": {
+        "text": "地图1",
+        "time": 3,
+        "name": "map_1",
+        "item": [
+            1,
+            2
+        ],
+        "number": 3
+    }
+}

+ 5 - 1
assets/module_storm_sunder/Prefabs/UI/Gambit/UI_BattleGambit_Impl.ts

@@ -6,6 +6,7 @@ import { tgxModuleContext } from 'db://assets/core_tgx/tgx';
 import { Layout_BattleGambit } from './Layout_BattleGambit';
 import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
 import { GameEvent } from '../../../Script/Enum/GameEvent';
+import { TimerMgr } from '../../../Script/Manager/TimerMgr';
 const { ccclass, property } = _decorator;
 
 @ccclass('UI_BattleGambit_Impl')
@@ -23,12 +24,15 @@ export class UI_BattleGambit_Impl extends UI_BattleRevive {
         let layout = this.layout as Layout_BattleGambit;
         this.onButtonEvent(layout.btn_get, () => {
             this.changeGameStatus(GameStatus.Playing);
-            EventDispatcher.instance.emit(GameEvent.EVENT_GAME_START_EFFECT);
+            // EventDispatcher.instance.emit(GameEvent.EVENT_GAME_START_EFFECT);
+            TimerMgr.inst.startCountdown();
         });
         this.onButtonEvent(layout.btn_back, () => {
             GameMgr.inst.isWin = false;
             GameMgr.inst.setGameStatus(GameStatus.Playing);
+            TimerMgr.inst.startCountdown();
             EventDispatcher.instance.emit(GameEvent.EVENT_GAME_START);
+            console.log('开局点击No++++++++++')
             this.hide();
         });
     }

+ 7 - 4
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -5,8 +5,6 @@ import { GameUtil } from '../GameUtil';
 import { PropMgr } from '../Manager/PropMgr';
 import { GameMgr, GameStatus } from '../Manager/GameMgr';
 import { PlayerMgr } from '../Manager/PlayerMgr';
-import { tgxUIMgr } from 'db://assets/core_tgx/tgx';
-import { UI_BattleRevive } from 'db://assets/scripts/UIDef';
 import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
 import { GameEvent } from '../Enum/GameEvent';
 
@@ -40,8 +38,6 @@ export class TornadoAIComponent extends TornadoComponent {
 
         this.initAIPlayer();
         this.onPlayerInfoHandler();
-        // this.decideAction(); // 进入行为循环
-
         this.tigger.on('onTriggerEnter', this.onTriggerEnter, this);
         this.radiusTigger.on('onTriggerEnter', this.onRadiusTriggerEnter, this);
         this.registerEvent();
@@ -49,6 +45,7 @@ export class TornadoAIComponent extends TornadoComponent {
 
     protected registerEvent(): void {
         EventDispatcher.instance.on(GameEvent.EVENT_GAME_START, this.decideAction, this);
+        EventDispatcher.instance.on(GameEvent.EVENT_GAME_START_EFFECT, this.decideAction, this);
     }
 
     private initAIPlayer() {
@@ -262,4 +259,10 @@ export class TornadoAIComponent extends TornadoComponent {
         Tween.stopAllByTarget(this.node);
     }
 
+    protected onDestroy(): void {
+        this.cancelAction();
+        EventDispatcher.instance.off(GameEvent.EVENT_GAME_START, this.decideAction, this);
+        EventDispatcher.instance.off(GameEvent.EVENT_GAME_START_EFFECT, this.decideAction, this);
+    }
+
 }

+ 1 - 0
assets/module_storm_sunder/Script/Component/TornadoComponent.ts

@@ -343,6 +343,7 @@ export class TornadoComponent extends Component {
 
     protected unregisterEvent() {
         EventDispatcher.instance.off(GameEvent.EVENT_STORM_LEVEL_UP, this.stormLevelUp, this);
+        EventDispatcher.instance.off(GameEvent.EVENT_GAME_START_EFFECT, this.onGambitEffect, this);
     }
 
 }

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

@@ -46,11 +46,11 @@ export class GameMgr {
             case GameStatus.None:
                 homeUI.active = true;
                 battleUI.active = false;
-                TimerMgr.inst.reset();
+                MapMgr.Instance.setMapInfo(1);
                 PropMgr.inst.reset();
                 Effect2DUIMgr.inst.reset();
                 PlayerMgr.inst.reset();
-                MapMgr.Instance.setMapInfo(1);
+                TimerMgr.inst.reset();
                 break;
             case GameStatus.Gambit:
                 await MapMgr.Instance.addMapNode();
@@ -65,11 +65,6 @@ export class GameMgr {
                 }
                 break;
             case GameStatus.Playing:
-                // await MapMgr.Instance.addMapNode();
-                // await PlayerMgr.inst.setPlayerVisible(true);
-                // await PlayerMgr.inst.setPlayerPosition();
-                // homeUI.active = false;
-                // battleUI.active = true;
                 break;
             case GameStatus.Revive:
                 const revive = tgxUIMgr.inst.isShowing(UI_BattleRevive);
@@ -93,8 +88,6 @@ export class GameMgr {
         await PlayerMgr.inst.playerAddComponent();
         await PlayerMgr.inst.genareatorAIPlayer();
         GameMgr.inst.setGameStatus(GameStatus.Gambit);
-
-        // TimerMgr.inst.startCountdown();
     }
 }
 

+ 4 - 1
assets/module_storm_sunder/Script/Manager/PlayerMgr.ts

@@ -5,6 +5,7 @@ import { TornadoComponent } from "../Component/TornadoComponent";
 import { TornadoAIComponent } from "../Component/TornadoAIComponent";
 import { AttributeBonusMgr } from "./AttributeBonusMgr";
 import { Tableai_config } from "db://assets/module_basic/table/Tableai_config";
+import { MapMgr } from "./MapMgr";
 
 const res = [
     "Prefabs/Storm",
@@ -26,7 +27,7 @@ export class PlayerMgr {
 
     public tornadoNode: Node = null;//玩家节点
     public aiPlayersConfig: Map<number, any> = new Map();//AI玩家配置
-    public createAIPlayerCount: number = 3;//创建AI玩家数量
+    public createAIPlayerCount: number = 1;//创建AI玩家数量
     public aiConfigCount: number = 3;//AI配置数量
 
     private aiIndex: number = 0;//AI索引
@@ -35,6 +36,8 @@ export class PlayerMgr {
     //创建AI玩家
     public async genareatorAIPlayer(): Promise<void> {
         return new Promise(async (resolve, reject) => {
+            const mapConfig = MapMgr.Instance.getMapConfig(1);
+            this.createAIPlayerCount = mapConfig.count;
             const aiPoints = StormSunderGlobalInstance.instance.aiPoints;
             for (let i = 0; i < this.createAIPlayerCount; i++) {
                 const infoPrefab = await resLoader.loadAsync(resLoader.gameBundleName, res[0], Prefab);

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

@@ -4,6 +4,8 @@ import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
 import { PropMgr } from "./PropMgr"; // 假设PropMgr在同一个目录下
 import { GameMgr, GameStatus } from "./GameMgr";
 import { GameUtil } from "../GameUtil";
+import { AttributeBonusMgr } from "./AttributeBonusMgr";
+import { MapMgr } from "./MapMgr";
 
 /** 时间管理器*/
 export class TimerMgr {
@@ -73,6 +75,7 @@ export class TimerMgr {
         this.stopCountdown();
         Scheduler.enableForTarget(this);
 
-        this.countDownTime = 30;
+        const mapConfig = MapMgr.Instance.getMapConfig(1);
+        this.countDownTime = mapConfig.time;
     }
 }