Polish battle viewport and victory flow

This commit is contained in:
2026-06-22 15:21:34 +09:00
parent f30b99a78e
commit ce8050c5cc
4 changed files with 130 additions and 41 deletions

View File

@@ -11,8 +11,15 @@ const portraitKeys: Record<PortraitKey, string> = {
type AlphaObject = Phaser.GameObjects.Image | Phaser.GameObjects.Rectangle | Phaser.GameObjects.Text;
type StorySceneData = {
pages?: StoryPage[];
nextScene?: string;
};
export class StoryScene extends Phaser.Scene {
private pageIndex = 0;
private pages: StoryPage[] = prologuePages;
private nextScene = 'BattleScene';
private transitioning = false;
private background?: Phaser.GameObjects.Image;
private chapterText?: Phaser.GameObjects.Text;
@@ -27,10 +34,17 @@ export class StoryScene extends Phaser.Scene {
super('StoryScene');
}
init(data?: StorySceneData) {
this.pages = data?.pages?.length ? data.pages : prologuePages;
this.nextScene = data?.nextScene ?? 'BattleScene';
this.pageIndex = 0;
this.transitioning = false;
}
create() {
const { width, height } = this.scale;
this.add.rectangle(0, 0, width, height, 0x0b0d12).setOrigin(0);
this.background = this.add.image(width / 2, height / 2, prologuePages[0].background);
this.background = this.add.image(width / 2, height / 2, this.pages[0].background);
this.drawSceneShade(width, height);
this.drawDialogPanel(width, height);
this.showPage(0, true);
@@ -103,7 +117,7 @@ export class StoryScene extends Phaser.Scene {
}
private showPage(index: number, immediate = false) {
const page = prologuePages[index];
const page = this.pages[index];
if (immediate) {
this.applyPage(page);
@@ -171,7 +185,7 @@ export class StoryScene extends Phaser.Scene {
this.nameText?.setText(page.speaker ?? '나레이션');
this.bodyText?.setText(page.text);
this.progressText?.setText(`${this.pageIndex + 1} / ${prologuePages.length} SPACE / ENTER`);
this.progressText?.setText(`${this.pageIndex + 1} / ${this.pages.length} SPACE / ENTER`);
}
private applyBackground(textureKey: string) {
@@ -208,8 +222,8 @@ export class StoryScene extends Phaser.Scene {
return;
}
if (this.pageIndex >= prologuePages.length - 1) {
this.scene.start('BattleScene');
if (this.pageIndex >= this.pages.length - 1) {
this.scene.start(this.nextScene);
return;
}