diff --git a/assets/core/game/GameManager.ts b/assets/core/game/GameManager.ts index 2f5d64c..678ad23 100644 --- a/assets/core/game/GameManager.ts +++ b/assets/core/game/GameManager.ts @@ -54,7 +54,9 @@ export class GameManager { } // 自定义节点排序索引 - if (params && params.siblingIndex) node.setSiblingIndex(params.siblingIndex); + if (params) { + if (params.siblingIndex) node.setSiblingIndex(params.siblingIndex); + } resolve(node); }); @@ -70,4 +72,4 @@ export class GameManager { //@ts-ignore return director.globalGameTimeScale; } -} +} \ No newline at end of file diff --git a/assets/module/config/GameConfig.ts b/assets/module/config/GameConfig.ts index af0a99c..2c0cf59 100644 --- a/assets/module/config/GameConfig.ts +++ b/assets/module/config/GameConfig.ts @@ -4,18 +4,22 @@ * @LastEditors: dgflash * @LastEditTime: 2023-02-14 14:27:22 */ - import { oops } from "../../core/Oops"; +export enum GameConfigCustomType { + /** 开发环境 */ + Dev = "dev", + /** 测试环境 */ + Test = "test", + /** 生产环境 */ + Prod = "prod", +} + /* 游戏配置解析,对应 resources/config/config.json 配置 */ export class GameConfig { /** 客户端版本号配置 */ get version(): string { - return this._data["config"]["version"]; - } - /** 包名 */ - get package(): string { - return this._data["config"]["package"]; + return this._data.config.version; } /** 游戏每秒传输帧数 */ get frameRate(): number { @@ -55,22 +59,10 @@ export class GameConfig { return this._data.language.default || "zh"; } - /** 是否启用远程资源 */ - get bundleEnable(): string { - return this._data.bundle.enable; - } - /** 远程资源服务器地址 */ - get bundleServer(): string { - return this._data.bundle.server; - } /** 远程资源名 */ get bundleDefault(): string { return this._data.bundle.default; } - /** 远程所有资源包配置 */ - get bundlePackages(): string { - return this._data.bundle.packages; - } /** 加载界面资源超时提示 */ get loadingTimeoutGui(): number { @@ -82,7 +74,7 @@ export class GameConfig { return this._data.config.mobileSafeArea || false; } - private readonly _data: any = null; + private _data: any = null; /** 游戏配置数据 */ get data(): any { return this._data; @@ -93,4 +85,19 @@ export class GameConfig { oops.log.logConfig(this._data, "游戏配置"); } + + private _customType: GameConfigCustomType = GameConfigCustomType.Dev; + + /** + * 设置自定义游戏参数配置类型 + * @param type + */ + setCustomType(type: GameConfigCustomType) { + this._customType = type; + } + + /** 获取游戏自定义配置 */ + get custom(): any { + return this.data.custom[this._customType]; + } } \ No newline at end of file