fix: reset mode chain in TitlePhase's loadSaveSlot method

This commit is contained in:
Frederico Santos 2024-08-13 22:39:00 +01:00
parent 638a0a66b5
commit 0574e817d9
3 changed files with 6 additions and 0 deletions

View File

@ -321,6 +321,7 @@ export class TitlePhase extends Phase {
loadSaveSlot(slotId: integer): void {
this.scene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
this.scene.ui.setMode(Mode.MESSAGE);
this.scene.ui.resetModeChain();
this.scene.gameData.loadSession(this.scene, slotId, slotId === -1 ? this.lastSessionData : undefined).then((success: boolean) => {
if (success) {
this.loaded = true;

View File

@ -97,6 +97,7 @@ export default class MenuUiHandler extends MessageUiHandler {
render() {
const ui = this.getUi();
console.log(ui.getModeChain());
this.excludedMenus = () => [
{ condition: ![Mode.COMMAND, Mode.TITLE].includes(ui.getModeChain()[0]), options: [ MenuOptions.EGG_GACHA, MenuOptions.EGG_LIST] },
{ condition: bypassLogin, options: [ MenuOptions.LOG_OUT ] }

View File

@ -497,6 +497,10 @@ export default class UI extends Phaser.GameObjects.Container {
return this.setModeInternal(mode, false, false, true, args);
}
resetModeChain(): void {
this.modeChain = [];
}
revertMode(): Promise<boolean> {
return new Promise<boolean>(resolve => {
if (!this?.modeChain?.length) {