Add in-game settings panel

This commit is contained in:
2026-06-19 23:43:44 +09:00
parent 46f8b10d53
commit 0e52fdd68f
4 changed files with 271 additions and 3 deletions

View File

@@ -56,7 +56,7 @@
`BattleState` owns tactical runtime fields. `CampaignState` saves only campaign-facing data: completed scenario ids, gold, inventory counts, joined officers, campaign flags, and a player roster snapshot. It does not save map positions, pre-battle Roster/Formation choices, action flags, temporary status effects, or transient battle occupancy.
Presentation preferences are separate from campaign progression. `BattleScene` reads and writes `user://heros_settings.json` for title-menu BGM/SFX toggles, BGM/SFX volume percentages, and edge-scroll preference, then applies those values to menu and battle audio playback without mutating `CampaignState`.
Presentation preferences are separate from campaign progression. `BattleScene` reads and writes `user://heros_settings.json` for BGM/SFX toggles, BGM/SFX volume percentages, and edge-scroll preference, exposing the same values through the title settings menu and the top in-game toolbar settings panel. These values apply to menu and battle audio playback without mutating `CampaignState`.
Joined officers gate whether `requires_joined` player deployments are loaded at all. Rewards and post-battle choices can add or remove joined officers without deleting their saved roster snapshot, so a later rejoin can preserve progression. When a save loads, `CampaignState` scans completed scenarios in campaign order and reapplies only officer join/leave transitions from rewards and the saved `applied_post_battle_choices` ledger, allowing added recruitment rewards to reach older saves without replaying gold or items. Old saves without the ledger can backfill a choice id only when exactly one completed scenario choice matches saved flags. Roster entries are keyed by `officer_id` when available, so future scenarios can deploy the same joined officer under different scenario-specific `unit_id` values. Saved progression overlays final battle stats for now; a later equipment refactor should split base stats from equipment bonuses before adding item leveling or stat recalculation. New battles currently start player units healed to their saved maximum HP/MP. Skill access is carried in roster snapshots, with class defaults still applied for old saves that do not include skills. Promoted class ids are saved in the roster, and the next battle rehydrates class-derived movement, growth, skills, and range from the saved class id before equipment range is recalculated.