Clarify title new game confirmation
This commit is contained in:
@@ -63,7 +63,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-ENTER', () => this.handleEnterKey());
|
||||
this.input.keyboard?.on('keydown', (event: KeyboardEvent) => this.handleSaveSlotKey(event));
|
||||
this.input.keyboard?.on('keydown-ESC', () => this.handleEscapeKey());
|
||||
}
|
||||
@@ -325,13 +325,15 @@ export class TitleScene extends Phaser.Scene {
|
||||
return text;
|
||||
}
|
||||
|
||||
text.setInteractive({ useHandCursor: true });
|
||||
text.on('pointerover', () => {
|
||||
const hitArea = this.add.zone(x, y, 216, 58);
|
||||
hitArea.setOrigin(0.5);
|
||||
hitArea.setInteractive({ useHandCursor: true });
|
||||
hitArea.on('pointerover', () => {
|
||||
this.focusButton(text);
|
||||
soundDirector.playHover();
|
||||
});
|
||||
text.on('pointerout', () => this.unfocusButton(text));
|
||||
text.on('pointerdown', () => {
|
||||
hitArea.on('pointerout', () => this.unfocusButton(text));
|
||||
hitArea.on('pointerdown', () => {
|
||||
soundDirector.start();
|
||||
soundDirector.resume();
|
||||
onSelect();
|
||||
@@ -571,6 +573,24 @@ export class TitleScene extends Phaser.Scene {
|
||||
this.saveSlotPanel = undefined;
|
||||
}
|
||||
|
||||
private handleEnterKey() {
|
||||
if (this.saveSlotPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.newGameConfirmPanel) {
|
||||
this.closeNewGameConfirmPanel();
|
||||
this.startGame();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.settingsPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.activateDefaultMenuAction();
|
||||
}
|
||||
|
||||
private handleEscapeKey() {
|
||||
if (this.saveSlotPanel) {
|
||||
soundDirector.playSelect();
|
||||
@@ -614,10 +634,10 @@ export class TitleScene extends Phaser.Scene {
|
||||
this.closeSaveSlotPanel();
|
||||
|
||||
const panel = this.add.container(x, y + 240);
|
||||
const backdrop = this.add.rectangle(0, 0, 286, 174, 0x0e151d, 0.94);
|
||||
const backdrop = this.add.rectangle(0, 0, 286, 198, 0x0e151d, 0.94);
|
||||
backdrop.setStrokeStyle(1, palette.gold, 0.58);
|
||||
|
||||
const title = this.add.text(0, -58, '새로 시작', {
|
||||
const title = this.add.text(0, -72, '새로 시작', {
|
||||
fontFamily: '"Malgun Gothic", "Noto Sans KR", sans-serif',
|
||||
fontSize: '23px',
|
||||
color: '#f1e3c2',
|
||||
@@ -627,7 +647,7 @@ export class TitleScene extends Phaser.Scene {
|
||||
});
|
||||
title.setOrigin(0.5);
|
||||
|
||||
const message = this.add.text(0, -20, '현재 저장을 덮고\n처음부터 시작합니다.', {
|
||||
const message = this.add.text(0, -32, '현재 저장을 덮고\n처음부터 시작합니다.', {
|
||||
fontFamily: '"Malgun Gothic", "Noto Sans KR", sans-serif',
|
||||
fontSize: '15px',
|
||||
color: '#bfc8d3',
|
||||
@@ -637,20 +657,30 @@ export class TitleScene extends Phaser.Scene {
|
||||
});
|
||||
message.setOrigin(0.5);
|
||||
|
||||
const confirm = this.createSettingsButton(0, 30, '새 게임 시작');
|
||||
const hint = this.add.text(0, 13, 'Enter 새 게임 · Esc 취소', {
|
||||
fontFamily: '"Malgun Gothic", "Noto Sans KR", sans-serif',
|
||||
fontSize: '11px',
|
||||
color: '#9fb0bf',
|
||||
fontStyle: '700',
|
||||
fixedWidth: 220,
|
||||
align: 'center'
|
||||
});
|
||||
hint.setOrigin(0.5);
|
||||
|
||||
const confirm = this.createSettingsButton(0, 48, '새 게임 시작');
|
||||
confirm.setColor('#f1e3c2');
|
||||
confirm.on('pointerdown', () => {
|
||||
this.closeNewGameConfirmPanel();
|
||||
this.startGame();
|
||||
});
|
||||
|
||||
const cancel = this.createSettingsButton(0, 74, '취소');
|
||||
const cancel = this.createSettingsButton(0, 88, '취소');
|
||||
cancel.on('pointerdown', () => {
|
||||
soundDirector.playSelect();
|
||||
this.closeNewGameConfirmPanel();
|
||||
});
|
||||
|
||||
panel.add([backdrop, title, message, confirm, cancel]);
|
||||
panel.add([backdrop, title, message, hint, confirm, cancel]);
|
||||
panel.setAlpha(0);
|
||||
this.newGameConfirmPanel = panel;
|
||||
this.tweens.add({ targets: panel, alpha: 1, y: y + 230, duration: 160, ease: 'Sine.easeOut' });
|
||||
|
||||
Reference in New Issue
Block a user