| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import { _decorator, Component, CCString, JsonAsset } from 'cc';
- import { ResourcesUtils } from '../core/resourceManager/ResourcesUtils';
- const { ccclass, property } = _decorator;
- @ccclass('ConfigData')
- export class ConfigData extends Component {
- @property({ type: [CCString], tooltip: "需要加载的配置文件" }) configNames = [];
- public static configMap: Map<string, any> = new Map();
- public async loadConfig() {
- for (let i = 0; i < this.configNames.length; i++) {
- let result = await (await ResourcesUtils.load<JsonAsset>("Configs/" + this.configNames[i], JsonAsset, this.node)).json;
- ConfigData.configMap.set(this.configNames[i], result);
- }
- }
- }
- // import { _decorator, Component, JsonAsset } from "cc";
- // import { ResourcesUtils } from "../core/resourceManager/ResourcesUtils";
- // const { ccclass, property } = _decorator;
- // /**
- // * 配置数据
- // *
- // */
- // @ccclass('ConfigData')
- // export class ConfigData extends Component {
- // /**一方最大参战人数*/
- // public battleMaxNum: number = 50;
- // /**系统配置 */
- // public systemConfig;
- // /**神将基础配置 */
- // public generalConfig;
- // /**抽奖配置配置 */
- // public lotteryConfig;
- // /**等级解锁配置 */
- // public generalUnlockConfig;
- // /**飞行宝箱配置 */
- // public flyBoxConfig;
- // public setBaseData() {
- // this.setSystemConfig();
- // this.setBaseGeneralData();
- // this.setLotteryData();
- // this.setFlyBoxConfig();
- // }
- // private async setSystemConfig() {
- // this.systemConfig = await (await ResourcesUtils.load<JsonAsset>("Configs/systemConfig", JsonAsset, this.node)).json;
- // } F
- // private async setBaseGeneralData() {
- // this.generalConfig = await (await ResourcesUtils.load<JsonAsset>("Configs/generalBase", JsonAsset, this.node)).json;
- // }
- // private async setLotteryData() {
- // this.lotteryConfig = await (await ResourcesUtils.load<JsonAsset>("Configs/turntable", JsonAsset, this.node)).json;
- // }
- // private async setFlyBoxConfig() {
- // this.flyBoxConfig = await (await ResourcesUtils.load<JsonAsset>("Configs/flyBox", JsonAsset, this.node)).json;
- // }
- // }
|