Merge pull request #8 from koneko/dev

load everything at once
This commit is contained in:
Koneko 2025-01-17 15:28:52 +01:00 committed by GitHub
commit f3fdb9f0ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,23 +61,27 @@ export default class GameAssets {
this.text.y = Engine.app.canvas.height / 2 + 50; this.text.y = Engine.app.canvas.height / 2 + 50;
this.text.anchor.set(0.5, 0.5); this.text.anchor.set(0.5, 0.5);
Engine.app.stage.addChild(this.text); Engine.app.stage.addChild(this.text);
await this.Load('/aclonica.woff2');
this.Button01Texture = await this.Load('/assets/gui/button_01.png'); await Promise.all([
this.Button02Texture = await this.Load('/assets/gui/button_02.png'); this.Load('/aclonica.woff2'),
this.Frame01Texture = await this.Load('/assets/gui/frame_01.png'); this.Load('/assets/gui/button_01.png').then((texture) => (this.Button01Texture = texture)),
this.Frame02Texture = await this.Load('/assets/gui/frame_02.png'); this.Load('/assets/gui/button_02.png').then((texture) => (this.Button02Texture = texture)),
this.Frame03Texture = await this.Load('/assets/gui/frame_03.png'); this.Load('/assets/gui/frame_01.png').then((texture) => (this.Frame01Texture = texture)),
this.FrameBackground = await this.Load('/assets/gui/background_01.png'); this.Load('/assets/gui/frame_02.png').then((texture) => (this.Frame02Texture = texture)),
this.FrameTowerTab = await this.Load('/assets/gui/background_02.png'); this.Load('/assets/gui/frame_03.png').then((texture) => (this.Frame03Texture = texture)),
this.VioletBackground = await this.Load('/assets/gui/frame_violet.png'); this.Load('/assets/gui/background_01.png').then((texture) => (this.FrameBackground = texture)),
this.RedBackground = await this.Load('/assets/gui/frame_red.png'); this.Load('/assets/gui/background_02.png').then((texture) => (this.FrameTowerTab = texture)),
this.GreenBackground = await this.Load('/assets/gui/frame_green.png'); this.Load('/assets/gui/frame_violet.png').then((texture) => (this.VioletBackground = texture)),
this.HealthTexture = await this.Load('/assets/gui/heart.png'); this.Load('/assets/gui/frame_red.png').then((texture) => (this.RedBackground = texture)),
this.GoldTexture = await this.Load('/assets/gui/money.png'); this.Load('/assets/gui/frame_green.png').then((texture) => (this.GreenBackground = texture)),
this.WaveTexture = await this.Load('/assets/gui/wave.png'); this.Load('/assets/gui/heart.png').then((texture) => (this.HealthTexture = texture)),
await this.LoadMissions(); this.Load('/assets/gui/money.png').then((texture) => (this.GoldTexture = texture)),
await this.LoadTowers(); this.Load('/assets/gui/wave.png').then((texture) => (this.WaveTexture = texture)),
await this.LoadCreeps(); this.LoadMissions(),
this.LoadTowers(),
this.LoadCreeps(),
]);
t.destroy(); t.destroy();
this.text.destroy(); this.text.destroy();
// Set this.text = true to disallow calling GameAssets.LoadAssets() again // Set this.text = true to disallow calling GameAssets.LoadAssets() again