Make final ending return explicit

This commit is contained in:
2026-07-05 06:11:14 +09:00
parent fc81343f4f
commit 3f1a6cbde8
2 changed files with 30 additions and 8 deletions

View File

@@ -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;