Add escape dismissal for camp modals

This commit is contained in:
2026-07-05 03:13:15 +09:00
parent 0cc72b7b0b
commit ef9059c76a
2 changed files with 34 additions and 0 deletions

View File

@@ -10754,6 +10754,7 @@ export class CampScene extends Phaser.Scene {
this.selectedDialogueId = this.availableCampDialogues()[0]?.id ?? campDialogues[0].id;
this.selectedVisitId = this.availableCampVisits()[0]?.id ?? campVisits[0].id;
soundDirector.playMusic('militia-theme');
this.input.keyboard?.on('keydown-ESC', () => this.handleEscapeKey());
loadBattleUiIcons(this, () => this.ensureCampAssets(() => this.drawCampScene()));
}
@@ -11984,6 +11985,19 @@ export class CampScene extends Phaser.Scene {
this.saveSlotObjects = [];
}
private handleEscapeKey() {
if (this.saveSlotObjects.length > 0) {
soundDirector.playSelect();
this.hideCampSaveSlotPanel();
return;
}
if (this.sortieObjects.length > 0) {
soundDirector.playSelect();
this.hideSortiePrep();
}
}
private addTabButton(label: string, tab: CampTab, x: number, y: number) {
const bg = this.add.rectangle(x, y, 76, 34, 0x182431, 0.94);
bg.setStrokeStyle(1, palette.blue, 0.62);

View File

@@ -64,6 +64,7 @@ export class TitleScene extends Phaser.Scene {
this.input.once('pointerdown', unlockAudio);
this.input.keyboard?.once('keydown', unlockAudio);
this.input.keyboard?.once('keydown-ENTER', () => this.activateDefaultMenuAction());
this.input.keyboard?.on('keydown-ESC', () => this.handleEscapeKey());
}
private shouldOpenDebugSortiePrep() {
@@ -537,6 +538,25 @@ export class TitleScene extends Phaser.Scene {
this.saveSlotPanel = undefined;
}
private handleEscapeKey() {
if (this.saveSlotPanel) {
soundDirector.playSelect();
this.closeSaveSlotPanel();
return;
}
if (this.newGameConfirmPanel) {
soundDirector.playSelect();
this.closeNewGameConfirmPanel();
return;
}
if (this.settingsPanel) {
soundDirector.playSelect();
this.closeSettingsPanel();
}
}
private requestStartGame() {
if (!hasCampaignSave()) {
this.startGame();