Make final ending return explicit
This commit is contained in:
@@ -16,10 +16,8 @@ export class EndingScene extends Phaser.Scene {
|
||||
create() {
|
||||
this.ready = false;
|
||||
this.createFallbackTexture();
|
||||
this.ensureBackgroundLoaded(() => {
|
||||
this.ready = true;
|
||||
this.drawEnding();
|
||||
});
|
||||
this.renderEnding();
|
||||
this.ensureBackgroundLoaded(() => this.renderEnding());
|
||||
}
|
||||
|
||||
getDebugState() {
|
||||
@@ -49,14 +47,30 @@ export class EndingScene extends Phaser.Scene {
|
||||
return;
|
||||
}
|
||||
|
||||
this.load.once('complete', onReady);
|
||||
let finished = false;
|
||||
const finish = () => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
onReady();
|
||||
};
|
||||
this.load.once('complete', finish);
|
||||
this.load.once('loaderror', () => {
|
||||
console.warn(`Failed to load ending background ${this.backgroundKey}`);
|
||||
finish();
|
||||
});
|
||||
this.load.image(this.backgroundKey, url);
|
||||
this.load.start();
|
||||
}
|
||||
|
||||
private renderEnding() {
|
||||
this.tweens.killAll();
|
||||
this.children.removeAll(true);
|
||||
this.drawEnding();
|
||||
this.ready = true;
|
||||
}
|
||||
|
||||
private createFallbackTexture() {
|
||||
if (this.textures.exists('ending-fallback')) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user