From 3f1a6cbde8b8020aacc8b66e62e9d953c1256ecb Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sun, 5 Jul 2026 06:11:14 +0900 Subject: [PATCH] Make final ending return explicit --- src/game/scenes/CampScene.ts | 14 +++++++++++--- src/game/scenes/EndingScene.ts | 24 +++++++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/game/scenes/CampScene.ts b/src/game/scenes/CampScene.ts index e73d7cb..37c1a1f 100644 --- a/src/game/scenes/CampScene.ts +++ b/src/game/scenes/CampScene.ts @@ -11839,9 +11839,10 @@ export class CampScene extends Phaser.Scene { soundDirector.playSelect(); this.showCampSaveSlotPanel(); }); - this.addCommandButton('다음 이야기', 1160, 38, 142, () => { + const flow = this.currentSortieFlow(); + const storyButtonLabel = this.isFinalEpilogueFlow(flow) && this.campaign?.step === flow.campaignStep ? '엔딩 보기' : '다음 이야기'; + this.addCommandButton(storyButtonLabel, 1160, 38, 142, () => { soundDirector.playSelect(); - const flow = this.currentSortieFlow(); if (this.isFinalEpilogueFlow(flow)) { this.startVictoryStory(); return; @@ -12283,7 +12284,8 @@ export class CampScene extends Phaser.Scene { soundDirector.playSelect(); this.hideSortiePrep(); }, depth + 3); - this.addSortieButton(isBattleSortie ? '출진' : '진행', x + width - 118, y + height - 42, 112, () => { + const primaryActionLabel = isBattleSortie ? '출진' : this.isFinalEpilogueFlow(flow) ? '엔딩' : '진행'; + this.addSortieButton(primaryActionLabel, x + width - 118, y + height - 42, 112, () => { soundDirector.playSelect(); this.startVictoryStory(); }, depth + 3); @@ -13760,6 +13762,12 @@ export class CampScene extends Phaser.Scene { return; } + if (this.isFinalEpilogueFlow(flow) && this.campaign?.step === flow.campaignStep) { + this.hideSortiePrep(); + void startLazyScene(this, 'EndingScene'); + return; + } + if (!flow.nextBattleId || !flow.campaignStep || flow.pages.length === 0) { this.hideSortiePrep(); if (!flow.nextBattleId && flow.campaignStep && flow.pages.length > 0) { diff --git a/src/game/scenes/EndingScene.ts b/src/game/scenes/EndingScene.ts index 1b33c22..5ddfa8c 100644 --- a/src/game/scenes/EndingScene.ts +++ b/src/game/scenes/EndingScene.ts @@ -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;