Explorar o código

时长 AI人数根据map配置

woso_javan hai 2 meses
pai
achega
de91ff251a

+ 3 - 3
assets/model_scene/Model/ground/ground.fbx.meta

@@ -32,14 +32,14 @@
       "userData": {
         "gltfIndex": 0,
         "fixAlphaTransparencyArtifacts": true,
-        "hasAlpha": false,
+        "hasAlpha": true,
         "type": "texture"
       },
       "ver": "1.0.3",
       "imported": true,
       "files": [
-        ".jpg",
-        ".json"
+        ".json",
+        ".png"
       ],
       "subMetas": {}
     },

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

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

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

@@ -6,6 +6,7 @@ import { AiConfigModel } from "../Model/AiConfigModel";
 import { EventDispatcher } from "db://assets/core_tgx/easy_ui_framework/EventDispatcher";
 import { GameEvent } from "../Enum/GameEvent";
 import { NameConfigModel } from "../Model/NameConfigModel";
+import { MapConfigModel } from "../Model/MapConfigModel";
 
 /** 属性加成管理器*/
 export class AttributeBonusMgr {
@@ -22,11 +23,13 @@ export class AttributeBonusMgr {
     developConfig: DevelopConfigModel;
     aiConfig: AiConfigModel;
     mainConfig: MainConfigModel;
+    mapConfig: MapConfigModel;
 
     initilize() {
         this.userModel = new UserModel();
         this.nameModelConfig = new NameConfigModel();
         this.mainConfig = new MainConfigModel();
+        this.mapConfig = new MapConfigModel();
         this.developConfig = new DevelopConfigModel();
         this.aiConfig = new AiConfigModel();
         this.userModel.initialize();

+ 3 - 24
assets/module_storm_sunder/Script/Manager/GameMgr.ts

@@ -9,6 +9,7 @@ import { PlayerMgr } from "./PlayerMgr";
 import { assetManager, instantiate, Prefab } from "cc";
 import { resLoader } from "db://assets/core_tgx/base/ResLoader";
 import { Effect2DUIMgr } from "./Effect2DUIMgr";
+import { MapMgr } from "./MapMgr";
 
 export class GameMgr {
     private static _instance: GameMgr;
@@ -49,9 +50,10 @@ export class GameMgr {
                 PropMgr.inst.reset();
                 Effect2DUIMgr.inst.reset();
                 PlayerMgr.inst.reset();
+                MapMgr.Instance.setMapInfo(1);
                 break;
             case GameStatus.Playing:
-                await this.addMapNode();
+                await MapMgr.Instance.addMapNode();
                 await PlayerMgr.inst.setPlayerVisible(true);
                 await PlayerMgr.inst.setPlayerPosition();
                 homeUI.active = false;
@@ -81,29 +83,6 @@ export class GameMgr {
         await PlayerMgr.inst.genareatorAIPlayer();
         TimerMgr.inst.startCountdown();
     }
-
-    //添加地图节点
-    public async addMapNode() {
-        const mapUI = StormSunderGlobalInstance.instance.map;
-        const map = await this.loadAsyncMap();
-        const node = instantiate(map);
-        node.parent = mapUI;
-    }
-
-    //加载地图
-    public async loadAsyncMap(): Promise<Prefab> {
-        return new Promise((resolve, reject) => {
-            const bundle = assetManager.getBundle(resLoader.gameBundleName);
-            if (!bundle) {
-                console.error("module_nut is null!");
-                reject();
-            }
-
-            resLoader.loadAsync(resLoader.gameBundleName, `Prefabs/Map1`, Prefab).then((prefab: Prefab) => {
-                resolve(prefab);
-            })
-        })
-    }
 }
 
 export enum GameStatus {

+ 58 - 0
assets/module_storm_sunder/Script/Manager/MapMgr.ts

@@ -0,0 +1,58 @@
+/** 地图管理器*/
+
+import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
+import { AttributeBonusMgr } from "./AttributeBonusMgr";
+import { PlayerMgr } from "./PlayerMgr";
+import { assetManager, instantiate, Prefab } from "cc";
+import { resLoader } from "db://assets/core_tgx/base/ResLoader";
+import { TimerMgr } from "./TimerMgr";
+
+export class MapMgr {
+    private static _instance: MapMgr;
+    public static get Instance(): MapMgr {
+        if (this._instance == null) {
+            this._instance = new MapMgr();
+        }
+        return this._instance;
+    }
+
+    //添加地图节点
+    public async addMapNode() {
+        const mapUI = StormSunderGlobalInstance.instance.map;
+        const map = await this.loadAsyncMap();
+        const node = instantiate(map);
+        node.parent = mapUI;
+    }
+
+    //加载地图
+    public async loadAsyncMap(): Promise<Prefab> {
+        return new Promise((resolve, reject) => {
+            const bundle = assetManager.getBundle(resLoader.gameBundleName);
+            if (!bundle) {
+                console.error("module_nut is null!");
+                reject();
+            }
+
+            resLoader.loadAsync(resLoader.gameBundleName, `Prefabs/Map1`, Prefab).then((prefab: Prefab) => {
+                resolve(prefab);
+            })
+        })
+    }
+
+    //获取地图配置信息
+    public getMapConfig(id: number) {
+        const config = AttributeBonusMgr.inst.mapConfig.getPramById(id);
+        return {
+            time: config.time,
+            item: config.item,
+            count: config.number
+        }
+    }
+
+    //根据地图信息设置AI 时长等
+    public setMapInfo(id: number) {
+        const config = this.getMapConfig(id);
+        TimerMgr.inst.countDownTime = config.time;
+        PlayerMgr.inst.createAIPlayerCount = config.count;
+    }
+}

+ 9 - 0
assets/module_storm_sunder/Script/Manager/MapMgr.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "63273518-db9c-4d85-90f7-1db30df35d53",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

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

@@ -19,7 +19,7 @@ export class TimerMgr {
         return this.Instance;
     }
 
-    public countDownTime: number = 100;
+    public countDownTime: number = 1;
     private timerId: number = 0;
     private propMgr: PropMgr;
 

+ 18 - 0
assets/module_storm_sunder/Script/Model/MapConfigModel.ts

@@ -0,0 +1,18 @@
+import { Tablemap_config } from "db://assets/module_basic/table/Tablemap_config";
+import { Tablemain_config } from "../../../module_basic/table/Tablemain_config";
+
+/**map 配置表模型 */
+export class MapConfigModel {
+
+    config: Tablemap_config = null!;
+
+    constructor() {
+        this.config = new Tablemap_config();
+    }
+
+    getPramById(id: number) {
+        this.config.init(id);
+        const param = this.config;
+        return param
+    }
+}

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

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "00532ab3-66bb-41b2-903a-aa23996f6df0",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}