初始化默认数值

This commit is contained in:
yhh
2020-07-24 16:57:26 +08:00
parent 6be43fc9ac
commit 2b13e5ee7d
11 changed files with 217 additions and 61 deletions

View File

@@ -28,23 +28,25 @@
//////////////////////////////////////////////////////////////////////////////////////
class Main extends es.Core {
protected async initialize() {
await this.runGame();
protected initialize() {
this.runGame();
}
private async runGame() {
await this.loadResource();
private runGame() {
this.loadResource();
this.createGameScene();
}
private async loadResource() {
private loadResource() {
try {
const loadingView = new LoadingUI();
this.stage.addChild(loadingView);
await RES.loadConfig("resource/default.res.json", "resource/");
await RES.loadGroup("preload", 0, loadingView);
this.stage.removeChild(loadingView);
RES.loadConfig("resource/default.res.json", "resource/").then(()=>{
RES.loadGroup("preload", 0, loadingView).then(()=>{
this.stage.removeChild(loadingView);
});
});
}
catch (e) {
console.error(e);