Fixed syntax errors + updated signature

This commit is contained in:
Bertie690 2025-07-18 13:44:41 -04:00
parent de8cfeff3e
commit f9dc9d2c1d
7 changed files with 12 additions and 15 deletions

View File

@ -669,7 +669,7 @@ export class BattleScene extends SceneBase {
).then(() => loadMoveAnimAssets(defaultMoves, true)),
this.initStarterColors(),
]).then(() => {
this.phaseManager.toTitleScreen("addLogin");
this.phaseManager.toTitleScreen(true);
});
}

View File

@ -257,18 +257,15 @@ export class PhaseManager {
}
/**
* Add a new {@linkcode TitlePhase}.
* @param clearPhaseQueue - Whether to clear the phase queue before adding a new {@linkcode TitlePhase}.
* If set to `addLogin`, will add a new {@linkcode LoginPhase} before the {@linkcode TitlePhase}
* Clear all previously set phases, then add a new {@linkcode TitlePhase} to transition to the title screen.
* @param addLogin - Whether to add a new {@linkcode LoginPhase} before the {@linkcode TitlePhase}
* (but reset everything else).
* Default `false`
*/
public toTitleScreen(clearPhaseQueue: boolean | "addLogin" = false): void {
if (clearPhaseQueue) {
this.clearAllPhases();
}
public toTitleScreen(addLogin = false): void {
this.clearAllPhases();
if (clearPhaseQueue === "addLogin") {
if (addLogin) {
this.unshiftNew("LoginPhase");
}
this.unshiftNew("TitlePhase");

View File

@ -26,7 +26,7 @@ export class SelectStarterPhase extends Phase {
globalScene.ui.setMode(UiMode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
// If clicking cancel, back out to title screen
if (slotId === -1) {
globalScene.phaseManager.toTitleScreen(true);
globalScene.phaseManager.toTitleScreen();
this.end();
return;
}

View File

@ -118,7 +118,7 @@ export class TitlePhase extends Phase {
options.push({
label: i18next.t("menu:cancel"),
handler: () => {
globalScene.phaseManager.toTitleScreen(true);
globalScene.phaseManager.toTitleScreen();
super.end();
return true;
},
@ -192,7 +192,7 @@ export class TitlePhase extends Phase {
globalScene.ui.clearText();
globalScene.ui.setMode(UiMode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
if (slotId === -1) {
globalScene.phaseManager.toTitleScreen(true);
globalScene.phaseManager.toTitleScreen();
super.end();
return;
}

View File

@ -381,7 +381,7 @@ export class GameChallengesUiHandler extends UiHandler {
this.cursorObj?.setVisible(true);
this.updateChallengeArrows(this.startCursor.visible);
} else {
globalScene.phaseManager.toTitleScreen(true);
globalScene.phaseManager.toTitleScreen();
globalScene.phaseManager.getCurrentPhase()?.end();
}
success = true;

View File

@ -4321,7 +4321,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
ui.setMode(UiMode.STARTER_SELECT);
// Non-challenge modes go directly back to title, while challenge modes go to the selection screen.
if (!globalScene.gameMode.isChallenge) {
globalScene.phaseManager.toTitleScreen(true);
globalScene.phaseManager.toTitleScreen();
} else {
globalScene.phaseManager.clearPhaseQueue();
globalScene.phaseManager.pushNew("SelectChallengePhase");

View File

@ -105,7 +105,7 @@ export class GameManager {
(this.scene.ui.handlers[UiMode.STARTER_SELECT] as StarterSelectUiHandler).clearStarterPreferences();
// Must be run after phase interceptor has been initialized.
this.scene.phaseManager.toTitlePhase("addLogin");
this.scene.phaseManager.toTitleScreen(true);
this.scene.phaseManager.shiftPhase();
this.gameWrapper.scene = this.scene;