woso_javan 2 月之前
父節點
當前提交
68d73938f4

+ 2 - 0
assets/module_storm_sunder/RoosterStormSunder.ts

@@ -9,6 +9,7 @@ import { UI_Setting } from '../scripts/UIDef';
 import { StormSunderAudioMgr } from './Script/Manager/StormSunderAudioMgr';
 import { StormSunderAudioMgr } from './Script/Manager/StormSunderAudioMgr';
 import { GameMgr, GameStatus } from './Script/Manager/GameMgr';
 import { GameMgr, GameStatus } from './Script/Manager/GameMgr';
 import { AttributeBonusMgr } from './Script/Manager/AttributeBonusMgr';
 import { AttributeBonusMgr } from './Script/Manager/AttributeBonusMgr';
+import { PlayerMgr } from './Script/Manager/PlayerMgr';
 const { ccclass, property } = _decorator;
 const { ccclass, property } = _decorator;
 
 
 @ccclass('RoosterStormSunder')
 @ccclass('RoosterStormSunder')
@@ -26,6 +27,7 @@ export class RoosterStormSunder extends Component {
     }
     }
 
 
     async initialize() {
     async initialize() {
+        PlayerMgr.inst.addAIPlayers();
         StormSunderGlobalInstance.instance.initUI();
         StormSunderGlobalInstance.instance.initUI();
     }
     }
 
 

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

@@ -5,6 +5,7 @@ import { PropStatus } from './PropComponent';
 import { GameUtil } from '../GameUtil';
 import { GameUtil } from '../GameUtil';
 import { PropMgr } from '../Manager/PropMgr';
 import { PropMgr } from '../Manager/PropMgr';
 import { GameMgr, GameStatus } from '../Manager/GameMgr';
 import { GameMgr, GameStatus } from '../Manager/GameMgr';
+import { PlayerMgr } from '../Manager/PlayerMgr';
 
 
 const { ccclass, property } = _decorator;
 const { ccclass, property } = _decorator;
 
 
@@ -41,7 +42,7 @@ export class TornadoAIComponent extends TornadoComponent {
     }
     }
 
 
     private initAIPlayer() {
     private initAIPlayer() {
-        this.playerInfo.nickName = '阿西吧 ai';
+        this.playerInfo.nickName = 'asfasf'
         this.playerInfo.level = 2;
         this.playerInfo.level = 2;
         this.currentLv = this.playerInfo.level;
         this.currentLv = this.playerInfo.level;
 
 
@@ -120,7 +121,7 @@ export class TornadoAIComponent extends TornadoComponent {
 
 
             const isPlayer = targetTornado instanceof TornadoComponent;
             const isPlayer = targetTornado instanceof TornadoComponent;
             if (this.currentLv > targetTornado.currentLv && isPlayer) {
             if (this.currentLv > targetTornado.currentLv && isPlayer) {
-                GameMgr.inst.setGameStatus(GameStatus.End);
+                // GameMgr.inst.setGameStatus(GameStatus.End);
             }
             }
         }
         }
     }
     }

+ 3 - 0
assets/module_storm_sunder/Script/Manager/AttributeBonusMgr.ts

@@ -2,6 +2,7 @@ import { Tableai_config } from "db://assets/module_basic/table/Tableai_config";
 import { DevelopConfigModel } from "../Model/DevelopConfigModel";
 import { DevelopConfigModel } from "../Model/DevelopConfigModel";
 import { UserModel } from "../Model/UserModel";
 import { UserModel } from "../Model/UserModel";
 import { MainConfigModel } from "../Model/MainConfigModel";
 import { MainConfigModel } from "../Model/MainConfigModel";
+import { AiConfigModel } from "../Model/AiConfigModel";
 
 
 /** 属性加成管理器*/
 /** 属性加成管理器*/
 export class AttributeBonusMgr {
 export class AttributeBonusMgr {
@@ -15,12 +16,14 @@ export class AttributeBonusMgr {
 
 
     userModel: UserModel;
     userModel: UserModel;
     developConfig: DevelopConfigModel;
     developConfig: DevelopConfigModel;
+    aiConfig: AiConfigModel;
     mainConfig: MainConfigModel;
     mainConfig: MainConfigModel;
 
 
     initilize() {
     initilize() {
         this.userModel = new UserModel();
         this.userModel = new UserModel();
         this.mainConfig = new MainConfigModel();
         this.mainConfig = new MainConfigModel();
         this.developConfig = new DevelopConfigModel();
         this.developConfig = new DevelopConfigModel();
+        this.aiConfig = new AiConfigModel();
         this.userModel.initialize();
         this.userModel.initialize();
     }
     }
 
 

+ 30 - 2
assets/module_storm_sunder/Script/Manager/PlayerMgr.ts

@@ -3,6 +3,8 @@ import { ResLoader, resLoader } from "db://assets/core_tgx/base/ResLoader";
 import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
 import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
 import { TornadoComponent } from "../Component/TornadoComponent";
 import { TornadoComponent } from "../Component/TornadoComponent";
 import { TornadoAIComponent } from "../Component/TornadoAIComponent";
 import { TornadoAIComponent } from "../Component/TornadoAIComponent";
+import { AttributeBonusMgr } from "./AttributeBonusMgr";
+import { Tableai_config } from "db://assets/module_basic/table/Tableai_config";
 
 
 const res = [
 const res = [
     "Prefabs/Tornado",
     "Prefabs/Tornado",
@@ -23,13 +25,17 @@ export class PlayerMgr {
     }
     }
 
 
     public tornadoNode: Node = null;//玩家节点
     public tornadoNode: Node = null;//玩家节点
+    public aiPlayersConfig: Map<number, any> = new Map();//AI玩家配置
+    public createAIPlayerCount: number = 3;//创建AI玩家数量
+    public aiConfigCount: number = 3;//AI配置数量
+
+    public pickAiMap: Map<number, Tableai_config> = new Map();//权重随机的AI
 
 
     //创建AI玩家
     //创建AI玩家
     public async genareatorAIPlayer(): Promise<void> {
     public async genareatorAIPlayer(): Promise<void> {
         return new Promise(async (resolve, reject) => {
         return new Promise(async (resolve, reject) => {
-            const aiCount: number = 1;
             const aiPoints = StormSunderGlobalInstance.instance.aiPoints;
             const aiPoints = StormSunderGlobalInstance.instance.aiPoints;
-            for (let i = 0; i < aiCount; i++) {
+            for (let i = 0; i < this.createAIPlayerCount; i++) {
                 const infoPrefab = await resLoader.loadAsync(resLoader.gameBundleName, res[0], Prefab);
                 const infoPrefab = await resLoader.loadAsync(resLoader.gameBundleName, res[0], Prefab);
                 let infoNode = instantiate(infoPrefab);
                 let infoNode = instantiate(infoPrefab);
                 infoNode.parent = StormSunderGlobalInstance.instance.players;
                 infoNode.parent = StormSunderGlobalInstance.instance.players;
@@ -65,5 +71,27 @@ export class PlayerMgr {
             })
             })
         })
         })
     }
     }
+
+    /** 所有AI玩家配置数据*/
+    addAIPlayers() {
+        for (let id = 1; id <= this.aiConfigCount; id++) {
+            const config = AttributeBonusMgr.inst.aiConfig.getAIConfigById(id);
+            if (config) {
+                this.aiPlayersConfig.set(id, config); // 保存配置
+            }
+        }
+
+        console.log("AI玩家配置数据:", this.aiPlayersConfig);
+    }
+
+    /** 根据权重计算 排序储存*/
+    weightGeneateAIConfig(): Tableai_config[] {
+        const result: Tableai_config[] = [];
+        for (let i = 0; i < this.aiConfigCount; i++) {
+            console.log(this.aiPlayersConfig[i].data.weight);
+        }
+        return result;
+    }
+
 }
 }
 
 

+ 15 - 0
assets/module_storm_sunder/Script/Model/AiConfigModel.ts

@@ -0,0 +1,15 @@
+import { Tableai_config } from "db://assets/module_basic/table/Tableai_config";
+/**
+ * AI配置数据
+*/
+export class AiConfigModel {
+
+    constructor() {
+    }
+
+    getAIConfigById(id: number) {
+        const config = new Tableai_config();
+        config.init(id);
+        return config;
+    }
+}

+ 9 - 0
assets/module_storm_sunder/Script/Model/AiConfigModel.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "8bcccfa2-725a-43b9-90f1-601a343aa5e2",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

文件差異過大導致無法顯示
+ 221 - 133
assets/module_storm_sunder/rooster_stormsunder.scene


二進制
excel/main_config.xlsx


部分文件因文件數量過多而無法顯示