Confirm battle save overwrite

This commit is contained in:
2026-07-05 03:50:15 +09:00
parent 950e8d0171
commit 2678649d2a

View File

@@ -1124,7 +1124,7 @@ type MapMenuAction = 'endTurn' | 'threat' | 'save' | 'load' | 'roster' | 'bond'
type EnemyAiBehavior = 'aggressive' | 'guard' | 'hold';
type BattleOutcome = 'victory' | 'defeat';
type SaveSlotMode = 'save' | 'load';
type TurnPromptMode = 'turn-end' | 'post-move' | 'load-confirm';
type TurnPromptMode = 'turn-end' | 'post-move' | 'load-confirm' | 'save-overwrite-confirm';
const battleSpeedStorageKey = 'heros-web:battle-speed';
const battleSpeedLabels: Record<BattleSpeed, string> = {
@@ -11204,8 +11204,7 @@ export class BattleScene extends Phaser.Scene {
this.suppressNextLeftClick = true;
soundDirector.playSelect();
if (mode === 'save') {
this.saveBattleState(slot);
this.hideSaveSlotPanel();
this.showSaveBattleConfirm(slot);
} else {
this.showLoadBattleConfirm(slot);
}
@@ -11242,6 +11241,37 @@ export class BattleScene extends Phaser.Scene {
this.saveSlotPanelObjects = [];
}
private showSaveBattleConfirm(slot: number) {
const battleSave = this.readBattleSaveState(slot);
const campaignSlot = listCampaignSaveSlots().find((candidate) => candidate.slot === slot);
if (!battleSave && !campaignSlot?.exists) {
this.saveBattleState(slot);
this.hideSaveSlotPanel();
return;
}
const existingSummary = battleSave
? `기존 전투: ${this.formatSavedAt(battleSave.savedAt)}`
: `기존 캠페인: ${campaignSlot?.progressTitle ?? campaignSlot?.battleTitle ?? '저장 데이터'}`;
this.hideSaveSlotPanel();
this.showTurnEndPrompt(undefined, {
mode: 'save-overwrite-confirm',
title: '전투 저장 확인',
body: `슬롯 ${slot}에 기존 저장이 있습니다.\n${existingSummary}\n덮어쓸까요?`,
primaryLabel: '덮어쓰기',
secondaryLabel: '취소',
primaryAction: () => {
this.hideTurnEndPrompt();
this.saveBattleState(slot);
},
secondaryAction: () => {
this.hideTurnEndPrompt();
this.showSaveSlotPanel('save');
}
});
}
private showLoadBattleConfirm(slot: number) {
const state = this.readBattleSaveState(slot);
if (!state) {