/** * 界面相关的工具 */ module.exports = { allConfig: undefined, allZNConfig: undefined, /** * 获取指定配置。如果AllConfig未加载完成,会返回undefined * * @param {String} fileName */ getConfig (fileName) { if (!this.allConfig) { return undefined; } return this.allConfig[fileName]; }, /** * 加载从excel导出的策划表 * * @param {Object} mgr 加载后赋值的对象 * @param {String} fileName 文件名称 * @param {Function} cb 加载完成的回调 */ loadConfig (mgr, fileName, cb) { if (!this.allConfig) { G.LogUtils.warn('策划表还未加载完毕', fileName); return; } let ret = this.allConfig[fileName]; if (!ret) { G.LogUtils.warn('策划表', fileName, '不存在'); } mgr[fileName] = ret; if (cb) { cb(ret); } return ret; }, /** * 加载全部的策划表 [用于启动初始化策划表表] * * @returns */ loadAllConfig () { // cc.loader.loadRes('res_json/AllConfig', cc.JsonAsset, (err, jsonAsset) => { // if (err) { // G.LogUtils.log('Load AllConfig err: %s', err.stack); // return; // } // this.allConfig = jsonAsset.json; // cc.loader.releaseRes('res_json/AllConfig'); // // 发送策划表更新消息 // cc.game.emit('e_mgr_load_config_done'); // }); } };