[Enhancement] Add confirm exit popup in starter select UI (#3316)

* add confirmExit popup

* add translation entries for `confirmExit`

* Update src/ui/starter-select-ui-handler.ts

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>

---------

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>
This commit is contained in:
Leo Kim 2024-08-04 04:16:29 +09:00 committed by GitHub
parent 800abc4767
commit d20b7553ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 36 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "Mit diesen Pokémon losziehen?",
"confirmExit": "Do you want to exit?",
"invalidParty": "Das ist kein gültiges Team!",
"gen1": "I",
"gen2": "II",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "Begin with these Pokémon?",
"confirmExit": "Do you want to exit?",
"invalidParty": "This is not a valid starting party!",
"gen1": "I",
"gen2": "II",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "¿Comenzar con estos Pokémon?",
"confirmExit": "Do you want to exit?",
"invalidParty": "¡Este equipo no es válido!",
"gen1": "I",
"gen2": "II",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "Commencer avec ces Pokémon ?",
"confirmExit": "Do you want to exit?",
"invalidParty": "Cette équipe de départ est invalide !",
"gen1": "1G",
"gen2": "2G",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "Vuoi iniziare con questi Pokémon?",
"confirmExit": "Do you want to exit?",
"invalidParty": "Questo squadra iniziale non è valida!",
"gen1": "1ª",
"gen2": "2ª",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "이 포켓몬들로 시작하시겠습니까?",
"confirmExit": "Do you want to exit?",
"invalidParty": "스타팅 포켓몬 파티에 적합하지 않습니다!",
"gen1": "1세대",
"gen2": "2세대",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "Começar com esses Pokémon?",
"confirmExit": "Do you want to exit?",
"invalidParty": "Essa equipe de iniciais não é válida!",
"gen1": "G1",
"gen2": "G2",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "使用这些宝可梦开始游戏吗?",
"confirmExit": "Do you want to exit?",
"invalidParty": "初始队伍不可用!",
"gen1": "I",
"gen2": "II",

View File

@ -7,6 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/
export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "使用這些寶可夢開始嗎?",
"confirmExit": "Do you want to exit?",
"invalidParty": "此為無效隊伍!",
"gen1": "I",
"gen2": "II",

View File

@ -1063,14 +1063,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
success = true;
this.updateInstructions();
} else {
this.blockInput = true;
this.scene.clearPhaseQueue();
if (this.scene.gameMode.isChallenge) {
this.scene.pushPhase(new SelectChallengePhase(this.scene));
} else {
this.scene.pushPhase(new TitlePhase(this.scene));
}
this.scene.getCurrentPhase().end();
this.tryExit();
success = true;
}
} else if (this.startCursorObj.visible) { // this checks to see if the start button is selected
@ -2880,6 +2873,32 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
return true;
}
tryExit(): boolean {
this.blockInput = true;
const ui = this.getUi();
const cancel = () => {
ui.setMode(Mode.STARTER_SELECT);
this.clearText();
this.blockInput = false;
};
ui.showText(i18next.t("starterSelectUiHandler:confirmExit"), null, () => {
ui.setModeWithoutClear(Mode.CONFIRM, () => {
ui.setMode(Mode.STARTER_SELECT);
this.scene.clearPhaseQueue();
if (this.scene.gameMode.isChallenge) {
this.scene.pushPhase(new SelectChallengePhase(this.scene));
} else {
this.scene.pushPhase(new TitlePhase(this.scene));
}
this.clearText();
this.scene.getCurrentPhase().end();
}, cancel, null, null, 19);
});
return true;
}
tryStart(manualTrigger: boolean = false): boolean {
if (!this.starterSpecies.length) {
return false;