Add post-battle camp scene

This commit is contained in:
2026-06-22 16:48:54 +09:00
parent 7135ac8e55
commit 797051ac9f
5 changed files with 651 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import { effectTracks, musicTracks } from './game/audio/audioAssets';
import { soundDirector } from './game/audio/SoundDirector';
import { BattleScene } from './game/scenes/BattleScene';
import { BootScene } from './game/scenes/BootScene';
import { CampScene } from './game/scenes/CampScene';
import { StoryScene } from './game/scenes/StoryScene';
import { TitleScene } from './game/scenes/TitleScene';
import './styles/global.css';
@@ -20,11 +21,17 @@ type DebugBattleScene = Phaser.Scene & {
debugForceBattleOutcome?: (outcome: 'victory' | 'defeat') => void;
};
type DebugCampScene = Phaser.Scene & {
getDebugState?: () => unknown;
};
type HerosDebugApi = {
game: Phaser.Game;
activeScenes: () => string[];
battle: () => unknown;
camp: () => unknown;
goToBattle: () => void;
goToCamp: () => void;
forceBattleOutcome: (outcome: 'victory' | 'defeat') => void;
scene: (key: string) => Phaser.Scene | undefined;
toggleBattleOverlay: () => void;
@@ -40,7 +47,7 @@ const config: Phaser.Types.Core.GameConfig = {
mode: Phaser.Scale.RESIZE,
autoCenter: Phaser.Scale.CENTER_BOTH
},
scene: [BootScene, TitleScene, StoryScene, BattleScene]
scene: [BootScene, TitleScene, StoryScene, BattleScene, CampScene]
};
soundDirector.registerMusicTracks(musicTracks);
@@ -57,14 +64,19 @@ if (import.meta.env.DEV) {
function createDebugApi(game: Phaser.Game): HerosDebugApi {
const scene = (key: string) => game.scene.getScene(key);
const battleScene = () => scene('BattleScene') as DebugBattleScene | undefined;
const campScene = () => scene('CampScene') as DebugCampScene | undefined;
return {
game,
activeScenes: () => game.scene.getScenes(true).map((activeScene) => activeScene.scene.key),
battle: () => battleScene()?.getDebugState?.() ?? { active: false, reason: 'BattleScene is not active yet.' },
camp: () => campScene()?.getDebugState?.() ?? { active: false, reason: 'CampScene is not active yet.' },
goToBattle: () => {
game.scene.start('BattleScene');
},
goToCamp: () => {
game.scene.start('CampScene');
},
forceBattleOutcome: (outcome) => {
battleScene()?.debugForceBattleOutcome?.(outcome);
},