mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-08 03:16:49 +08:00
1、优化框架启动配置在H5模式下因弱网加载失败进不了游戏问题,框架会自动反复重试加载配置文件
2、配置数据获取后,删除内存中的配置资源
This commit is contained in:
@@ -45,25 +45,34 @@ export class Root extends Component {
|
||||
|
||||
console.log(`Oops Framework v${version}`);
|
||||
this.enabled = false;
|
||||
|
||||
let config_name = "config";
|
||||
oops.res.load(config_name, JsonAsset, () => {
|
||||
var config = oops.res.get(config_name);
|
||||
// oops.config.btc = new BuildTimeConstants();
|
||||
oops.config.query = new GameQueryConfig();
|
||||
oops.config.game = new GameConfig(config);
|
||||
oops.http.server = oops.config.game.httpServer; // Http 服务器地址
|
||||
oops.http.timeout = oops.config.game.httpTimeout; // Http 请求超时时间
|
||||
oops.storage.init(oops.config.game.localDataKey, oops.config.game.localDataIv); // 初始化本地存储加密
|
||||
game.frameRate = oops.config.game.frameRate; // 初始化每秒传输帧数
|
||||
|
||||
this.enabled = true;
|
||||
this.init();
|
||||
this.run();
|
||||
});
|
||||
this.loadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private loadConfig() {
|
||||
const config_name = "config";
|
||||
oops.res.load(config_name, JsonAsset, () => {
|
||||
var config = oops.res.get(config_name);
|
||||
if (config == null) {
|
||||
this.loadConfig();
|
||||
return;
|
||||
}
|
||||
// oops.config.btc = new BuildTimeConstants();
|
||||
oops.config.query = new GameQueryConfig();
|
||||
oops.config.game = new GameConfig(config);
|
||||
oops.http.server = oops.config.game.httpServer; // Http 服务器地址
|
||||
oops.http.timeout = oops.config.game.httpTimeout; // Http 请求超时时间
|
||||
oops.storage.init(oops.config.game.localDataKey, oops.config.game.localDataIv); // 初始化本地存储加密
|
||||
game.frameRate = oops.config.game.frameRate; // 初始化每秒传输帧数
|
||||
|
||||
this.enabled = true;
|
||||
this.init();
|
||||
this.run();
|
||||
|
||||
oops.res.release(config_name);
|
||||
});
|
||||
}
|
||||
|
||||
update(dt: number) {
|
||||
oops.ecs.execute(dt);
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ export class GameConfig {
|
||||
}
|
||||
|
||||
constructor(config: any) {
|
||||
let data = config.json;
|
||||
this._data = Object.freeze(data);
|
||||
this._data = Object.freeze(config.json);
|
||||
|
||||
oops.log.logConfig(this._data, "游戏配置");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user