Extract Mode enum out of UI and into its own file
Reduces circular imports from 909 to 773
This commit is contained in:
parent
18c4dddcf0
commit
87184c92b4
|
@ -33,7 +33,7 @@ import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/myst
|
|||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { randSeedInt, randSeedShuffle } from "#app/utils";
|
||||
import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import type { OptionSelectConfig } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
|
@ -437,7 +437,7 @@ async function handleSwapAbility() {
|
|||
await showEncounterDialogue(`${namespace}:option.1.apply_ability_dialogue`, `${namespace}:speaker`);
|
||||
await showEncounterText(`${namespace}:option.1.apply_ability_message`);
|
||||
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
displayYesNoOptions(resolve);
|
||||
});
|
||||
});
|
||||
|
@ -467,7 +467,7 @@ function displayYesNoOptions(resolve) {
|
|||
maxOptions: 7,
|
||||
yOffset: 0,
|
||||
};
|
||||
globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true);
|
||||
globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true);
|
||||
}
|
||||
|
||||
function onYesAbilitySwap(resolve) {
|
||||
|
@ -477,11 +477,11 @@ function onYesAbilitySwap(resolve) {
|
|||
|
||||
applyAbilityOverrideToPokemon(pokemon, encounter.misc.ability);
|
||||
encounter.setDialogueToken("chosenPokemon", pokemon.getNameToRender());
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => resolve(true));
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => resolve(true));
|
||||
};
|
||||
|
||||
const onPokemonNotSelected = () => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
displayYesNoOptions(resolve);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ import type PokemonData from "#app/system/pokemon-data";
|
|||
import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import type { PartyOption, PokemonSelectFilter } from "#app/ui/party-ui-handler";
|
||||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils";
|
||||
import type { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Biome } from "#enums/biome";
|
||||
|
@ -562,7 +562,7 @@ export function selectPokemonForOption(
|
|||
|
||||
// Open party screen to choose pokemon
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.SELECT,
|
||||
-1,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
|
@ -580,7 +580,7 @@ export function selectPokemonForOption(
|
|||
}
|
||||
|
||||
// There is a second option to choose after selecting the Pokemon
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
const displayOptions = () => {
|
||||
// Always appends a cancel option to bottom of options
|
||||
const fullOptions = secondaryOptions
|
||||
|
@ -622,7 +622,7 @@ export function selectPokemonForOption(
|
|||
if (fullOptions[0].onHover) {
|
||||
fullOptions[0].onHover();
|
||||
}
|
||||
globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true);
|
||||
globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true);
|
||||
};
|
||||
|
||||
const textPromptKey =
|
||||
|
@ -672,20 +672,20 @@ export function selectOptionThenPokemon(
|
|||
const modeToSetOnExit = globalScene.ui.getMode();
|
||||
|
||||
const displayOptions = (config: OptionSelectConfig) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (!optionSelectPromptKey) {
|
||||
// Do hover over the starting selection option
|
||||
if (fullOptions[0].onHover) {
|
||||
fullOptions[0].onHover();
|
||||
}
|
||||
globalScene.ui.setMode(Mode.OPTION_SELECT, config);
|
||||
globalScene.ui.setMode(UiMode.OPTION_SELECT, config);
|
||||
} else {
|
||||
showEncounterText(optionSelectPromptKey).then(() => {
|
||||
// Do hover over the starting selection option
|
||||
if (fullOptions[0].onHover) {
|
||||
fullOptions[0].onHover();
|
||||
}
|
||||
globalScene.ui.setMode(Mode.OPTION_SELECT, config);
|
||||
globalScene.ui.setMode(UiMode.OPTION_SELECT, config);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -694,7 +694,7 @@ export function selectOptionThenPokemon(
|
|||
const selectPokemonAfterOption = (selectedOptionIndex: number) => {
|
||||
// Open party screen to choose a Pokemon
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.SELECT,
|
||||
-1,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { PlayerGender } from "#enums/player-gender";
|
|||
import { addPokeballCaptureStars, addPokeballOpenParticles } from "#app/field/anims";
|
||||
import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Species } from "#enums/species";
|
||||
|
@ -714,7 +714,7 @@ export async function catchPokemon(
|
|||
() => {
|
||||
globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
const newPokemon = globalScene.addPlayerPokemon(
|
||||
pokemon.species,
|
||||
|
@ -729,12 +729,12 @@ export async function catchPokemon(
|
|||
pokemon,
|
||||
);
|
||||
globalScene.ui.setMode(
|
||||
Mode.SUMMARY,
|
||||
UiMode.SUMMARY,
|
||||
newPokemon,
|
||||
0,
|
||||
SummaryUiMode.DEFAULT,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
|
@ -749,13 +749,13 @@ export async function catchPokemon(
|
|||
female: pokemon.gender === Gender.FEMALE,
|
||||
};
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.POKEDEX_PAGE,
|
||||
UiMode.POKEDEX_PAGE,
|
||||
pokemon.species,
|
||||
pokemon.formIndex,
|
||||
attributes,
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
|
@ -763,11 +763,11 @@ export async function catchPokemon(
|
|||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.RELEASE,
|
||||
0,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (slotIndex < 6) {
|
||||
addToParty(slotIndex);
|
||||
} else {
|
||||
|
@ -778,7 +778,7 @@ export async function catchPokemon(
|
|||
);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
removePokemon();
|
||||
end();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
export enum UiMode {
|
||||
MESSAGE,
|
||||
TITLE,
|
||||
COMMAND,
|
||||
FIGHT,
|
||||
BALL,
|
||||
TARGET_SELECT,
|
||||
MODIFIER_SELECT,
|
||||
SAVE_SLOT,
|
||||
PARTY,
|
||||
SUMMARY,
|
||||
STARTER_SELECT,
|
||||
EVOLUTION_SCENE,
|
||||
EGG_HATCH_SCENE,
|
||||
EGG_HATCH_SUMMARY,
|
||||
CONFIRM,
|
||||
OPTION_SELECT,
|
||||
MENU,
|
||||
MENU_OPTION_SELECT,
|
||||
SETTINGS,
|
||||
SETTINGS_DISPLAY,
|
||||
SETTINGS_AUDIO,
|
||||
SETTINGS_GAMEPAD,
|
||||
GAMEPAD_BINDING,
|
||||
SETTINGS_KEYBOARD,
|
||||
KEYBOARD_BINDING,
|
||||
ACHIEVEMENTS,
|
||||
GAME_STATS,
|
||||
EGG_LIST,
|
||||
EGG_GACHA,
|
||||
POKEDEX,
|
||||
POKEDEX_SCAN,
|
||||
POKEDEX_PAGE,
|
||||
LOGIN_FORM,
|
||||
REGISTRATION_FORM,
|
||||
LOADING,
|
||||
SESSION_RELOAD,
|
||||
UNAVAILABLE,
|
||||
CHALLENGE_SELECT,
|
||||
RENAME_POKEMON,
|
||||
RUN_HISTORY,
|
||||
RUN_INFO,
|
||||
TEST_DIALOGUE,
|
||||
AUTO_COMPLETE,
|
||||
ADMIN,
|
||||
MYSTERY_ENCOUNTER
|
||||
}
|
|
@ -192,7 +192,7 @@ import {
|
|||
import { allAbilities } from "#app/data/data-lists";
|
||||
import type PokemonData from "#app/system/pokemon-data";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
|
@ -6562,7 +6562,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
this.leaveField(switchType === SwitchType.SWITCH);
|
||||
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.FAINT_SWITCH,
|
||||
this.getFieldIndex(),
|
||||
(slotIndex: number, option: PartyOption) => {
|
||||
|
@ -6580,7 +6580,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
MoveEndPhase,
|
||||
);
|
||||
}
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(resolve);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(resolve);
|
||||
},
|
||||
PartyUiHandler.FilterNonFainted,
|
||||
);
|
||||
|
|
|
@ -5,7 +5,7 @@ import pad_unlicensedSNES from "./configs/inputs/pad_unlicensedSNES";
|
|||
import pad_xbox360 from "./configs/inputs/pad_xbox360";
|
||||
import pad_dualshock from "./configs/inputs/pad_dualshock";
|
||||
import pad_procon from "./configs/inputs/pad_procon";
|
||||
import { Mode } from "./ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type SettingsGamepadUiHandler from "./ui/settings/settings-gamepad-ui-handler";
|
||||
import type SettingsKeyboardUiHandler from "./ui/settings/settings-keyboard-ui-handler";
|
||||
import cfg_keyboard_qwerty from "./configs/inputs/cfg_keyboard_qwerty";
|
||||
|
@ -235,7 +235,7 @@ export class InputsController {
|
|||
if (gamepadName) {
|
||||
this.selectedDevice[Device.GAMEPAD] = gamepadName.toLowerCase();
|
||||
}
|
||||
const handler = globalScene.ui?.handlers[Mode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
const handler = globalScene.ui?.handlers[UiMode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
handler?.updateChosenGamepadDisplay();
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ export class InputsController {
|
|||
if (layoutKeyboard) {
|
||||
this.selectedDevice[Device.KEYBOARD] = layoutKeyboard.toLowerCase();
|
||||
}
|
||||
const handler = globalScene.ui?.handlers[Mode.SETTINGS_KEYBOARD] as SettingsKeyboardUiHandler;
|
||||
const handler = globalScene.ui?.handlers[UiMode.SETTINGS_KEYBOARD] as SettingsKeyboardUiHandler;
|
||||
handler?.updateChosenKeyboardDisplay();
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ export class InputsController {
|
|||
globalScene.gameData?.saveMappingConfigs(gamepadID, this.configs[gamepadID]);
|
||||
}
|
||||
this.lastSource = "gamepad";
|
||||
const handler = globalScene.ui?.handlers[Mode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
const handler = globalScene.ui?.handlers[UiMode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
handler?.updateChosenGamepadDisplay();
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ export class InputsController {
|
|||
this.lastSource = "gamepad";
|
||||
if (
|
||||
!this.selectedDevice[Device.GAMEPAD] ||
|
||||
(globalScene.ui.getMode() !== Mode.GAMEPAD_BINDING &&
|
||||
(globalScene.ui.getMode() !== UiMode.GAMEPAD_BINDING &&
|
||||
this.selectedDevice[Device.GAMEPAD] !== pad.id.toLowerCase())
|
||||
) {
|
||||
this.setChosenGamepad(pad.id);
|
||||
|
|
|
@ -19,7 +19,7 @@ import { achvs } from "#app/system/achv";
|
|||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { PokeballType } from "#enums/pokeball";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import i18next from "i18next";
|
||||
|
@ -295,7 +295,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
() => {
|
||||
globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
const newPokemon = globalScene.addPlayerPokemon(
|
||||
pokemon.species,
|
||||
|
@ -310,12 +310,12 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
pokemon,
|
||||
);
|
||||
globalScene.ui.setMode(
|
||||
Mode.SUMMARY,
|
||||
UiMode.SUMMARY,
|
||||
newPokemon,
|
||||
0,
|
||||
SummaryUiMode.DEFAULT,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
|
@ -329,19 +329,26 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
form: pokemon.formIndex,
|
||||
female: pokemon.gender === Gender.FEMALE,
|
||||
};
|
||||
globalScene.ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes, null, null, () => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
});
|
||||
globalScene.ui.setOverlayMode(
|
||||
UiMode.POKEDEX_PAGE,
|
||||
pokemon.species,
|
||||
attributes,
|
||||
null,
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.RELEASE,
|
||||
this.fieldIndex,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (slotIndex < 6) {
|
||||
addToParty(slotIndex);
|
||||
} else {
|
||||
|
@ -352,7 +359,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
removePokemon();
|
||||
end();
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import { BattleStyle } from "#app/enums/battle-style";
|
||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
import { SummonMissingPhase } from "./summon-missing-phase";
|
||||
|
@ -64,14 +64,14 @@ export class CheckSwitchPhase extends BattlePhase {
|
|||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.unshiftPhase(new SwitchPhase(SwitchType.INITIAL_SWITCH, this.fieldIndex, false, true));
|
||||
this.end();
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
this.end();
|
||||
},
|
||||
);
|
||||
|
|
|
@ -15,7 +15,7 @@ import type { PlayerPokemon, TurnMove } from "#app/field/pokemon";
|
|||
import { FieldPosition } from "#app/field/pokemon";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { FieldPhase } from "./field-phase";
|
||||
import { SelectTargetPhase } from "./select-target-phase";
|
||||
|
@ -38,7 +38,7 @@ export class CommandPhase extends FieldPhase {
|
|||
|
||||
globalScene.updateGameInfo();
|
||||
|
||||
const commandUiHandler = globalScene.ui.handlers[Mode.COMMAND];
|
||||
const commandUiHandler = globalScene.ui.handlers[UiMode.COMMAND];
|
||||
|
||||
// If one of these conditions is true, we always reset the cursor to Command.FIGHT
|
||||
const cursorResetEvent =
|
||||
|
@ -127,7 +127,7 @@ export class CommandPhase extends FieldPhase {
|
|||
) {
|
||||
this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, queuedMove);
|
||||
} else {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -136,9 +136,9 @@ export class CommandPhase extends FieldPhase {
|
|||
globalScene.currentBattle.mysteryEncounter?.skipToFightInput
|
||||
) {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex);
|
||||
} else {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ export class CommandPhase extends FieldPhase {
|
|||
success = true;
|
||||
} else if (cursor < playerPokemon.getMoveset().length) {
|
||||
const move = playerPokemon.getMoveset()[cursor];
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
|
||||
// Decides between a Disabled, Not Implemented, or No PP translation message
|
||||
const errorMessage = playerPokemon.isMoveRestricted(move.moveId, playerPokemon)
|
||||
|
@ -226,7 +226,7 @@ export class CommandPhase extends FieldPhase {
|
|||
null,
|
||||
() => {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -244,27 +244,27 @@ export class CommandPhase extends FieldPhase {
|
|||
globalScene.arena.biomeType === Biome.END &&
|
||||
(!globalScene.gameMode.isClassic || globalScene.gameMode.isFreshStartChallenge() || notInDex)
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballForce"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
);
|
||||
} else if (globalScene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballTrainer"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -273,14 +273,14 @@ export class CommandPhase extends FieldPhase {
|
|||
globalScene.currentBattle.isBattleMysteryEncounter() &&
|
||||
!globalScene.currentBattle.mysteryEncounter!.catchAllowed
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballMysteryEncounter"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -291,14 +291,14 @@ export class CommandPhase extends FieldPhase {
|
|||
.filter(p => p.isActive(true))
|
||||
.map(p => p.getBattlerIndex());
|
||||
if (targets.length > 1) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballMulti"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -311,14 +311,14 @@ export class CommandPhase extends FieldPhase {
|
|||
!targetPokemon?.hasAbility(Abilities.WONDER_GUARD, false, true) &&
|
||||
cursor < PokeballType.MASTER_BALL
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballStrong"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -347,14 +347,14 @@ export class CommandPhase extends FieldPhase {
|
|||
(arena.biomeType === Biome.END ||
|
||||
(!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed))
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noEscapeForce"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -364,14 +364,14 @@ export class CommandPhase extends FieldPhase {
|
|||
(currentBattle.battleType === BattleType.TRAINER ||
|
||||
currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE)
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noEscapeTrainer"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -389,7 +389,7 @@ export class CommandPhase extends FieldPhase {
|
|||
}
|
||||
} else if (trappedAbMessages.length > 0) {
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
}
|
||||
globalScene.ui.showText(
|
||||
trappedAbMessages[0],
|
||||
|
@ -397,7 +397,7 @@ export class CommandPhase extends FieldPhase {
|
|||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
},
|
||||
null,
|
||||
|
@ -412,8 +412,8 @@ export class CommandPhase extends FieldPhase {
|
|||
break;
|
||||
}
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
}
|
||||
const showNoEscapeText = (tag: any) => {
|
||||
globalScene.ui.showText(
|
||||
|
@ -429,7 +429,7 @@ export class CommandPhase extends FieldPhase {
|
|||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
},
|
||||
null,
|
||||
|
@ -471,6 +471,6 @@ export class CommandPhase extends FieldPhase {
|
|||
}
|
||||
|
||||
end() {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { achvs } from "#app/system/achv";
|
|||
import EggCounterContainer from "#app/ui/egg-counter-container";
|
||||
import type EggHatchSceneHandler from "#app/ui/egg-hatch-scene-handler";
|
||||
import PokemonInfoContainer from "#app/ui/pokemon-info-container";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
import { fixedInt, getFrameMs, randInt } from "#app/utils";
|
||||
|
@ -76,7 +76,7 @@ export class EggHatchPhase extends Phase {
|
|||
start() {
|
||||
super.start();
|
||||
|
||||
globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SCENE).then(() => {
|
||||
globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SCENE).then(() => {
|
||||
if (!this.egg) {
|
||||
return this.end();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Phase } from "#app/phase";
|
|||
import i18next from "i18next";
|
||||
import Overrides from "#app/overrides";
|
||||
import { EggHatchPhase } from "./egg-hatch-phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { EggSummaryPhase } from "./egg-summary-phase";
|
||||
|
@ -41,7 +41,7 @@ export class EggLapsePhase extends Phase {
|
|||
0,
|
||||
);
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
this.hatchEggsSkipped(eggsToHatch);
|
||||
this.showSummary();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { EggHatchData } from "#app/data/egg-hatch-data";
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ export class EggSummaryPhase extends Phase {
|
|||
// updates next pokemon once the current update has been completed
|
||||
const updateNextPokemon = (i: number) => {
|
||||
if (i >= this.eggHatchData.length) {
|
||||
globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
||||
globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
||||
globalScene.fadeOutBgm(undefined, false);
|
||||
});
|
||||
} else {
|
||||
|
@ -39,7 +39,7 @@ export class EggSummaryPhase extends Phase {
|
|||
|
||||
end() {
|
||||
globalScene.time.delayedCall(250, () => globalScene.setModifiersVisible(true));
|
||||
globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => {
|
||||
super.end();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import { SummonPhase } from "#app/phases/summon-phase";
|
|||
import { ToggleDoublePositionPhase } from "#app/phases/toggle-double-position-phase";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { handleTutorial, Tutorial } from "#app/tutorial";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { Biome } from "#enums/biome";
|
||||
|
@ -297,7 +297,7 @@ export class EncounterPhase extends BattlePhase {
|
|||
globalScene.currentBattle.trainer!.genAI(globalScene.getEnemyParty());
|
||||
}
|
||||
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (!this.loaded) {
|
||||
this.trySetWeatherIfNewBiome(); // Set weather before session gets saved
|
||||
// Game syncs to server on waves X1 and X6 (As of 1.2.0)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export class EndEvolutionPhase extends Phase {
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => this.end());
|
||||
globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => this.end());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions"
|
|||
import { FusionSpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||
import type EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||
import { fixedInt, getFrameMs, randInt } from "#app/utils";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { cos, sin } from "#app/field/anims";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
|
@ -53,7 +53,7 @@ export class EvolutionPhase extends Phase {
|
|||
}
|
||||
|
||||
setMode(): Promise<void> {
|
||||
return globalScene.ui.setModeForceTransition(Mode.EVOLUTION_SCENE);
|
||||
return globalScene.ui.setModeForceTransition(UiMode.EVOLUTION_SCENE);
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -280,7 +280,7 @@ export class EvolutionPhase extends Phase {
|
|||
this.end();
|
||||
};
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.revertMode();
|
||||
this.pokemon.pauseEvolutions = true;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { achvs } from "../system/achv";
|
|||
import type { SpeciesFormChange } from "../data/pokemon-forms";
|
||||
import { getSpeciesFormChangeMessage } from "../data/pokemon-forms";
|
||||
import type { PlayerPokemon } from "../field/pokemon";
|
||||
import { Mode } from "../ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type PartyUiHandler from "../ui/party-ui-handler";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
import { EndEvolutionPhase } from "./end-evolution-phase";
|
||||
|
@ -31,7 +31,7 @@ export class FormChangePhase extends EvolutionPhase {
|
|||
if (!this.modal) {
|
||||
return super.setMode();
|
||||
}
|
||||
return globalScene.ui.setOverlayMode(Mode.EVOLUTION_SCENE);
|
||||
return globalScene.ui.setOverlayMode(UiMode.EVOLUTION_SCENE);
|
||||
}
|
||||
|
||||
doEvolution(): void {
|
||||
|
@ -181,7 +181,7 @@ export class FormChangePhase extends EvolutionPhase {
|
|||
this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED);
|
||||
if (this.modal) {
|
||||
globalScene.ui.revertMode().then(() => {
|
||||
if (globalScene.ui.getMode() === Mode.PARTY) {
|
||||
if (globalScene.ui.getMode() === UiMode.PARTY) {
|
||||
const partyUiHandler = globalScene.ui.getHandler() as PartyUiHandler;
|
||||
partyUiHandler.clearPartySlots();
|
||||
partyUiHandler.populatePartySlots();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
||||
|
||||
|
@ -10,7 +10,7 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase {
|
|||
globalScene.addModifier(newModifier);
|
||||
// Sound loaded into game as is
|
||||
globalScene.playSound("level_up_fanfare");
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.fadeIn(250).then(() => {
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:rewardGain", {
|
||||
|
|
|
@ -19,7 +19,7 @@ import { SummonPhase } from "#app/phases/summon-phase";
|
|||
import { UnlockPhase } from "#app/phases/unlock-phase";
|
||||
import { achvs, ChallengeAchv } from "#app/system/achv";
|
||||
import { Unlockables } from "#app/system/unlockables";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { isLocal, isLocalServerConnected } from "#app/utils";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
|
@ -78,7 +78,7 @@ export class GameOverPhase extends BattlePhase {
|
|||
} else {
|
||||
globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.fadeOut(1250).then(() => {
|
||||
globalScene.reset();
|
||||
|
|
|
@ -8,7 +8,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
|||
import Overrides from "#app/overrides";
|
||||
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
|
@ -25,7 +25,7 @@ export enum LearnMoveType {
|
|||
|
||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||
private moveId: Moves;
|
||||
private messageMode: Mode;
|
||||
private messageMode: UiMode;
|
||||
private learnMoveType: LearnMoveType;
|
||||
private cost: number;
|
||||
|
||||
|
@ -55,7 +55,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
}
|
||||
|
||||
this.messageMode =
|
||||
globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? Mode.EVOLUTION_SCENE : Mode.MESSAGE;
|
||||
globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? UiMode.EVOLUTION_SCENE : UiMode.MESSAGE;
|
||||
globalScene.ui.setMode(this.messageMode);
|
||||
// If the Pokemon has less than 4 moves, the new move is added to the largest empty moveset index
|
||||
// If it has 4 moves, the phase then checks if the player wants to replace the move itself.
|
||||
|
@ -90,7 +90,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
await globalScene.ui.showTextPromise(preQText);
|
||||
await globalScene.ui.showTextPromise(shouldReplaceQ, undefined, false);
|
||||
await globalScene.ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => this.forgetMoveProcess(move, pokemon), // Yes
|
||||
() => {
|
||||
// No
|
||||
|
@ -115,7 +115,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
globalScene.ui.setMode(this.messageMode);
|
||||
await globalScene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true);
|
||||
await globalScene.ui.setModeWithoutClear(
|
||||
Mode.SUMMARY,
|
||||
UiMode.SUMMARY,
|
||||
pokemon,
|
||||
SummaryUiMode.LEARN_MOVE,
|
||||
move,
|
||||
|
@ -153,7 +153,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
false,
|
||||
);
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.setMode(this.messageMode);
|
||||
globalScene.ui
|
||||
|
@ -228,7 +228,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeMoveLearnedTrigger, true);
|
||||
this.end();
|
||||
},
|
||||
this.messageMode === Mode.EVOLUTION_SCENE ? 1000 : undefined,
|
||||
this.messageMode === UiMode.EVOLUTION_SCENE ? 1000 : undefined,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { FieldPhase } from "./field-phase";
|
||||
|
||||
|
@ -7,7 +7,7 @@ export class LevelCapPhase extends FieldPhase {
|
|||
start(): void {
|
||||
super.start();
|
||||
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
// Sound loaded into game as is
|
||||
globalScene.playSound("level_up_fanfare");
|
||||
globalScene.ui.showText(
|
||||
|
|
|
@ -3,7 +3,7 @@ import { bypassLogin } from "#app/battle-scene";
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { handleTutorial, Tutorial } from "#app/tutorial";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next, { t } from "i18next";
|
||||
import { getCookie, sessionIdKey, executeIf, removeCookie } from "#app/utils";
|
||||
import { SelectGenderPhase } from "./select-gender-phase";
|
||||
|
@ -23,7 +23,7 @@ export class LoginPhase extends Phase {
|
|||
|
||||
const hasSession = !!getCookie(sessionIdKey);
|
||||
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
executeIf(bypassLogin || hasSession, updateUserInfo).then(response => {
|
||||
const success = response ? response[0] : false;
|
||||
const statusCode = response ? response[1] : null;
|
||||
|
@ -46,7 +46,7 @@ export class LoginPhase extends Phase {
|
|||
});
|
||||
};
|
||||
|
||||
globalScene.ui.setMode(Mode.LOGIN_FORM, {
|
||||
globalScene.ui.setMode(UiMode.LOGIN_FORM, {
|
||||
buttonActions: [
|
||||
() => {
|
||||
globalScene.ui.playSelect();
|
||||
|
@ -54,7 +54,7 @@ export class LoginPhase extends Phase {
|
|||
},
|
||||
() => {
|
||||
globalScene.playSound("menu_open");
|
||||
globalScene.ui.setMode(Mode.REGISTRATION_FORM, {
|
||||
globalScene.ui.setMode(UiMode.REGISTRATION_FORM, {
|
||||
buttonActions: [
|
||||
() => {
|
||||
globalScene.ui.playSelect();
|
||||
|
@ -101,7 +101,7 @@ export class LoginPhase extends Phase {
|
|||
if (success || bypassLogin) {
|
||||
this.end();
|
||||
} else {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(t("menu:failedToLoadSaveData"));
|
||||
}
|
||||
});
|
||||
|
@ -109,7 +109,7 @@ export class LoginPhase extends Phase {
|
|||
}
|
||||
|
||||
end(): void {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
|
||||
if (!globalScene.gameData.gender) {
|
||||
globalScene.unshiftPhase(new SelectGenderPhase());
|
||||
|
|
|
@ -25,7 +25,7 @@ import { transitionMysteryEncounterIntroVisuals } from "../data/mystery-encounte
|
|||
import { TrainerSlot } from "#enums/trainer-slot";
|
||||
import { IvScannerModifier } from "../modifier/modifier";
|
||||
import { Phase } from "../phase";
|
||||
import { Mode } from "../ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { isNullOrUndefined, randSeedItem } from "#app/utils";
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ export class MysteryEncounterPhase extends Phase {
|
|||
}
|
||||
|
||||
// Initiates encounter dialogue window and option select
|
||||
globalScene.ui.setMode(Mode.MYSTERY_ENCOUNTER, this.optionSelectSettings);
|
||||
globalScene.ui.setMode(UiMode.MYSTERY_ENCOUNTER, this.optionSelectSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ export class MysteryEncounterPhase extends Phase {
|
|||
const optionSelectDialogue = globalScene.currentBattle?.mysteryEncounter?.selectedOption?.dialogue;
|
||||
if (optionSelectDialogue?.selected && optionSelectDialogue.selected.length > 0) {
|
||||
// Handle intermediate dialogue (between player selection event and the onOptionSelect logic)
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
const selectedDialogue = optionSelectDialogue.selected;
|
||||
let i = 0;
|
||||
const showNextDialogue = () => {
|
||||
|
@ -167,7 +167,7 @@ export class MysteryEncounterPhase extends Phase {
|
|||
* Ends phase
|
||||
*/
|
||||
end() {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ export class PostMysteryEncounterPhase extends Phase {
|
|||
}
|
||||
|
||||
i++;
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
if (title) {
|
||||
globalScene.ui.showDialogue(
|
||||
text ?? "",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { fixedInt } from "#app/utils";
|
||||
|
||||
export class ReloadSessionPhase extends Phase {
|
||||
|
@ -13,7 +13,7 @@ export class ReloadSessionPhase extends Phase {
|
|||
}
|
||||
|
||||
start(): void {
|
||||
globalScene.ui.setMode(Mode.SESSION_RELOAD);
|
||||
globalScene.ui.setMode(UiMode.SESSION_RELOAD);
|
||||
|
||||
let delayElapsed = false;
|
||||
let loaded = false;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { SwitchType } from "#enums/switch-type";
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { toDmgValue, isNullOrUndefined } from "#app/utils";
|
||||
import { BattlePhase } from "#app/phases/battle-phase";
|
||||
|
@ -21,7 +21,7 @@ export class RevivalBlessingPhase extends BattlePhase {
|
|||
|
||||
public override start(): void {
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.REVIVAL_BLESSING,
|
||||
this.user.getFieldIndex(),
|
||||
(slotIndex: integer, _option: PartyOption) => {
|
||||
|
@ -63,7 +63,7 @@ export class RevivalBlessingPhase extends BattlePhase {
|
|||
}
|
||||
}
|
||||
}
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => this.end());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => this.end());
|
||||
},
|
||||
PartyUiHandler.FilterFainted,
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import type { ModifierTypeFunc } from "#app/modifier/modifier-type";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
||||
|
||||
|
@ -19,7 +19,7 @@ export class RibbonModifierRewardPhase extends ModifierRewardPhase {
|
|||
const newModifier = this.modifierType.newModifier();
|
||||
globalScene.addModifier(newModifier);
|
||||
globalScene.playSound("level_up_fanfare");
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:beatModeFirstTime", {
|
||||
speciesName: this.species.name,
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { BattlerIndex } from "#app/battle";
|
|||
import { PERMANENT_STATS, Stat } from "#app/enums/stat";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { getTextColor, TextStyle } from "#app/ui/text";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
|
||||
|
@ -51,9 +51,9 @@ export class ScanIvsPhase extends PokemonPhase {
|
|||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui
|
||||
.getMessageHandler()
|
||||
|
@ -61,7 +61,7 @@ export class ScanIvsPhase extends PokemonPhase {
|
|||
.then(() => this.end());
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.clearText();
|
||||
this.end();
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ import { biomeLinks, getBiomeName } from "#app/data/balance/biomes";
|
|||
import { Biome } from "#app/enums/biome";
|
||||
import { MoneyInterestModifier, MapModifier } from "#app/modifier/modifier";
|
||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { PartyHealPhase } from "./party-heal-phase";
|
||||
|
@ -42,14 +42,14 @@ export class SelectBiomePhase extends BattlePhase {
|
|||
const ret: OptionSelectItem = {
|
||||
label: getBiomeName(b),
|
||||
handler: () => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
setNextBiome(b);
|
||||
return true;
|
||||
},
|
||||
};
|
||||
return ret;
|
||||
});
|
||||
globalScene.ui.setMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setMode(UiMode.OPTION_SELECT, {
|
||||
options: biomeSelectItems,
|
||||
delay: 1000,
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export class SelectChallengePhase extends Phase {
|
||||
start() {
|
||||
|
@ -8,6 +8,6 @@ export class SelectChallengePhase extends Phase {
|
|||
|
||||
globalScene.playBgm("menu");
|
||||
|
||||
globalScene.ui.setMode(Mode.CHALLENGE_SELECT);
|
||||
globalScene.ui.setMode(UiMode.CHALLENGE_SELECT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import { PlayerGender } from "#app/enums/player-gender";
|
||||
import { Phase } from "#app/phase";
|
||||
import { SettingKeys } from "#app/system/settings/settings";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
|
||||
export class SelectGenderPhase extends Phase {
|
||||
|
@ -10,7 +10,7 @@ export class SelectGenderPhase extends Phase {
|
|||
super.start();
|
||||
|
||||
globalScene.ui.showText(i18next.t("menu:boyOrGirl"), null, () => {
|
||||
globalScene.ui.setMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setMode(UiMode.OPTION_SELECT, {
|
||||
options: [
|
||||
{
|
||||
label: i18next.t("settings:boy"),
|
||||
|
@ -36,7 +36,7 @@ export class SelectGenderPhase extends Phase {
|
|||
}
|
||||
|
||||
end(): void {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
super.end();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import {
|
|||
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||
import { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler";
|
||||
import PartyUiHandler, { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
import Overrides from "#app/overrides";
|
||||
|
@ -92,15 +92,15 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
if (rowCursor < 0 || cursor < 0) {
|
||||
globalScene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.revertMode();
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
super.end();
|
||||
},
|
||||
() =>
|
||||
globalScene.ui.setMode(
|
||||
Mode.MODIFIER_SELECT,
|
||||
UiMode.MODIFIER_SELECT,
|
||||
this.isPlayer(),
|
||||
this.typeOptions,
|
||||
modifierSelectCallback,
|
||||
|
@ -129,7 +129,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
),
|
||||
);
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||
globalScene.money -= rerollCost;
|
||||
globalScene.updateMoneyText();
|
||||
|
@ -139,7 +139,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
break;
|
||||
case 1:
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.MODIFIER_TRANSFER,
|
||||
-1,
|
||||
(fromSlotIndex: number, itemIndex: number, itemQuantity: number, toSlotIndex: number) => {
|
||||
|
@ -168,7 +168,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
);
|
||||
} else {
|
||||
globalScene.ui.setMode(
|
||||
Mode.MODIFIER_SELECT,
|
||||
UiMode.MODIFIER_SELECT,
|
||||
this.isPlayer(),
|
||||
this.typeOptions,
|
||||
modifierSelectCallback,
|
||||
|
@ -180,9 +180,9 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
);
|
||||
break;
|
||||
case 2:
|
||||
globalScene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||
globalScene.ui.setModeWithoutClear(UiMode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.MODIFIER_SELECT,
|
||||
UiMode.MODIFIER_SELECT,
|
||||
this.isPlayer(),
|
||||
this.typeOptions,
|
||||
modifierSelectCallback,
|
||||
|
@ -207,7 +207,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
case 1:
|
||||
if (this.typeOptions.length === 0) {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
super.end();
|
||||
return true;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
}
|
||||
} else {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
super.end();
|
||||
}
|
||||
};
|
||||
|
@ -272,7 +272,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
//TODO: is the bang correct?
|
||||
if (modifierType instanceof FusePokemonModifierType) {
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.SPLICE,
|
||||
-1,
|
||||
(fromSlotIndex: number, spliceSlotIndex: number) => {
|
||||
|
@ -282,13 +282,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
spliceSlotIndex < 6 &&
|
||||
fromSlotIndex !== spliceSlotIndex
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex])!; //TODO: is the bang correct?
|
||||
applyModifier(modifier, true);
|
||||
});
|
||||
} else {
|
||||
globalScene.ui.setMode(
|
||||
Mode.MODIFIER_SELECT,
|
||||
UiMode.MODIFIER_SELECT,
|
||||
this.isPlayer(),
|
||||
this.typeOptions,
|
||||
modifierSelectCallback,
|
||||
|
@ -314,12 +314,12 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
: PartyUiMode.MODIFIER;
|
||||
const tmMoveId = isTmModifier ? (modifierType as TmModifierType).moveId : undefined;
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
partyUiMode,
|
||||
-1,
|
||||
(slotIndex: number, option: PartyOption) => {
|
||||
if (slotIndex < 6) {
|
||||
globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
const modifier = !isMoveModifier
|
||||
? !isRememberMoveModifier
|
||||
? modifierType.newModifier(party[slotIndex])
|
||||
|
@ -329,7 +329,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
});
|
||||
} else {
|
||||
globalScene.ui.setMode(
|
||||
Mode.MODIFIER_SELECT,
|
||||
UiMode.MODIFIER_SELECT,
|
||||
this.isPlayer(),
|
||||
this.typeOptions,
|
||||
modifierSelectCallback,
|
||||
|
@ -352,7 +352,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
return !cost!; // TODO: is the bang correct?
|
||||
};
|
||||
globalScene.ui.setMode(
|
||||
Mode.MODIFIER_SELECT,
|
||||
UiMode.MODIFIER_SELECT,
|
||||
this.isPlayer(),
|
||||
this.typeOptions,
|
||||
modifierSelectCallback,
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Phase } from "#app/phase";
|
|||
import { TitlePhase } from "#app/phases/title-phase";
|
||||
import { SaveSlotUiMode } from "#app/ui/save-slot-select-ui-handler";
|
||||
import type { Starter } from "#app/ui/starter-select-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { Species } from "#enums/species";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
|
@ -20,9 +20,9 @@ export class SelectStarterPhase extends Phase {
|
|||
|
||||
globalScene.playBgm("menu");
|
||||
|
||||
globalScene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
||||
globalScene.ui.setMode(UiMode.STARTER_SELECT, (starters: Starter[]) => {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||
globalScene.ui.setMode(UiMode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||
if (slotId === -1) {
|
||||
globalScene.clearPhaseQueue();
|
||||
globalScene.pushPhase(new TitlePhase());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { BattlerIndex } from "#app/battle";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { CommandPhase } from "./command-phase";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
|
@ -18,8 +18,8 @@ export class SelectTargetPhase extends PokemonPhase {
|
|||
|
||||
const turnCommand = globalScene.currentBattle.turnCommands[this.fieldIndex];
|
||||
const move = turnCommand?.move?.move;
|
||||
globalScene.ui.setMode(Mode.TARGET_SELECT, this.fieldIndex, move, (targets: BattlerIndex[]) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.TARGET_SELECT, this.fieldIndex, move, (targets: BattlerIndex[]) => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
const fieldSide = globalScene.getField();
|
||||
const user = fieldSide[this.fieldIndex];
|
||||
const moveObject = allMoves[move!];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import PartyUiHandler, { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { SwitchType } from "#enums/switch-type";
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
import { PostSummonPhase } from "./post-summon-phase";
|
||||
|
@ -69,7 +69,7 @@ export class SwitchPhase extends BattlePhase {
|
|||
: 0;
|
||||
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
this.isModal ? PartyUiMode.FAINT_SWITCH : PartyUiMode.POST_BATTLE_SWITCH,
|
||||
fieldIndex,
|
||||
(slotIndex: number, option: PartyOption) => {
|
||||
|
@ -80,7 +80,7 @@ export class SwitchPhase extends BattlePhase {
|
|||
const switchType = option === PartyOption.PASS_BATON ? SwitchType.BATON_PASS : this.switchType;
|
||||
globalScene.unshiftPhase(new SwitchSummonPhase(switchType, fieldIndex, slotIndex, this.doReturn));
|
||||
}
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
||||
},
|
||||
PartyUiHandler.FilterNonFainted,
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ import { Unlockables } from "#app/system/unlockables";
|
|||
import { vouchers } from "#app/system/voucher";
|
||||
import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { SaveSlotUiMode } from "#app/ui/save-slot-select-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#app/utils";
|
||||
import i18next from "i18next";
|
||||
import { CheckSwitchPhase } from "./check-switch-phase";
|
||||
|
@ -75,7 +75,7 @@ export class TitlePhase extends Phase {
|
|||
handler: () => {
|
||||
const setModeAndEnd = (gameMode: GameModes) => {
|
||||
this.gameMode = gameMode;
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.clearText();
|
||||
this.end();
|
||||
};
|
||||
|
@ -130,7 +130,7 @@ export class TitlePhase extends Phase {
|
|||
},
|
||||
});
|
||||
globalScene.ui.showText(i18next.t("menu:selectGameMode"), null, () =>
|
||||
globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
}),
|
||||
);
|
||||
|
@ -140,7 +140,7 @@ export class TitlePhase extends Phase {
|
|||
{
|
||||
label: i18next.t("menu:loadGame"),
|
||||
handler: () => {
|
||||
globalScene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD, (slotId: number) => {
|
||||
globalScene.ui.setOverlayMode(UiMode.SAVE_SLOT, SaveSlotUiMode.LOAD, (slotId: number) => {
|
||||
if (slotId === -1) {
|
||||
return this.showOptions();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ export class TitlePhase extends Phase {
|
|||
{
|
||||
label: i18next.t("menu:runHistory"),
|
||||
handler: () => {
|
||||
globalScene.ui.setOverlayMode(Mode.RUN_HISTORY);
|
||||
globalScene.ui.setOverlayMode(UiMode.RUN_HISTORY);
|
||||
return true;
|
||||
},
|
||||
keepOpen: true,
|
||||
|
@ -160,7 +160,7 @@ export class TitlePhase extends Phase {
|
|||
{
|
||||
label: i18next.t("menu:settings"),
|
||||
handler: () => {
|
||||
globalScene.ui.setOverlayMode(Mode.SETTINGS);
|
||||
globalScene.ui.setOverlayMode(UiMode.SETTINGS);
|
||||
return true;
|
||||
},
|
||||
keepOpen: true,
|
||||
|
@ -171,12 +171,12 @@ export class TitlePhase extends Phase {
|
|||
noCancel: true,
|
||||
yOffset: 47,
|
||||
};
|
||||
globalScene.ui.setMode(Mode.TITLE, config);
|
||||
globalScene.ui.setMode(UiMode.TITLE, config);
|
||||
}
|
||||
|
||||
loadSaveSlot(slotId: number): void {
|
||||
globalScene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.resetModeChain();
|
||||
globalScene.gameData
|
||||
.loadSession(slotId, slotId === -1 ? this.lastSessionData : undefined)
|
||||
|
@ -196,7 +196,7 @@ export class TitlePhase extends Phase {
|
|||
|
||||
initDailyRun(): void {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||
globalScene.ui.setMode(UiMode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||
globalScene.clearPhaseQueue();
|
||||
if (slotId === -1) {
|
||||
globalScene.pushPhase(new TitlePhase());
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { LoginPhase } from "./login-phase";
|
||||
|
||||
export class UnavailablePhase extends Phase {
|
||||
start(): void {
|
||||
globalScene.ui.setMode(Mode.UNAVAILABLE, () => {
|
||||
globalScene.ui.setMode(UiMode.UNAVAILABLE, () => {
|
||||
globalScene.unshiftPhase(new LoginPhase(true));
|
||||
this.end();
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import { Phase } from "#app/phase";
|
||||
import type { Unlockables } from "#app/system/unlockables";
|
||||
import { getUnlockableName } from "#app/system/unlockables";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
|
||||
export class UnlockPhase extends Phase {
|
||||
|
@ -19,7 +19,7 @@ export class UnlockPhase extends Phase {
|
|||
globalScene.gameData.unlocks[this.unlockable] = true;
|
||||
// Sound loaded into game as is
|
||||
globalScene.playSound("level_up_fanfare");
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:unlockedSomething", {
|
||||
unlockedThing: getUnlockableName(this.unlockable),
|
||||
|
|
|
@ -24,7 +24,7 @@ import EggData from "#app/system/egg-data";
|
|||
import type { Egg } from "#app/data/egg";
|
||||
import { vouchers, VoucherType } from "#app/system/voucher";
|
||||
import { AES, enc } from "crypto-js";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { clientSessionId, loggedInUser, updateUserInfo } from "#app/account";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { GameStats } from "#app/system/game-stats";
|
||||
|
@ -1430,7 +1430,7 @@ export class GameData {
|
|||
const systemData = useCachedSystem
|
||||
? this.parseSystemData(decrypt(localStorage.getItem(`data_${loggedInUser?.username}`)!, bypassLogin))
|
||||
: this.getSystemSaveData(); // TODO: is this bang correct?
|
||||
|
||||
|
||||
const request = {
|
||||
system: systemData,
|
||||
session: sessionData,
|
||||
|
@ -1604,7 +1604,7 @@ export class GameData {
|
|||
null,
|
||||
() => {
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
localStorage.setItem(dataKey, encrypt(dataStr, bypassLogin));
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type SettingsGamepadUiHandler from "../../ui/settings/settings-gamepad-ui-handler";
|
||||
import { Mode } from "../../ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { truncateString } from "../../utils";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
||||
|
@ -107,7 +107,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole
|
|||
(globalScene.ui.getHandler() as SettingsGamepadUiHandler).updateBindings();
|
||||
return success;
|
||||
};
|
||||
globalScene.ui.setOverlayMode(Mode.GAMEPAD_BINDING, {
|
||||
globalScene.ui.setOverlayMode(UiMode.GAMEPAD_BINDING, {
|
||||
target: setting,
|
||||
cancelHandler: cancelHandler,
|
||||
});
|
||||
|
@ -133,7 +133,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole
|
|||
cancelHandler();
|
||||
return true;
|
||||
};
|
||||
globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, {
|
||||
options: [
|
||||
...gp.map((g: string) => ({
|
||||
label: truncateString(g, 30), // Truncate the gamepad name for display
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Button } from "#enums/buttons";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type SettingsKeyboardUiHandler from "#app/ui/settings/settings-keyboard-ui-handler";
|
||||
import i18next from "i18next";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -174,7 +174,7 @@ export function setSettingKeyboard(setting: SettingKeyboard, value: number): boo
|
|||
(globalScene.ui.getHandler() as SettingsKeyboardUiHandler).updateBindings();
|
||||
return success;
|
||||
};
|
||||
globalScene.ui.setOverlayMode(Mode.KEYBOARD_BINDING, {
|
||||
globalScene.ui.setOverlayMode(UiMode.KEYBOARD_BINDING, {
|
||||
target: setting,
|
||||
cancelHandler: cancelHandler,
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { hasTouchscreen } from "#app/touch-controls";
|
||||
|
@ -906,7 +906,7 @@ export function setSetting(setting: string, value: number): boolean {
|
|||
return false;
|
||||
}
|
||||
};
|
||||
globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, {
|
||||
options: [
|
||||
{
|
||||
label: "English",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import AwaitableUiHandler from "./ui/awaitable-ui-handler";
|
||||
import type UiHandler from "./ui/ui-handler";
|
||||
import { Mode } from "./ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import Overrides from "#app/overrides";
|
||||
|
||||
|
@ -92,13 +92,13 @@ const tutorialHandlers = {
|
|||
},
|
||||
[Tutorial.Select_Item]: () => {
|
||||
return new Promise<void>(resolve => {
|
||||
globalScene.ui.setModeWithoutClear(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setModeWithoutClear(UiMode.MESSAGE).then(() => {
|
||||
globalScene.ui.showText(
|
||||
i18next.t("tutorial:selectItem"),
|
||||
null,
|
||||
() =>
|
||||
globalScene.ui.showText("", null, () =>
|
||||
globalScene.ui.setModeWithoutClear(Mode.MODIFIER_SELECT).then(() => resolve()),
|
||||
globalScene.ui.setModeWithoutClear(UiMode.MODIFIER_SELECT).then(() => resolve()),
|
||||
),
|
||||
null,
|
||||
true,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type Phaser from "phaser";
|
||||
import { Mode } from "./ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { InputsController } from "./inputs-controller";
|
||||
import type MessageUiHandler from "./ui/message-ui-handler";
|
||||
import StarterSelectUiHandler from "./ui/starter-select-ui-handler";
|
||||
|
@ -176,22 +176,22 @@ export class UiInputs {
|
|||
return;
|
||||
}
|
||||
switch (globalScene.ui?.getMode()) {
|
||||
case Mode.MESSAGE:
|
||||
case UiMode.MESSAGE:
|
||||
const messageHandler = globalScene.ui.getHandler<MessageUiHandler>();
|
||||
if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) {
|
||||
return;
|
||||
}
|
||||
case Mode.TITLE:
|
||||
case Mode.COMMAND:
|
||||
case Mode.MODIFIER_SELECT:
|
||||
case Mode.MYSTERY_ENCOUNTER:
|
||||
globalScene.ui.setOverlayMode(Mode.MENU);
|
||||
case UiMode.TITLE:
|
||||
case UiMode.COMMAND:
|
||||
case UiMode.MODIFIER_SELECT:
|
||||
case UiMode.MYSTERY_ENCOUNTER:
|
||||
globalScene.ui.setOverlayMode(UiMode.MENU);
|
||||
break;
|
||||
case Mode.STARTER_SELECT:
|
||||
case Mode.POKEDEX_PAGE:
|
||||
case UiMode.STARTER_SELECT:
|
||||
case UiMode.POKEDEX_PAGE:
|
||||
this.buttonTouch();
|
||||
break;
|
||||
case Mode.MENU:
|
||||
case UiMode.MENU:
|
||||
globalScene.ui.revertMode();
|
||||
globalScene.playSound("ui/select");
|
||||
break;
|
||||
|
@ -227,7 +227,7 @@ export class UiInputs {
|
|||
SettingKeys.Game_Speed,
|
||||
Setting[settingGameSpeed].options.findIndex(item => item.label === `${globalScene.gameSpeed}x`) + 1,
|
||||
);
|
||||
if (globalScene.ui?.getMode() === Mode.SETTINGS) {
|
||||
if (globalScene.ui?.getMode() === UiMode.SETTINGS) {
|
||||
(globalScene.ui.getHandler() as SettingsUiHandler).show([]);
|
||||
}
|
||||
} else if (!up && globalScene.gameSpeed > 1) {
|
||||
|
@ -238,7 +238,7 @@ export class UiInputs {
|
|||
0,
|
||||
),
|
||||
);
|
||||
if (globalScene.ui?.getMode() === Mode.SETTINGS) {
|
||||
if (globalScene.ui?.getMode() === UiMode.SETTINGS) {
|
||||
(globalScene.ui.getHandler() as SettingsUiHandler).show([]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { TextStyle, addBBCodeTextObject, getTextColor, getTextStyleOptions } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import { rgbHexToRgba, fixedInt } from "#app/utils";
|
||||
|
@ -56,7 +56,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
protected defaultTextStyle: TextStyle = TextStyle.WINDOW;
|
||||
protected textContent: string;
|
||||
|
||||
constructor(mode: Mode | null) {
|
||||
constructor(mode: UiMode | null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
const ui = this.getUi();
|
||||
|
||||
this.optionSelectContainer = globalScene.add.container(globalScene.game.canvas.width / 6 - 1, -48);
|
||||
this.optionSelectContainer.setName(`option-select-${this.mode ? Mode[this.mode] : "UNKNOWN"}`);
|
||||
this.optionSelectContainer.setName(`option-select-${this.mode ? UiMode[this.mode] : "UNKNOWN"}`);
|
||||
this.optionSelectContainer.setVisible(false);
|
||||
ui.add(this.optionSelectContainer);
|
||||
|
||||
|
@ -120,7 +120,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
|
||||
// Setting the initial text to establish the width of the select object. We consider all options, even ones that are not displayed,
|
||||
// Except in the case of autocomplete, where we don't want to set up a text element with potentially hundreds of lines.
|
||||
const optionsForWidth = globalScene.ui.getMode() === Mode.AUTO_COMPLETE ? optionsWithScroll : options;
|
||||
const optionsForWidth = globalScene.ui.getMode() === UiMode.AUTO_COMPLETE ? optionsWithScroll : options;
|
||||
this.optionSelectText = addBBCodeTextObject(
|
||||
0,
|
||||
0,
|
||||
|
@ -250,7 +250,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
} else {
|
||||
ui.playError();
|
||||
}
|
||||
} else if (button === Button.SUBMIT && ui.getMode() === Mode.AUTO_COMPLETE) {
|
||||
} else if (button === Button.SUBMIT && ui.getMode() === UiMode.AUTO_COMPLETE) {
|
||||
// this is here to differentiate between a Button.SUBMIT vs Button.ACTION within the autocomplete handler
|
||||
// this is here because Button.ACTION is picked up as z on the keyboard, meaning if you're typing and hit z, it'll select the option you've chosen
|
||||
success = true;
|
||||
|
|
|
@ -6,7 +6,7 @@ import type { Voucher } from "#app/system/voucher";
|
|||
import { getVoucherTypeIcon, getVoucherTypeName, vouchers } from "#app/system/voucher";
|
||||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
import type { Mode } from "#app/ui/ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
import { ScrollBar } from "#app/ui/scroll-bar";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
|
@ -59,7 +59,7 @@ export default class AchvsUiHandler extends MessageUiHandler {
|
|||
private cursorObj: Phaser.GameObjects.NineSlice | null;
|
||||
private currentPage: Page;
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
|
||||
this.achvsTotal = Object.keys(achvs).length;
|
||||
|
|
|
@ -5,7 +5,7 @@ import type { InputFieldConfig } from "./form-modal-ui-handler";
|
|||
import { FormModalUiHandler } from "./form-modal-ui-handler";
|
||||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { TextStyle } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
type AdminUiHandlerService = "discord" | "google";
|
||||
|
@ -30,7 +30,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
|||
return `Username and ${service} successfully ${mode.toLowerCase()}ed`;
|
||||
};
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
@ -143,10 +143,10 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
|||
const adminSearchResult: AdminSearchInfo = this.convertInputsToAdmin(); // this converts the input texts into a single object for use later
|
||||
const validFields = this.areFieldsValid(this.adminMode);
|
||||
if (validFields.error) {
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error
|
||||
return this.showMessage(validFields.errorMessage ?? "", adminSearchResult, true);
|
||||
}
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
if (this.adminMode === AdminMode.LINK) {
|
||||
this.adminLinkUnlink(adminSearchResult, "discord", "Link") // calls server to link discord
|
||||
.then(response => {
|
||||
|
@ -174,7 +174,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
|||
|
||||
showMessage(message: string, adminResult: AdminSearchInfo, isError: boolean) {
|
||||
globalScene.ui.setMode(
|
||||
Mode.ADMIN,
|
||||
UiMode.ADMIN,
|
||||
Object.assign(this.config, { errorMessage: message?.trim() }),
|
||||
this.adminMode,
|
||||
adminResult,
|
||||
|
@ -221,18 +221,18 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
|||
const mode = adminResult[aR] === "" ? "Link" : "Unlink"; // this figures out if we're linking or unlinking a service
|
||||
const validFields = this.areFieldsValid(this.adminMode, service);
|
||||
if (validFields.error) {
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error
|
||||
return this.showMessage(validFields.errorMessage ?? "", adminResult, true);
|
||||
}
|
||||
this.adminLinkUnlink(this.convertInputsToAdmin(), service as AdminUiHandlerService, mode).then(
|
||||
response => {
|
||||
// attempts to link/unlink depending on the service
|
||||
if (response.error) {
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
return this.showMessage(response.errorType, adminResult, true); // fail
|
||||
}
|
||||
// success, reload panel with new results
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
this.adminSearch(adminResult).then(response => {
|
||||
if (response.error) {
|
||||
return this.showMessage(response.errorType, adminResult, true);
|
||||
|
@ -385,7 +385,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
|||
private updateAdminPanelInfo(adminSearchResult: AdminSearchInfo, mode?: AdminMode) {
|
||||
mode = mode ?? AdminMode.ADMIN;
|
||||
globalScene.ui.setMode(
|
||||
Mode.ADMIN,
|
||||
UiMode.ADMIN,
|
||||
{
|
||||
buttonActions: [
|
||||
// we double revert here and below to go back 2 layers of menus
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Button } from "#enums/buttons";
|
||||
import AbstractOptionSelectUiHandler from "./abstact-option-select-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export default class AutoCompleteUiHandler extends AbstractOptionSelectUiHandler {
|
||||
modalContainer: Phaser.GameObjects.Container;
|
||||
constructor(mode: Mode = Mode.OPTION_SELECT) {
|
||||
constructor(mode: UiMode = UiMode.OPTION_SELECT) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -9,7 +9,7 @@ export default abstract class AwaitableUiHandler extends UiHandler {
|
|||
public tutorialActive = false;
|
||||
public tutorialOverlay: Phaser.GameObjects.Rectangle;
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { getPokeballName } from "../data/pokeball";
|
||||
import { addTextObject, getTextStyleOptions, TextStyle } from "./text";
|
||||
import { Command } from "./command-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -18,7 +18,7 @@ export default class BallUiHandler extends UiHandler {
|
|||
private scale = 0.1666666667;
|
||||
|
||||
constructor() {
|
||||
super(Mode.BALL);
|
||||
super(UiMode.BALL);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -82,15 +82,15 @@ export default class BallUiHandler extends UiHandler {
|
|||
if (button === Button.ACTION && this.cursor < pokeballTypeCount) {
|
||||
if (globalScene.pokeballCounts[this.cursor]) {
|
||||
if (commandPhase.handleCommand(Command.BALL, this.cursor)) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, commandPhase.getFieldIndex());
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, commandPhase.getFieldIndex());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
ui.playError();
|
||||
}
|
||||
} else {
|
||||
ui.setMode(Mode.COMMAND, commandPhase.getFieldIndex());
|
||||
ui.setMode(UiMode.COMMAND, commandPhase.getFieldIndex());
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import MessageUiHandler from "./message-ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||
|
@ -23,7 +23,7 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
public readonly wordWrapWidth: number = 1780;
|
||||
|
||||
constructor() {
|
||||
super(Mode.MESSAGE);
|
||||
super(UiMode.MESSAGE);
|
||||
}
|
||||
|
||||
setup(): void {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { TextStyle, addTextObject } from "./text";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -50,7 +50,7 @@ export default class GameChallengesUiHandler extends UiHandler {
|
|||
private readonly leftArrowGap: number = 90; // distance from the label to the left arrow
|
||||
private readonly arrowSpacing: number = 3; // distance between the arrows and the value area
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { addTextObject, TextStyle } from "./text";
|
||||
import PartyUiHandler, { PartyUiMode } from "./party-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import i18next from "i18next";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -30,7 +30,7 @@ export default class CommandUiHandler extends UiHandler {
|
|||
protected cursor2 = 0;
|
||||
|
||||
constructor() {
|
||||
super(Mode.COMMAND);
|
||||
super(UiMode.COMMAND);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -124,18 +124,18 @@ export default class CommandUiHandler extends UiHandler {
|
|||
switch (cursor) {
|
||||
// Fight
|
||||
case Command.FIGHT:
|
||||
ui.setMode(Mode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex());
|
||||
ui.setMode(UiMode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex());
|
||||
success = true;
|
||||
break;
|
||||
// Ball
|
||||
case Command.BALL:
|
||||
ui.setModeWithoutClear(Mode.BALL);
|
||||
ui.setModeWithoutClear(UiMode.BALL);
|
||||
success = true;
|
||||
break;
|
||||
// Pokemon
|
||||
case Command.POKEMON:
|
||||
ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.SWITCH,
|
||||
(globalScene.getCurrentPhase() as CommandPhase).getPokemon().getFieldIndex(),
|
||||
null,
|
||||
|
@ -149,7 +149,7 @@ export default class CommandUiHandler extends UiHandler {
|
|||
success = true;
|
||||
break;
|
||||
case Command.TERA:
|
||||
ui.setMode(Mode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex(), Command.TERA);
|
||||
ui.setMode(UiMode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex(), Command.TERA);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { OptionSelectConfig } from "./abstact-option-select-ui-handler";
|
||||
import AbstractOptionSelectUiHandler from "./abstact-option-select-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -12,7 +12,7 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
|||
private switchCheckCursor: number;
|
||||
|
||||
constructor() {
|
||||
super(Mode.CONFIRM);
|
||||
super(UiMode.CONFIRM);
|
||||
}
|
||||
|
||||
getWindowWidth(): number {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { TextStyle, addTextObject, getEggTierTextTint, getTextStyleOptions } from "./text";
|
||||
import MessageUiHandler from "./message-ui-handler";
|
||||
import { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils";
|
||||
|
@ -41,7 +41,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||
private scale = 0.1666666667;
|
||||
|
||||
constructor() {
|
||||
super(Mode.EGG_GACHA);
|
||||
super(UiMode.EGG_GACHA);
|
||||
|
||||
this.gachaContainers = [];
|
||||
this.gachaKnobs = [];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { EggHatchPhase } from "#app/phases/egg-hatch-phase";
|
||||
|
@ -16,7 +16,7 @@ export default class EggHatchSceneHandler extends UiHandler {
|
|||
public readonly eventTarget: EventTarget = new EventTarget();
|
||||
|
||||
constructor() {
|
||||
super(Mode.EGG_HATCH_SCENE);
|
||||
super(UiMode.EGG_HATCH_SCENE);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
|
||||
import { TextStyle, addTextObject } from "#app/ui/text";
|
||||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
|
@ -29,7 +29,7 @@ export default class EggListUiHandler extends MessageUiHandler {
|
|||
private iconAnimHandler: PokemonIconAnimHandler;
|
||||
|
||||
constructor() {
|
||||
super(Mode.EGG_LIST);
|
||||
super(UiMode.EGG_LIST);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler";
|
||||
import MessageUiHandler from "./message-ui-handler";
|
||||
import { getEggTierForSpecies } from "../data/egg";
|
||||
|
@ -54,7 +54,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
|||
public readonly eventTarget: EventTarget = new EventTarget();
|
||||
|
||||
constructor() {
|
||||
super(Mode.EGG_HATCH_SUMMARY);
|
||||
super(UiMode.EGG_HATCH_SUMMARY);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import MessageUiHandler from "./message-ui-handler";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
|
@ -12,7 +12,7 @@ export default class EvolutionSceneHandler extends MessageUiHandler {
|
|||
public cancelled: boolean;
|
||||
|
||||
constructor() {
|
||||
super(Mode.EVOLUTION_SCENE);
|
||||
super(UiMode.EVOLUTION_SCENE);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { addTextObject, TextStyle } from "./text";
|
|||
import { getTypeDamageMultiplierColor } from "#app/data/type";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { Command } from "./command-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { getLocalizedSpriteKey, fixedInt, padInt } from "#app/utils";
|
||||
import { MoveCategory } from "#enums/MoveCategory";
|
||||
|
@ -37,7 +37,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
|
|||
protected cursor2 = 0;
|
||||
|
||||
constructor() {
|
||||
super(Mode.FIGHT);
|
||||
super(UiMode.FIGHT);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -156,7 +156,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
|
|||
// Cannot back out of fight menu if skipToFightInput is enabled
|
||||
const { battleType, mysteryEncounter } = globalScene.currentBattle;
|
||||
if (battleType !== BattleType.MYSTERY_ENCOUNTER || !mysteryEncounter?.skipToFightInput) {
|
||||
ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
|
|||
!opponent.battleData?.abilityRevealed,
|
||||
undefined,
|
||||
undefined,
|
||||
true
|
||||
true,
|
||||
);
|
||||
if (effectiveness === undefined) {
|
||||
return undefined;
|
||||
|
@ -353,7 +353,14 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
|
|||
|
||||
const moveColors = opponents
|
||||
.map(opponent =>
|
||||
opponent.getMoveEffectiveness(pokemon, pokemonMove.getMove(), !opponent.battleData.abilityRevealed, undefined, undefined, true),
|
||||
opponent.getMoveEffectiveness(
|
||||
pokemon,
|
||||
pokemonMove.getMove(),
|
||||
!opponent.battleData.abilityRevealed,
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
),
|
||||
)
|
||||
.sort((a, b) => b - a)
|
||||
.map(effectiveness => getTypeDamageMultiplierColor(effectiveness ?? 0, "offense"));
|
||||
|
|
|
@ -5,7 +5,7 @@ import { addWindow, WindowVariant } from "./ui-theme";
|
|||
import i18next from "i18next";
|
||||
import type AwaitableUiHandler from "./awaitable-ui-handler";
|
||||
import type UI from "./ui";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
export enum FilterTextRow {
|
||||
|
@ -154,7 +154,7 @@ export class FilterText extends Phaser.GameObjects.Container {
|
|||
this.onChange;
|
||||
},
|
||||
];
|
||||
ui.setOverlayMode(Mode.POKEDEX_SCAN, buttonAction, prefilledText, index);
|
||||
ui.setOverlayMode(UiMode.POKEDEX_SCAN, buttonAction, prefilledText, index);
|
||||
}
|
||||
|
||||
setCursor(cursor: number): void {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { ModalUiHandler } from "./modal-ui-handler";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { TextStyle, addTextInputObject, addTextObject } from "./text";
|
||||
import { WindowVariant, addWindow } from "./ui-theme";
|
||||
import type InputText from "phaser3-rex-plugins/plugins/inputtext";
|
||||
|
@ -21,7 +21,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
|
|||
protected tween: Phaser.Tweens.Tween;
|
||||
protected formLabels: Phaser.GameObjects.Text[];
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
|
||||
this.editing = false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Phaser from "phaser";
|
||||
import { TextStyle, addTextObject } from "#app/ui/text";
|
||||
import type { Mode } from "#app/ui/ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "#app/ui/ui-handler";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
import { getPlayTimeString, formatFancyLargeNumber, toReadableString } from "#app/utils";
|
||||
|
@ -223,7 +223,7 @@ export default class GameStatsUiHandler extends UiHandler {
|
|||
private arrowUp: Phaser.GameObjects.Sprite;
|
||||
private arrowDown: Phaser.GameObjects.Sprite;
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
|
||||
this.statLabels = [];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import i18next from "i18next";
|
||||
import { ModalUiHandler } from "./modal-ui-handler";
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export default class LoadingModalUiHandler extends ModalUiHandler {
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { InputFieldConfig } from "./form-modal-ui-handler";
|
|||
import { FormModalUiHandler } from "./form-modal-ui-handler";
|
||||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { fixedInt } from "#app/utils";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import { addWindow } from "./ui-theme";
|
||||
|
@ -34,7 +34,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
|||
private infoContainer: Phaser.GameObjects.Container;
|
||||
private externalPartyBg: Phaser.GameObjects.NineSlice;
|
||||
private externalPartyTitle: Phaser.GameObjects.Text;
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
@ -146,9 +146,9 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
|||
// Prevent overlapping overrides on action modification
|
||||
this.submitAction = originalLoginAction;
|
||||
this.sanitizeInputs();
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
const onFail = error => {
|
||||
globalScene.ui.setMode(Mode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() }));
|
||||
globalScene.ui.setMode(UiMode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() }));
|
||||
globalScene.ui.playError();
|
||||
};
|
||||
if (!this.inputs[0].text) {
|
||||
|
@ -215,8 +215,8 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
|||
});
|
||||
|
||||
const onFail = error => {
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setModeForceTransition(Mode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() }));
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setModeForceTransition(UiMode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() }));
|
||||
globalScene.ui.playError();
|
||||
};
|
||||
|
||||
|
@ -236,7 +236,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
|||
},
|
||||
});
|
||||
}
|
||||
globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
delay: 1000,
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { bypassLogin } from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { TextStyle, addTextObject, getTextStyleOptions } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { getEnumKeys, isLocal, isBeta, fixedInt, getCookie, sessionIdKey } from "#app/utils";
|
||||
import { addWindow, WindowVariant } from "./ui-theme";
|
||||
import MessageUiHandler from "./message-ui-handler";
|
||||
|
@ -64,12 +64,12 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
|
||||
public bgmBar: BgmBar;
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
|
||||
this.excludedMenus = () => [
|
||||
{
|
||||
condition: [Mode.COMMAND, Mode.TITLE].includes(mode ?? Mode.TITLE),
|
||||
condition: [UiMode.COMMAND, UiMode.TITLE].includes(mode ?? UiMode.TITLE),
|
||||
options: [MenuOptions.EGG_GACHA, MenuOptions.EGG_LIST],
|
||||
},
|
||||
{ condition: bypassLogin, options: [MenuOptions.LOG_OUT] },
|
||||
|
@ -234,7 +234,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
]),
|
||||
xOffset: 98,
|
||||
};
|
||||
ui.setOverlayMode(Mode.MENU_OPTION_SELECT, config);
|
||||
ui.setOverlayMode(UiMode.MENU_OPTION_SELECT, config);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -377,7 +377,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
ui.revertMode();
|
||||
},
|
||||
];
|
||||
ui.setMode(Mode.TEST_DIALOGUE, buttonAction, prefilledText);
|
||||
ui.setMode(UiMode.TEST_DIALOGUE, buttonAction, prefilledText);
|
||||
return true;
|
||||
},
|
||||
keepOpen: true,
|
||||
|
@ -456,7 +456,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
ui.playSelect();
|
||||
ui.setOverlayMode(
|
||||
Mode.ADMIN,
|
||||
UiMode.ADMIN,
|
||||
{
|
||||
buttonActions: [
|
||||
// we double revert here and below to go back 2 layers of menus
|
||||
|
@ -483,7 +483,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
return true;
|
||||
},
|
||||
});
|
||||
globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
delay: 0,
|
||||
});
|
||||
|
@ -557,21 +557,21 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
this.showText("", 0);
|
||||
switch (adjustedCursor) {
|
||||
case MenuOptions.GAME_SETTINGS:
|
||||
ui.setOverlayMode(Mode.SETTINGS);
|
||||
ui.setOverlayMode(UiMode.SETTINGS);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.ACHIEVEMENTS:
|
||||
ui.setOverlayMode(Mode.ACHIEVEMENTS);
|
||||
ui.setOverlayMode(UiMode.ACHIEVEMENTS);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.STATS:
|
||||
ui.setOverlayMode(Mode.GAME_STATS);
|
||||
ui.setOverlayMode(UiMode.GAME_STATS);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.EGG_LIST:
|
||||
if (globalScene.gameData.eggs.length) {
|
||||
ui.revertMode();
|
||||
ui.setOverlayMode(Mode.EGG_LIST);
|
||||
ui.setOverlayMode(UiMode.EGG_LIST);
|
||||
success = true;
|
||||
} else {
|
||||
ui.showText(i18next.t("menuUiHandler:noEggs"), null, () => ui.showText(""), fixedInt(1500));
|
||||
|
@ -580,12 +580,12 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
break;
|
||||
case MenuOptions.EGG_GACHA:
|
||||
ui.revertMode();
|
||||
ui.setOverlayMode(Mode.EGG_GACHA);
|
||||
ui.setOverlayMode(UiMode.EGG_GACHA);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.POKEDEX:
|
||||
ui.revertMode();
|
||||
ui.setOverlayMode(Mode.POKEDEX);
|
||||
ui.setOverlayMode(UiMode.POKEDEX);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.MANAGE_DATA:
|
||||
|
@ -642,18 +642,18 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
},
|
||||
);
|
||||
}
|
||||
ui.setOverlayMode(Mode.MENU_OPTION_SELECT, this.manageDataConfig);
|
||||
ui.setOverlayMode(UiMode.MENU_OPTION_SELECT, this.manageDataConfig);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.COMMUNITY:
|
||||
ui.setOverlayMode(Mode.MENU_OPTION_SELECT, this.communityConfig);
|
||||
ui.setOverlayMode(UiMode.MENU_OPTION_SELECT, this.communityConfig);
|
||||
success = true;
|
||||
break;
|
||||
case MenuOptions.SAVE_AND_QUIT:
|
||||
if (globalScene.currentBattle) {
|
||||
success = true;
|
||||
const doSaveQuit = () => {
|
||||
ui.setMode(Mode.LOADING, {
|
||||
ui.setMode(UiMode.LOADING, {
|
||||
buttonActions: [],
|
||||
fadeOut: () =>
|
||||
globalScene.gameData.saveAll(true, true, true, true).then(() => {
|
||||
|
@ -668,7 +668,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
return;
|
||||
}
|
||||
ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
doSaveQuit,
|
||||
() => {
|
||||
ui.revertMode();
|
||||
|
@ -688,7 +688,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
case MenuOptions.LOG_OUT:
|
||||
success = true;
|
||||
const doLogout = () => {
|
||||
ui.setMode(Mode.LOADING, {
|
||||
ui.setMode(UiMode.LOADING, {
|
||||
buttonActions: [],
|
||||
fadeOut: () =>
|
||||
pokerogueApi.account.logout().then(() => {
|
||||
|
@ -703,7 +703,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
return;
|
||||
}
|
||||
ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
doLogout,
|
||||
() => {
|
||||
ui.revertMode();
|
||||
|
@ -722,7 +722,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
success = true;
|
||||
ui.revertMode().then(result => {
|
||||
if (!result) {
|
||||
ui.setMode(Mode.MESSAGE);
|
||||
ui.setMode(UiMode.MESSAGE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import AwaitableUiHandler from "./awaitable-ui-handler";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { getFrameMs } from "#app/utils";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
|
@ -11,7 +11,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
|
|||
public message: Phaser.GameObjects.Text;
|
||||
public prompt: Phaser.GameObjects.Sprite;
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
|
||||
this.pendingPrompt = false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { TextStyle, addTextObject } from "./text";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { WindowVariant, addWindow } from "./ui-theme";
|
||||
import type { Button } from "#enums/buttons";
|
||||
|
@ -17,7 +17,7 @@ export abstract class ModalUiHandler extends UiHandler {
|
|||
protected buttonBgs: Phaser.GameObjects.NineSlice[];
|
||||
protected buttonLabels: Phaser.GameObjects.Text[];
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
|
||||
this.buttonContainers = [];
|
||||
|
|
|
@ -4,7 +4,7 @@ import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "../modi
|
|||
import { getPokeballAtlasKey } from "#app/data/pokeball";
|
||||
import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
|
||||
import AwaitableUiHandler from "./awaitable-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { LockModifierTiersModifier, PokemonHeldItemModifier, HealShopCostModifier } from "../modifier/modifier";
|
||||
import { handleTutorial, Tutorial } from "../tutorial";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -50,7 +50,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||
private cursorObj: Phaser.GameObjects.Image | null;
|
||||
|
||||
constructor() {
|
||||
super(Mode.CONFIRM);
|
||||
super(UiMode.CONFIRM);
|
||||
|
||||
this.options = [];
|
||||
this.shopOptionsRows = [];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { addBBCodeTextObject, getBBCodeFrag, TextStyle } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { addWindow, WindowVariant } from "./ui-theme";
|
||||
|
@ -47,7 +47,7 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
|||
protected blockInput = true;
|
||||
|
||||
constructor() {
|
||||
super(Mode.MYSTERY_ENCOUNTER);
|
||||
super(UiMode.MYSTERY_ENCOUNTER);
|
||||
}
|
||||
|
||||
override setup() {
|
||||
|
@ -141,8 +141,8 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
|||
...this.overrideSettings,
|
||||
slideInDescription: false,
|
||||
};
|
||||
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||
globalScene.ui.setMode(Mode.MYSTERY_ENCOUNTER, overrideSettings);
|
||||
globalScene.ui.setMode(UiMode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||
globalScene.ui.setMode(UiMode.MYSTERY_ENCOUNTER, overrideSettings);
|
||||
setTimeout(() => {
|
||||
this.setCursor(this.viewPartyIndex);
|
||||
this.unblockInput();
|
||||
|
|
|
@ -4,7 +4,7 @@ import { MoveResult } from "#app/field/pokemon";
|
|||
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#app/ui/text";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils";
|
||||
import {
|
||||
PokemonFormChangeItemModifier,
|
||||
|
@ -252,7 +252,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
];
|
||||
|
||||
constructor() {
|
||||
super(Mode.PARTY);
|
||||
super(UiMode.PARTY);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -556,7 +556,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
this.showText(filterResult as string, undefined, () => this.showText("", 0), undefined, true);
|
||||
} else if (option === PartyOption.SUMMARY) {
|
||||
ui.playSelect();
|
||||
ui.setModeWithoutClear(Mode.SUMMARY, pokemon).then(() => this.clearOptions());
|
||||
ui.setModeWithoutClear(UiMode.SUMMARY, pokemon).then(() => this.clearOptions());
|
||||
return true;
|
||||
} else if (option === PartyOption.POKEDEX) {
|
||||
ui.playSelect();
|
||||
|
@ -566,7 +566,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
form: pokemon.formIndex,
|
||||
female: pokemon.gender === Gender.FEMALE,
|
||||
};
|
||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes).then(() => this.clearOptions());
|
||||
ui.setOverlayMode(UiMode.POKEDEX_PAGE, pokemon.species, attributes).then(() => this.clearOptions());
|
||||
return true;
|
||||
} else if (option === PartyOption.UNPAUSE_EVOLUTION) {
|
||||
this.clearOptions();
|
||||
|
@ -593,13 +593,13 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
null,
|
||||
() => {
|
||||
ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
const fusionName = pokemon.getName();
|
||||
pokemon.unfuse().then(() => {
|
||||
this.clearPartySlots();
|
||||
this.populatePartySlots();
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
this.showText(
|
||||
i18next.t("partyUiHandler:wasReverted", {
|
||||
fusionName: fusionName,
|
||||
|
@ -607,7 +607,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
}),
|
||||
undefined,
|
||||
() => {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
this.showText("", 0);
|
||||
},
|
||||
null,
|
||||
|
@ -616,7 +616,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
});
|
||||
},
|
||||
() => {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
this.showText("", 0);
|
||||
},
|
||||
);
|
||||
|
@ -635,13 +635,13 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
() => {
|
||||
this.blockInput = false;
|
||||
ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
this.doRelease(this.cursor);
|
||||
},
|
||||
() => {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
this.showText("", 0);
|
||||
},
|
||||
);
|
||||
|
@ -655,7 +655,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
ui.setModeWithoutClear(
|
||||
Mode.RENAME_POKEMON,
|
||||
UiMode.RENAME_POKEMON,
|
||||
{
|
||||
buttonActions: [
|
||||
(nickname: string) => {
|
||||
|
@ -664,10 +664,10 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
pokemon.updateInfo();
|
||||
this.clearPartySlots();
|
||||
this.populatePartySlots();
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
},
|
||||
() => {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -788,7 +788,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
selectCallback(6, PartyOption.CANCEL);
|
||||
ui.playSelect();
|
||||
} else {
|
||||
ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
ui.playSelect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"
|
|||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import { StatsContainer } from "#app/ui/stats-container";
|
||||
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions } from "#app/ui/text";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
import { Egg } from "#app/data/egg";
|
||||
import Overrides from "#app/overrides";
|
||||
|
@ -265,7 +265,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
private exitCallback;
|
||||
|
||||
constructor() {
|
||||
super(Mode.POKEDEX_PAGE);
|
||||
super(UiMode.POKEDEX_PAGE);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -1140,12 +1140,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
success = true;
|
||||
} else if (this.previousSpecies.length > 0) {
|
||||
this.blockInput = true;
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT).then(() => {
|
||||
const species = this.previousSpecies.pop();
|
||||
const starterAttributes = this.previousStarterAttributes.pop();
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setModeForceTransition(Mode.POKEDEX_PAGE, species, starterAttributes);
|
||||
ui.setModeForceTransition(UiMode.POKEDEX_PAGE, species, starterAttributes);
|
||||
success = true;
|
||||
});
|
||||
this.blockInput = false;
|
||||
|
@ -1173,7 +1173,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:showBaseStats"), null, () => {
|
||||
this.baseStatsOverlay.show(this.baseStats, this.baseTotal);
|
||||
|
||||
|
@ -1193,11 +1193,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:showLevelMoves"), null, () => {
|
||||
this.moveInfoOverlay.show(allMoves[this.levelMoves[0][1]]);
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: this.levelMoves
|
||||
.map(m => {
|
||||
const levelNumber = m[0] > 0 ? String(m[0]) : "";
|
||||
|
@ -1226,7 +1226,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
onHover: () => {
|
||||
|
@ -1251,7 +1251,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
if (this.eggMoves.length === 0) {
|
||||
ui.showText(i18next.t("pokedexUiHandler:noEggMoves"));
|
||||
this.blockInput = false;
|
||||
|
@ -1261,7 +1261,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
ui.showText(i18next.t("pokedexUiHandler:showEggMoves"), null, () => {
|
||||
this.moveInfoOverlay.show(allMoves[this.eggMoves[0]]);
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: [
|
||||
{
|
||||
label: i18next.t("pokedexUiHandler:common"),
|
||||
|
@ -1294,7 +1294,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
onHover: () => this.moveInfoOverlay.clear(),
|
||||
|
@ -1321,11 +1321,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:showTmMoves"), null, () => {
|
||||
this.moveInfoOverlay.show(allMoves[this.tmMoves[0]]);
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: this.tmMoves
|
||||
.map(m => {
|
||||
const option: OptionSelectItem = {
|
||||
|
@ -1344,7 +1344,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
onHover: () => {
|
||||
|
@ -1369,7 +1369,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:showAbilities"), null, () => {
|
||||
this.infoOverlay.show(allAbilities[this.ability1].description);
|
||||
|
||||
|
@ -1431,13 +1431,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.infoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
onHover: () => this.infoOverlay.clear(),
|
||||
});
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
supportHover: true,
|
||||
maxOptions: 8,
|
||||
|
@ -1457,7 +1457,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
if ((!this.biomes || this.biomes?.length === 0) && (!this.preBiomes || this.preBiomes?.length === 0)) {
|
||||
ui.showText(i18next.t("pokedexUiHandler:noBiomes"));
|
||||
ui.playError();
|
||||
|
@ -1510,13 +1510,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
onHover: () => this.moveInfoOverlay.clear(),
|
||||
});
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
supportHover: true,
|
||||
maxOptions: 8,
|
||||
|
@ -1536,7 +1536,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
const options: any[] = [];
|
||||
|
||||
if (
|
||||
|
@ -1589,7 +1589,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.savedStarterAttributes.form = newFormIndex;
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes);
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes);
|
||||
return true;
|
||||
},
|
||||
onHover: () => this.showText(conditionText),
|
||||
|
@ -1631,7 +1631,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.savedStarterAttributes.form = newFormIndex;
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, evoSpecies, this.savedStarterAttributes);
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, evoSpecies, this.savedStarterAttributes);
|
||||
return true;
|
||||
},
|
||||
onHover: () => this.showText(conditionText),
|
||||
|
@ -1676,7 +1676,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(
|
||||
Mode.POKEDEX_PAGE,
|
||||
UiMode.POKEDEX_PAGE,
|
||||
newSpecies,
|
||||
this.savedStarterAttributes,
|
||||
this.filteredIndices,
|
||||
|
@ -1694,13 +1694,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
onHover: () => this.moveInfoOverlay.clear(),
|
||||
});
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
supportHover: true,
|
||||
maxOptions: 8,
|
||||
|
@ -1719,7 +1719,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
error = true;
|
||||
} else {
|
||||
this.toggleStatsMode();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
success = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1729,10 +1729,10 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
error = true;
|
||||
} else {
|
||||
this.blockInput = true;
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:showNature"), null, () => {
|
||||
const natures = globalScene.gameData.getNaturesForAttr(this.speciesStarterDexEntry?.natureAttr);
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: natures
|
||||
.map((n: Nature, _i: number) => {
|
||||
const option: OptionSelectItem = {
|
||||
|
@ -1747,7 +1747,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
label: i18next.t("menu:cancel"),
|
||||
handler: () => {
|
||||
this.clearText();
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
this.blockInput = false;
|
||||
return true;
|
||||
},
|
||||
|
@ -1897,7 +1897,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
});
|
||||
this.setSpeciesDetails(this.species);
|
||||
globalScene.playSound("se/buy");
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1927,7 +1927,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
return globalScene.reset(true);
|
||||
}
|
||||
});
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
globalScene.playSound("se/buy");
|
||||
|
||||
return true;
|
||||
|
@ -1976,7 +1976,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
return globalScene.reset(true);
|
||||
}
|
||||
});
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
globalScene.playSound("se/buy");
|
||||
|
||||
return true;
|
||||
|
@ -1990,11 +1990,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
options.push({
|
||||
label: i18next.t("menu:cancel"),
|
||||
handler: () => {
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX_PAGE, "refresh");
|
||||
return true;
|
||||
},
|
||||
});
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
yOffset: 47,
|
||||
});
|
||||
|
@ -2032,7 +2032,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
return true;
|
||||
}
|
||||
this.blockInput = true;
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT).then(() => {
|
||||
// Always go back to first selection after scrolling around
|
||||
if (this.previousSpecies.length === 0) {
|
||||
this.previousSpecies.push(this.species);
|
||||
|
@ -2057,7 +2057,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setModeForceTransition(
|
||||
Mode.POKEDEX_PAGE,
|
||||
UiMode.POKEDEX_PAGE,
|
||||
newSpecies,
|
||||
this.savedStarterAttributes,
|
||||
this.filteredIndices,
|
||||
|
@ -2071,7 +2071,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.blockInput = false;
|
||||
return true;
|
||||
}
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT).then(() => {
|
||||
// Always go back to first selection after scrolling around
|
||||
if (this.previousSpecies.length === 0) {
|
||||
this.previousSpecies.push(this.species);
|
||||
|
@ -2096,7 +2096,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setModeForceTransition(
|
||||
Mode.POKEDEX_PAGE,
|
||||
UiMode.POKEDEX_PAGE,
|
||||
newSpecies,
|
||||
this.savedStarterAttributes,
|
||||
this.filteredIndices,
|
||||
|
|
|
@ -4,7 +4,7 @@ import type { ModalConfig } from "./modal-ui-handler";
|
|||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type { OptionSelectItem } from "./abstact-option-select-ui-handler";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { FilterTextRow } from "./filter-text";
|
||||
import { allAbilities } from "#app/data/data-lists";
|
||||
import { allMoves } from "#app/data/moves/move";
|
||||
|
@ -115,7 +115,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
|||
input.on("keydown", (inputObject, evt: KeyboardEvent) => {
|
||||
if (
|
||||
["escape", "space"].some(v => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) &&
|
||||
ui.getMode() === Mode.AUTO_COMPLETE
|
||||
ui.getMode() === UiMode.AUTO_COMPLETE
|
||||
) {
|
||||
// Delete autocomplete list and recovery focus.
|
||||
inputObject.on("blur", () => inputObject.node.focus(), { once: true });
|
||||
|
@ -125,7 +125,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
|||
|
||||
input.on("textchange", (inputObject, evt: InputEvent) => {
|
||||
// Delete autocomplete.
|
||||
if (ui.getMode() === Mode.AUTO_COMPLETE) {
|
||||
if (ui.getMode() === UiMode.AUTO_COMPLETE) {
|
||||
ui.revertMode();
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
|||
maxOptions: 5,
|
||||
modalContainer: this.modalContainer,
|
||||
};
|
||||
ui.setOverlayMode(Mode.AUTO_COMPLETE, modalOpts);
|
||||
ui.setOverlayMode(UiMode.AUTO_COMPLETE, modalOpts);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -168,7 +168,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
|||
this.inputs[0].text = args[1];
|
||||
}
|
||||
this.submitAction = _ => {
|
||||
if (ui.getMode() === Mode.POKEDEX_SCAN) {
|
||||
if (ui.getMode() === UiMode.POKEDEX_SCAN) {
|
||||
this.sanitizeInputs();
|
||||
const outputName = this.reducedKeys.includes(this.inputs[0].text) ? this.inputs[0].text : "";
|
||||
const sanitizedName = btoa(unescape(encodeURIComponent(outputName)));
|
||||
|
|
|
@ -16,7 +16,7 @@ import { AbilityAttr, DexAttr, loadStarterPreferences } from "#app/system/game-d
|
|||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
|
||||
import { TextStyle, addTextObject } from "#app/ui/text";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
||||
import { Passive as PassiveAttr } from "#enums/passive";
|
||||
import type { Species } from "#enums/species";
|
||||
|
@ -231,7 +231,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||
private filteredIndices: Species[];
|
||||
|
||||
constructor() {
|
||||
super(Mode.POKEDEX);
|
||||
super(UiMode.POKEDEX);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -1133,7 +1133,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||
} else if (this.showingTray) {
|
||||
if (button === Button.ACTION) {
|
||||
const formIndex = this.trayForms[this.trayCursor].formIndex;
|
||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices);
|
||||
ui.setOverlayMode(UiMode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices);
|
||||
success = true;
|
||||
} else {
|
||||
const numberOfForms = this.trayContainers.length;
|
||||
|
@ -1182,7 +1182,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||
}
|
||||
} else {
|
||||
if (button === Button.ACTION) {
|
||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, null, this.filteredIndices);
|
||||
ui.setOverlayMode(UiMode.POKEDEX_PAGE, this.lastSpecies, null, this.filteredIndices);
|
||||
success = true;
|
||||
} else {
|
||||
switch (button) {
|
||||
|
@ -2268,15 +2268,15 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||
const ui = this.getUi();
|
||||
|
||||
const cancel = () => {
|
||||
ui.setMode(Mode.POKEDEX, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX, "refresh");
|
||||
this.clearText();
|
||||
this.blockInput = false;
|
||||
};
|
||||
ui.showText(i18next.t("pokedexUiHandler:confirmExit"), null, () => {
|
||||
ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
ui.setMode(Mode.POKEDEX, "refresh");
|
||||
ui.setMode(UiMode.POKEDEX, "refresh");
|
||||
this.clearText();
|
||||
this.clear();
|
||||
ui.revertMode();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { InputFieldConfig } from "./form-modal-ui-handler";
|
||||
import { FormModalUiHandler } from "./form-modal-ui-handler";
|
||||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import i18next from "i18next";
|
||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
|
@ -101,9 +101,9 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler {
|
|||
// Prevent overlapping overrides on action modification
|
||||
this.submitAction = originalRegistrationAction;
|
||||
this.sanitizeInputs();
|
||||
globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
|
||||
const onFail = error => {
|
||||
globalScene.ui.setMode(Mode.REGISTRATION_FORM, Object.assign(config, { errorMessage: error?.trim() }));
|
||||
globalScene.ui.setMode(UiMode.REGISTRATION_FORM, Object.assign(config, { errorMessage: error?.trim() }));
|
||||
globalScene.ui.playError();
|
||||
const errorMessageFontSize = languageSettings[i18next.resolvedLanguage!]?.errorMessageFontSize;
|
||||
if (errorMessageFontSize) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { GameModes } from "../game-mode";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import { fixedInt, formatLargeNumber } from "#app/utils";
|
||||
import type PokemonData from "../system/pokemon-data";
|
||||
|
@ -40,7 +40,7 @@ export default class RunHistoryUiHandler extends MessageUiHandler {
|
|||
private runContainerInitialY: number;
|
||||
|
||||
constructor() {
|
||||
super(Mode.RUN_HISTORY);
|
||||
super(UiMode.RUN_HISTORY);
|
||||
}
|
||||
|
||||
override setup() {
|
||||
|
@ -110,7 +110,7 @@ export default class RunHistoryUiHandler extends MessageUiHandler {
|
|||
if (button === Button.ACTION) {
|
||||
const cursor = this.cursor + this.scrollCursor;
|
||||
if (this.runs[cursor]) {
|
||||
globalScene.ui.setOverlayMode(Mode.RUN_INFO, this.runs[cursor].entryData, RunDisplayMode.RUN_HISTORY, true);
|
||||
globalScene.ui.setOverlayMode(UiMode.RUN_INFO, this.runs[cursor].entryData, RunDisplayMode.RUN_HISTORY, true);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { GameModes } from "../game-mode";
|
|||
import UiHandler from "./ui-handler";
|
||||
import type { SessionSaveData } from "../system/game-data";
|
||||
import { TextStyle, addTextObject, addBBCodeTextObject, getTextColor } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import { getPokeballAtlasKey } from "#app/data/pokeball";
|
||||
import { formatLargeNumber, getPlayTimeString, formatMoney, formatFancyLargeNumber } from "#app/utils";
|
||||
|
@ -69,7 +69,7 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||
private modifiersModule: any;
|
||||
|
||||
constructor() {
|
||||
super(Mode.RUN_INFO);
|
||||
super(UiMode.RUN_INFO);
|
||||
}
|
||||
|
||||
override async setup() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import type PokemonData from "../system/pokemon-data";
|
|||
import { isNullOrUndefined, fixedInt, getPlayTimeString, formatLargeNumber } from "#app/utils";
|
||||
import MessageUiHandler from "./message-ui-handler";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import { RunDisplayMode } from "#app/ui/run-info-ui-handler";
|
||||
|
||||
|
@ -40,7 +40,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
|
|||
private sessionSlotsContainerInitialY: number;
|
||||
|
||||
constructor() {
|
||||
super(Mode.SAVE_SLOT);
|
||||
super(UiMode.SAVE_SLOT);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -122,13 +122,13 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
|
|||
this.saveSlotSelectCallback = null;
|
||||
ui.revertMode();
|
||||
ui.showText("", 0);
|
||||
ui.setMode(Mode.MESSAGE);
|
||||
ui.setMode(UiMode.MESSAGE);
|
||||
originalCallback?.(cursor);
|
||||
};
|
||||
if (this.sessionSlots[cursor].hasData) {
|
||||
ui.showText(i18next.t("saveSlotSelectUiHandler:overwriteData"), null, () => {
|
||||
ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.gameData.deleteSession(cursor).then(response => {
|
||||
if (response === false) {
|
||||
|
@ -198,7 +198,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
|
|||
case Button.RIGHT:
|
||||
if (this.sessionSlots[cursorPosition].hasData && this.sessionSlots[cursorPosition].saveData) {
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.RUN_INFO,
|
||||
UiMode.RUN_INFO,
|
||||
this.sessionSlots[cursorPosition].saveData,
|
||||
RunDisplayMode.SESSION_PREVIEW,
|
||||
);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { ModalUiHandler } from "./modal-ui-handler";
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export default class SessionReloadModalUiHandler extends ModalUiHandler {
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import UiHandler from "../ui-handler";
|
||||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "../ui-theme";
|
||||
import { addTextObject, TextStyle } from "../text";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -51,7 +51,7 @@ export default abstract class AbstractBindingUiHandler extends UiHandler {
|
|||
*
|
||||
* @param mode - The UI mode.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import UiHandler from "#app/ui/ui-handler";
|
||||
import type { Mode } from "#app/ui/ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import type { InterfaceConfig } from "#app/inputs-controller";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
|
@ -74,7 +74,7 @@ export default abstract class AbstractControlSettingsUiHandler extends UiHandler
|
|||
*
|
||||
* @param mode - The UI mode.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
this.rowsToDisplay = 8;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { TextStyle, addTextObject } from "#app/ui/text";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
import { ScrollBar } from "#app/ui/scroll-bar";
|
||||
|
@ -42,7 +42,7 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
|||
protected settings: Array<Setting>;
|
||||
protected localStorageKey: string;
|
||||
|
||||
constructor(type: SettingType, mode: Mode | null = null) {
|
||||
constructor(type: SettingType, mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
this.settings = Setting.filter(s => s.type === type && !s?.isHidden?.());
|
||||
this.reloadRequired = false;
|
||||
|
@ -425,7 +425,7 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
|||
const confirmationMessage =
|
||||
setting.options[cursor].confirmationMessage ?? i18next.t("settings:defaultConfirmMessage");
|
||||
globalScene.ui.showText(confirmationMessage, null, () => {
|
||||
globalScene.ui.setOverlayMode(Mode.CONFIRM, confirmUpdateSetting, cancelUpdateSetting, null, null, 1, 750);
|
||||
globalScene.ui.setOverlayMode(UiMode.CONFIRM, confirmUpdateSetting, cancelUpdateSetting, null, null, 1, 750);
|
||||
});
|
||||
} else {
|
||||
saveSetting();
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
|
||||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { Device } from "#enums/devices";
|
||||
import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
globalScene.input.gamepad?.on("down", this.gamepadButtonDown, this);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
|
||||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { getKeyWithKeycode } from "#app/configs/inputs/configHandler";
|
||||
import { Device } from "#enums/devices";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
// Listen to gamepad button down events to initiate binding.
|
||||
globalScene.input.keyboard?.on("keydown", this.onKeyDown, this);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { InputsIcons } from "#app/ui/settings/abstract-control-settings-ui-handler";
|
||||
import { addTextObject, setTextStyle, TextStyle } from "#app/ui/text";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
|
@ -14,8 +14,8 @@ const RIGHT = "RIGHT";
|
|||
*/
|
||||
export class NavigationManager {
|
||||
private static instance: NavigationManager;
|
||||
public modes: Mode[];
|
||||
public selectedMode: Mode = Mode.SETTINGS;
|
||||
public modes: UiMode[];
|
||||
public selectedMode: UiMode = UiMode.SETTINGS;
|
||||
public navigationMenus: NavigationMenu[] = new Array<NavigationMenu>();
|
||||
public labels: string[];
|
||||
|
||||
|
@ -27,11 +27,11 @@ export class NavigationManager {
|
|||
*/
|
||||
constructor() {
|
||||
this.modes = [
|
||||
Mode.SETTINGS,
|
||||
Mode.SETTINGS_DISPLAY,
|
||||
Mode.SETTINGS_AUDIO,
|
||||
Mode.SETTINGS_GAMEPAD,
|
||||
Mode.SETTINGS_KEYBOARD,
|
||||
UiMode.SETTINGS,
|
||||
UiMode.SETTINGS_DISPLAY,
|
||||
UiMode.SETTINGS_AUDIO,
|
||||
UiMode.SETTINGS_GAMEPAD,
|
||||
UiMode.SETTINGS_KEYBOARD,
|
||||
];
|
||||
this.labels = [
|
||||
i18next.t("settings:general"),
|
||||
|
@ -43,7 +43,7 @@ export class NavigationManager {
|
|||
}
|
||||
|
||||
public reset() {
|
||||
this.selectedMode = Mode.SETTINGS;
|
||||
this.selectedMode = UiMode.SETTINGS;
|
||||
this.updateNavigationMenus();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import AbstractOptionSelectUiHandler from "../abstact-option-select-ui-handler";
|
||||
import { Mode } from "../ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export default class OptionSelectUiHandler extends AbstractOptionSelectUiHandler {
|
||||
constructor(mode: Mode = Mode.OPTION_SELECT) {
|
||||
constructor(mode: UiMode = UiMode.OPTION_SELECT) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import AbstractSettingsUiHandler from "./abstract-settings-ui-handler";
|
||||
import { SettingType } from "#app/system/settings/settings";
|
||||
("#app/inputs-controller");
|
||||
|
@ -9,7 +9,7 @@ export default class SettingsAudioUiHandler extends AbstractSettingsUiHandler {
|
|||
*
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(SettingType.AUDIO, mode);
|
||||
this.title = "Audio";
|
||||
this.localStorageKey = "settings";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import AbstractSettingsUiHandler from "./abstract-settings-ui-handler";
|
||||
import { SettingKeys, SettingType } from "#app/system/settings/settings";
|
||||
("#app/inputs-controller");
|
||||
|
@ -9,7 +9,7 @@ export default class SettingsDisplayUiHandler extends AbstractSettingsUiHandler
|
|||
*
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(SettingType.DISPLAY, mode);
|
||||
this.title = "Display";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { addTextObject, TextStyle } from "../text";
|
||||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import {
|
||||
setSettingGamepad,
|
||||
SettingGamepad,
|
||||
|
@ -29,7 +29,7 @@ export default class SettingsGamepadUiHandler extends AbstractControlSettingsUiH
|
|||
*
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
this.titleSelected = "Gamepad";
|
||||
this.setting = SettingGamepad;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "../ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import cfg_keyboard_qwerty from "#app/configs/inputs/cfg_keyboard_qwerty";
|
||||
import {
|
||||
setSettingKeyboard,
|
||||
|
@ -28,7 +28,7 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi
|
|||
*
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
this.titleSelected = "Keyboard";
|
||||
this.setting = SettingKeyboard;
|
||||
|
@ -84,7 +84,7 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi
|
|||
* Handle the home key press event.
|
||||
*/
|
||||
onHomeDown(): void {
|
||||
if (![Mode.SETTINGS_KEYBOARD, Mode.SETTINGS_GAMEPAD].includes(globalScene.ui.getMode())) {
|
||||
if (![UiMode.SETTINGS_KEYBOARD, UiMode.SETTINGS_GAMEPAD].includes(globalScene.ui.getMode())) {
|
||||
return;
|
||||
}
|
||||
globalScene.gameData.resetMappingToFactory();
|
||||
|
@ -95,7 +95,7 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi
|
|||
* Handle the delete key press event.
|
||||
*/
|
||||
onDeleteDown(): void {
|
||||
if (globalScene.ui.getMode() !== Mode.SETTINGS_KEYBOARD) {
|
||||
if (globalScene.ui.getMode() !== UiMode.SETTINGS_KEYBOARD) {
|
||||
return;
|
||||
}
|
||||
const cursor = this.cursor + this.scrollCursor; // Calculate the absolute cursor position.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { SettingType } from "../../system/settings/settings";
|
||||
import type { Mode } from "../ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import AbstractSettingsUiHandler from "./abstract-settings-ui-handler";
|
||||
|
||||
export default class SettingsUiHandler extends AbstractSettingsUiHandler {
|
||||
|
@ -8,7 +8,7 @@ export default class SettingsUiHandler extends AbstractSettingsUiHandler {
|
|||
*
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(SettingType.GENERAL, mode);
|
||||
this.title = "General";
|
||||
this.localStorageKey = "settings";
|
||||
|
|
|
@ -37,7 +37,7 @@ import MessageUiHandler from "#app/ui/message-ui-handler";
|
|||
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
|
||||
import { StatsContainer } from "#app/ui/stats-container";
|
||||
import { TextStyle, addBBCodeTextObject, addTextObject } from "#app/ui/text";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
import { Egg } from "#app/data/egg";
|
||||
import Overrides from "#app/overrides";
|
||||
|
@ -375,7 +375,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
protected blockInput = false;
|
||||
|
||||
constructor() {
|
||||
super(Mode.STARTER_SELECT);
|
||||
super(UiMode.STARTER_SELECT);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -1888,7 +1888,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
{
|
||||
label: i18next.t("starterSelectUiHandler:addToParty"),
|
||||
handler: () => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
const isOverValueLimit = this.tryUpdateValue(
|
||||
globalScene.gameData.getSpeciesStarterValue(this.lastSpecies.speciesId),
|
||||
true,
|
||||
|
@ -1921,7 +1921,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
label: i18next.t("starterSelectUiHandler:removeFromParty"),
|
||||
handler: () => {
|
||||
this.popStarter(removeIndex);
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
},
|
||||
|
@ -1934,7 +1934,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
label: i18next.t("starterSelectUiHandler:toggleIVs"),
|
||||
handler: () => {
|
||||
this.toggleStatsMode();
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
},
|
||||
|
@ -1944,18 +1944,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
const showSwapOptions = (moveset: StarterMoveset) => {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.STARTER_SELECT).then(() => {
|
||||
ui.setMode(UiMode.STARTER_SELECT).then(() => {
|
||||
ui.showText(i18next.t("starterSelectUiHandler:selectMoveSwapOut"), null, () => {
|
||||
this.moveInfoOverlay.show(allMoves[moveset[0]]);
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: moveset
|
||||
.map((m: Moves, i: number) => {
|
||||
const option: OptionSelectItem = {
|
||||
label: allMoves[m].name,
|
||||
handler: () => {
|
||||
this.blockInput = true;
|
||||
ui.setMode(Mode.STARTER_SELECT).then(() => {
|
||||
ui.setMode(UiMode.STARTER_SELECT).then(() => {
|
||||
ui.showText(
|
||||
`${i18next.t("starterSelectUiHandler:selectMoveSwapWith")} ${allMoves[m].name}.`,
|
||||
null,
|
||||
|
@ -1963,7 +1963,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
const possibleMoves = this.speciesStarterMoves.filter((sm: Moves) => sm !== m);
|
||||
this.moveInfoOverlay.show(allMoves[possibleMoves[0]]);
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: possibleMoves
|
||||
.map(sm => {
|
||||
// make an option for each available starter move
|
||||
|
@ -2011,7 +2011,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
handler: () => {
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
onHover: () => {
|
||||
|
@ -2039,10 +2039,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
const showNatureOptions = () => {
|
||||
this.blockInput = true;
|
||||
|
||||
ui.setMode(Mode.STARTER_SELECT).then(() => {
|
||||
ui.setMode(UiMode.STARTER_SELECT).then(() => {
|
||||
ui.showText(i18next.t("starterSelectUiHandler:selectNature"), null, () => {
|
||||
const natures = globalScene.gameData.getNaturesForAttr(this.speciesStarterDexEntry?.natureAttr);
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: natures
|
||||
.map((n: Nature, _i: number) => {
|
||||
const option: OptionSelectItem = {
|
||||
|
@ -2054,7 +2054,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
}
|
||||
starterAttributes.nature = n;
|
||||
this.clearText();
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
// set nature for starter
|
||||
this.setSpeciesDetails(this.lastSpecies, {
|
||||
natureIndex: n,
|
||||
|
@ -2069,7 +2069,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
label: i18next.t("menu:cancel"),
|
||||
handler: () => {
|
||||
this.clearText();
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
this.blockInput = false;
|
||||
return true;
|
||||
},
|
||||
|
@ -2097,7 +2097,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
label: i18next.t("starterSelectUiHandler:enablePassive"),
|
||||
handler: () => {
|
||||
starterData.passiveAttr |= PassiveAttr.ENABLED;
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
this.setSpeciesDetails(this.lastSpecies);
|
||||
return true;
|
||||
},
|
||||
|
@ -2107,7 +2107,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
label: i18next.t("starterSelectUiHandler:disablePassive"),
|
||||
handler: () => {
|
||||
starterData.passiveAttr ^= PassiveAttr.ENABLED;
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
this.setSpeciesDetails(this.lastSpecies);
|
||||
return true;
|
||||
},
|
||||
|
@ -2125,7 +2125,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
if (starterContainer) {
|
||||
starterContainer.favoriteIcon.setVisible(starterAttributes.favorite);
|
||||
}
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
@ -2138,7 +2138,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
if (starterContainer) {
|
||||
starterContainer.favoriteIcon.setVisible(starterAttributes.favorite);
|
||||
}
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
@ -2150,7 +2150,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
let nickname = starterAttributes.nickname ? String(starterAttributes.nickname) : "";
|
||||
nickname = decodeURIComponent(escape(atob(nickname)));
|
||||
ui.setModeWithoutClear(
|
||||
Mode.RENAME_POKEMON,
|
||||
UiMode.RENAME_POKEMON,
|
||||
{
|
||||
buttonActions: [
|
||||
(sanitizedName: string) => {
|
||||
|
@ -2162,10 +2162,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
} else {
|
||||
this.pokemonNameText.setText(this.lastSpecies.name);
|
||||
}
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
},
|
||||
() => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -2197,7 +2197,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
return globalScene.reset(true);
|
||||
}
|
||||
});
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
this.setSpeciesDetails(this.lastSpecies);
|
||||
globalScene.playSound("se/buy");
|
||||
|
||||
|
@ -2238,7 +2238,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
}
|
||||
});
|
||||
this.tryUpdateValue(0);
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
globalScene.playSound("se/buy");
|
||||
|
||||
// update the value label and icon/animation for available upgrade
|
||||
|
@ -2290,7 +2290,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
return globalScene.reset(true);
|
||||
}
|
||||
});
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
globalScene.playSound("se/buy");
|
||||
|
||||
// update the icon/animation for available upgrade
|
||||
|
@ -2308,11 +2308,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
options.push({
|
||||
label: i18next.t("menu:cancel"),
|
||||
handler: () => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
yOffset: 47,
|
||||
});
|
||||
|
@ -2320,14 +2320,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
options.push({
|
||||
label: i18next.t("menuUiHandler:POKEDEX"),
|
||||
handler: () => {
|
||||
ui.setMode(Mode.STARTER_SELECT).then(() => {
|
||||
ui.setMode(UiMode.STARTER_SELECT).then(() => {
|
||||
const attributes = {
|
||||
shiny: starterAttributes.shiny,
|
||||
variant: starterAttributes.variant,
|
||||
form: starterAttributes.form,
|
||||
female: starterAttributes.female,
|
||||
};
|
||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, attributes);
|
||||
ui.setOverlayMode(UiMode.POKEDEX_PAGE, this.lastSpecies, attributes);
|
||||
});
|
||||
return true;
|
||||
},
|
||||
|
@ -2336,7 +2336,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
options.push({
|
||||
label: i18next.t("starterSelectUiHandler:useCandies"),
|
||||
handler: () => {
|
||||
ui.setMode(Mode.STARTER_SELECT).then(() => showUseCandies());
|
||||
ui.setMode(UiMode.STARTER_SELECT).then(() => showUseCandies());
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
@ -2344,11 +2344,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
options.push({
|
||||
label: i18next.t("menu:cancel"),
|
||||
handler: () => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
ui.setModeWithoutClear(UiMode.OPTION_SELECT, {
|
||||
options: options,
|
||||
yOffset: 47,
|
||||
});
|
||||
|
@ -4281,15 +4281,15 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
const ui = this.getUi();
|
||||
|
||||
const cancel = () => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
this.clearText();
|
||||
this.blockInput = false;
|
||||
};
|
||||
ui.showText(i18next.t("starterSelectUiHandler:confirmExit"), null, () => {
|
||||
ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
globalScene.clearPhaseQueue();
|
||||
if (globalScene.gameMode.isChallenge) {
|
||||
globalScene.pushPhase(new SelectChallengePhase());
|
||||
|
@ -4318,7 +4318,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
const ui = this.getUi();
|
||||
|
||||
const cancel = () => {
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
if (!manualTrigger) {
|
||||
this.popStarter(this.starterSpecies.length - 1);
|
||||
}
|
||||
|
@ -4330,11 +4330,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
if (canStart) {
|
||||
ui.showText(i18next.t("starterSelectUiHandler:confirmStartTeam"), null, () => {
|
||||
ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
const startRun = () => {
|
||||
globalScene.money = globalScene.gameMode.getStartingMoney();
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
ui.setMode(UiMode.STARTER_SELECT);
|
||||
const thisObj = this;
|
||||
const originalStarterSelectCallback = this.starterSelectCallback;
|
||||
this.starterSelectCallback = null;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { starterColors } from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "#app/ui/ui-handler";
|
||||
import {
|
||||
getLocalizedSpriteKey,
|
||||
|
@ -128,7 +128,7 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
private selectCallback: Function | null;
|
||||
|
||||
constructor() {
|
||||
super(Mode.SUMMARY);
|
||||
super(UiMode.SUMMARY);
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -510,7 +510,7 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
}
|
||||
|
||||
const ui = this.getUi();
|
||||
const fromPartyMode = ui.handlers[Mode.PARTY].active;
|
||||
const fromPartyMode = ui.handlers[UiMode.PARTY].active;
|
||||
let success = false;
|
||||
let error = false;
|
||||
|
||||
|
@ -610,9 +610,9 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
}
|
||||
|
||||
if (!fromPartyMode) {
|
||||
ui.setMode(Mode.MESSAGE);
|
||||
ui.setMode(UiMode.MESSAGE);
|
||||
} else {
|
||||
ui.setMode(Mode.PARTY);
|
||||
ui.setMode(UiMode.PARTY);
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BattlerIndex } from "../battle";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { isNullOrUndefined, fixedInt } from "#app/utils";
|
||||
import { getMoveTargets } from "../data/moves/move";
|
||||
|
@ -27,7 +27,7 @@ export default class TargetSelectUiHandler extends UiHandler {
|
|||
private targetBattleInfoMoveTween: Phaser.Tweens.Tween[] = [];
|
||||
|
||||
constructor() {
|
||||
super(Mode.TARGET_SELECT);
|
||||
super(UiMode.TARGET_SELECT);
|
||||
|
||||
this.cursor = -1;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import i18next from "i18next";
|
|||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type { OptionSelectItem } from "./abstact-option-select-ui-handler";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export default class TestDialogueUiHandler extends FormModalUiHandler {
|
||||
keys: string[];
|
||||
|
@ -88,7 +88,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler {
|
|||
input.on("keydown", (inputObject, evt: KeyboardEvent) => {
|
||||
if (
|
||||
["escape", "space"].some(v => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) &&
|
||||
ui.getMode() === Mode.AUTO_COMPLETE
|
||||
ui.getMode() === UiMode.AUTO_COMPLETE
|
||||
) {
|
||||
// Delete autocomplete list and recovery focus.
|
||||
inputObject.on("blur", () => inputObject.node.focus(), { once: true });
|
||||
|
@ -98,7 +98,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler {
|
|||
|
||||
input.on("textchange", (inputObject, evt: InputEvent) => {
|
||||
// Delete autocomplete.
|
||||
if (ui.getMode() === Mode.AUTO_COMPLETE) {
|
||||
if (ui.getMode() === UiMode.AUTO_COMPLETE) {
|
||||
ui.revertMode();
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler {
|
|||
maxOptions: 5,
|
||||
modalContainer: this.modalContainer,
|
||||
};
|
||||
ui.setOverlayMode(Mode.AUTO_COMPLETE, modalOpts);
|
||||
ui.setOverlayMode(UiMode.AUTO_COMPLETE, modalOpts);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -147,7 +147,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler {
|
|||
this.inputs[0].text = args[1];
|
||||
}
|
||||
this.submitAction = _ => {
|
||||
if (ui.getMode() === Mode.TEST_DIALOGUE) {
|
||||
if (ui.getMode() === UiMode.TEST_DIALOGUE) {
|
||||
this.sanitizeInputs();
|
||||
const sanitizedName = btoa(unescape(encodeURIComponent(this.inputs[0].text)));
|
||||
config.buttonActions[0](sanitizedName);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import OptionSelectUiHandler from "./settings/option-select-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { fixedInt, randInt, randItem } from "#app/utils";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
import { getSplashMessages } from "../data/splash-messages";
|
||||
|
@ -26,7 +26,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||
|
||||
private titleStatsTimer: NodeJS.Timeout | null;
|
||||
|
||||
constructor(mode: Mode = Mode.TITLE) {
|
||||
constructor(mode: UiMode = UiMode.TITLE) {
|
||||
super(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { TextStyle } from "./text";
|
||||
import { getTextColor } from "./text";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import type { Button } from "#enums/buttons";
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ export default abstract class UiHandler {
|
|||
/**
|
||||
* @param mode The mode of the UI element. These should be unique.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
|
|
161
src/ui/ui.ts
161
src/ui/ui.ts
|
@ -57,102 +57,55 @@ import MysteryEncounterUiHandler from "./mystery-encounter-ui-handler";
|
|||
import PokedexScanUiHandler from "./pokedex-scan-ui-handler";
|
||||
import PokedexPageUiHandler from "./pokedex-page-ui-handler";
|
||||
import { NavigationManager } from "./settings/navigationMenu";
|
||||
|
||||
export enum Mode {
|
||||
MESSAGE,
|
||||
TITLE,
|
||||
COMMAND,
|
||||
FIGHT,
|
||||
BALL,
|
||||
TARGET_SELECT,
|
||||
MODIFIER_SELECT,
|
||||
SAVE_SLOT,
|
||||
PARTY,
|
||||
SUMMARY,
|
||||
STARTER_SELECT,
|
||||
EVOLUTION_SCENE,
|
||||
EGG_HATCH_SCENE,
|
||||
EGG_HATCH_SUMMARY,
|
||||
CONFIRM,
|
||||
OPTION_SELECT,
|
||||
MENU,
|
||||
MENU_OPTION_SELECT,
|
||||
SETTINGS,
|
||||
SETTINGS_DISPLAY,
|
||||
SETTINGS_AUDIO,
|
||||
SETTINGS_GAMEPAD,
|
||||
GAMEPAD_BINDING,
|
||||
SETTINGS_KEYBOARD,
|
||||
KEYBOARD_BINDING,
|
||||
ACHIEVEMENTS,
|
||||
GAME_STATS,
|
||||
EGG_LIST,
|
||||
EGG_GACHA,
|
||||
POKEDEX,
|
||||
POKEDEX_SCAN,
|
||||
POKEDEX_PAGE,
|
||||
LOGIN_FORM,
|
||||
REGISTRATION_FORM,
|
||||
LOADING,
|
||||
SESSION_RELOAD,
|
||||
UNAVAILABLE,
|
||||
CHALLENGE_SELECT,
|
||||
RENAME_POKEMON,
|
||||
RUN_HISTORY,
|
||||
RUN_INFO,
|
||||
TEST_DIALOGUE,
|
||||
AUTO_COMPLETE,
|
||||
ADMIN,
|
||||
MYSTERY_ENCOUNTER,
|
||||
}
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
const transitionModes = [
|
||||
Mode.SAVE_SLOT,
|
||||
Mode.PARTY,
|
||||
Mode.SUMMARY,
|
||||
Mode.STARTER_SELECT,
|
||||
Mode.EVOLUTION_SCENE,
|
||||
Mode.EGG_HATCH_SCENE,
|
||||
Mode.EGG_LIST,
|
||||
Mode.EGG_GACHA,
|
||||
Mode.POKEDEX,
|
||||
Mode.POKEDEX_PAGE,
|
||||
Mode.CHALLENGE_SELECT,
|
||||
Mode.RUN_HISTORY,
|
||||
UiMode.SAVE_SLOT,
|
||||
UiMode.PARTY,
|
||||
UiMode.SUMMARY,
|
||||
UiMode.STARTER_SELECT,
|
||||
UiMode.EVOLUTION_SCENE,
|
||||
UiMode.EGG_HATCH_SCENE,
|
||||
UiMode.EGG_LIST,
|
||||
UiMode.EGG_GACHA,
|
||||
UiMode.POKEDEX,
|
||||
UiMode.POKEDEX_PAGE,
|
||||
UiMode.CHALLENGE_SELECT,
|
||||
UiMode.RUN_HISTORY,
|
||||
];
|
||||
|
||||
const noTransitionModes = [
|
||||
Mode.TITLE,
|
||||
Mode.CONFIRM,
|
||||
Mode.OPTION_SELECT,
|
||||
Mode.MENU,
|
||||
Mode.MENU_OPTION_SELECT,
|
||||
Mode.GAMEPAD_BINDING,
|
||||
Mode.KEYBOARD_BINDING,
|
||||
Mode.SETTINGS,
|
||||
Mode.SETTINGS_AUDIO,
|
||||
Mode.SETTINGS_DISPLAY,
|
||||
Mode.SETTINGS_GAMEPAD,
|
||||
Mode.SETTINGS_KEYBOARD,
|
||||
Mode.ACHIEVEMENTS,
|
||||
Mode.GAME_STATS,
|
||||
Mode.POKEDEX_SCAN,
|
||||
Mode.LOGIN_FORM,
|
||||
Mode.REGISTRATION_FORM,
|
||||
Mode.LOADING,
|
||||
Mode.SESSION_RELOAD,
|
||||
Mode.UNAVAILABLE,
|
||||
Mode.RENAME_POKEMON,
|
||||
Mode.TEST_DIALOGUE,
|
||||
Mode.AUTO_COMPLETE,
|
||||
Mode.ADMIN,
|
||||
Mode.MYSTERY_ENCOUNTER,
|
||||
Mode.RUN_INFO,
|
||||
UiMode.TITLE,
|
||||
UiMode.CONFIRM,
|
||||
UiMode.OPTION_SELECT,
|
||||
UiMode.MENU,
|
||||
UiMode.MENU_OPTION_SELECT,
|
||||
UiMode.GAMEPAD_BINDING,
|
||||
UiMode.KEYBOARD_BINDING,
|
||||
UiMode.SETTINGS,
|
||||
UiMode.SETTINGS_AUDIO,
|
||||
UiMode.SETTINGS_DISPLAY,
|
||||
UiMode.SETTINGS_GAMEPAD,
|
||||
UiMode.SETTINGS_KEYBOARD,
|
||||
UiMode.ACHIEVEMENTS,
|
||||
UiMode.GAME_STATS,
|
||||
UiMode.POKEDEX_SCAN,
|
||||
UiMode.LOGIN_FORM,
|
||||
UiMode.REGISTRATION_FORM,
|
||||
UiMode.LOADING,
|
||||
UiMode.SESSION_RELOAD,
|
||||
UiMode.UNAVAILABLE,
|
||||
UiMode.RENAME_POKEMON,
|
||||
UiMode.TEST_DIALOGUE,
|
||||
UiMode.AUTO_COMPLETE,
|
||||
UiMode.ADMIN,
|
||||
UiMode.MYSTERY_ENCOUNTER,
|
||||
UiMode.RUN_INFO,
|
||||
];
|
||||
|
||||
export default class UI extends Phaser.GameObjects.Container {
|
||||
private mode: Mode;
|
||||
private modeChain: Mode[];
|
||||
private mode: UiMode;
|
||||
private modeChain: UiMode[];
|
||||
public handlers: UiHandler[];
|
||||
private overlay: Phaser.GameObjects.Rectangle;
|
||||
public achvBar: AchvBar;
|
||||
|
@ -169,7 +122,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
constructor() {
|
||||
super(globalScene, 0, globalScene.game.canvas.height / 6);
|
||||
|
||||
this.mode = Mode.MESSAGE;
|
||||
this.mode = UiMode.MESSAGE;
|
||||
this.modeChain = [];
|
||||
this.handlers = [
|
||||
new BattleMessageUiHandler(),
|
||||
|
@ -189,7 +142,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
new ConfirmUiHandler(),
|
||||
new OptionSelectUiHandler(),
|
||||
new MenuUiHandler(),
|
||||
new OptionSelectUiHandler(Mode.MENU_OPTION_SELECT),
|
||||
new OptionSelectUiHandler(UiMode.MENU_OPTION_SELECT),
|
||||
// settings
|
||||
new SettingsUiHandler(),
|
||||
new SettingsDisplayUiHandler(),
|
||||
|
@ -203,7 +156,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
new EggListUiHandler(),
|
||||
new EggGachaUiHandler(),
|
||||
new PokedexUiHandler(),
|
||||
new PokedexScanUiHandler(Mode.TEST_DIALOGUE),
|
||||
new PokedexScanUiHandler(UiMode.TEST_DIALOGUE),
|
||||
new PokedexPageUiHandler(),
|
||||
new LoginFormUiHandler(),
|
||||
new RegistrationFormUiHandler(),
|
||||
|
@ -214,7 +167,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
new RenameFormUiHandler(),
|
||||
new RunHistoryUiHandler(),
|
||||
new RunInfoUiHandler(),
|
||||
new TestDialogueUiHandler(Mode.TEST_DIALOGUE),
|
||||
new TestDialogueUiHandler(UiMode.TEST_DIALOGUE),
|
||||
new AutoCompleteUiHandler(),
|
||||
new AdminUiHandler(),
|
||||
new MysteryEncounterUiHandler(),
|
||||
|
@ -222,7 +175,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
setup(): void {
|
||||
this.setName(`ui-${Mode[this.mode]}`);
|
||||
this.setName(`ui-${UiMode[this.mode]}`);
|
||||
for (const handler of this.handlers) {
|
||||
handler.setup();
|
||||
}
|
||||
|
@ -279,7 +232,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
getMessageHandler(): BattleMessageUiHandler {
|
||||
return this.handlers[Mode.MESSAGE] as BattleMessageUiHandler;
|
||||
return this.handlers[UiMode.MESSAGE] as BattleMessageUiHandler;
|
||||
}
|
||||
|
||||
processInfoButton(pressed: boolean) {
|
||||
|
@ -287,7 +240,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ([Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE, Mode.TARGET_SELECT].includes(this.mode)) {
|
||||
if ([UiMode.CONFIRM, UiMode.COMMAND, UiMode.FIGHT, UiMode.MESSAGE, UiMode.TARGET_SELECT].includes(this.mode)) {
|
||||
globalScene?.processInfoButton(pressed);
|
||||
return true;
|
||||
}
|
||||
|
@ -564,7 +517,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
private setModeInternal(
|
||||
mode: Mode,
|
||||
mode: UiMode,
|
||||
clear: boolean,
|
||||
forceTransition: boolean,
|
||||
chainMode: boolean,
|
||||
|
@ -587,7 +540,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
this.mode = mode;
|
||||
const touchControls = document?.getElementById("touchControls");
|
||||
if (touchControls) {
|
||||
touchControls.dataset.uiMode = Mode[mode];
|
||||
touchControls.dataset.uiMode = UiMode[mode];
|
||||
}
|
||||
this.getHandler().show(args);
|
||||
}
|
||||
|
@ -612,23 +565,23 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
});
|
||||
}
|
||||
|
||||
getMode(): Mode {
|
||||
getMode(): UiMode {
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
setMode(mode: Mode, ...args: any[]): Promise<void> {
|
||||
setMode(mode: UiMode, ...args: any[]): Promise<void> {
|
||||
return this.setModeInternal(mode, true, false, false, args);
|
||||
}
|
||||
|
||||
setModeForceTransition(mode: Mode, ...args: any[]): Promise<void> {
|
||||
setModeForceTransition(mode: UiMode, ...args: any[]): Promise<void> {
|
||||
return this.setModeInternal(mode, true, true, false, args);
|
||||
}
|
||||
|
||||
setModeWithoutClear(mode: Mode, ...args: any[]): Promise<void> {
|
||||
setModeWithoutClear(mode: UiMode, ...args: any[]): Promise<void> {
|
||||
return this.setModeInternal(mode, false, false, false, args);
|
||||
}
|
||||
|
||||
setOverlayMode(mode: Mode, ...args: any[]): Promise<void> {
|
||||
setOverlayMode(mode: UiMode, ...args: any[]): Promise<void> {
|
||||
return this.setModeInternal(mode, false, false, true, args);
|
||||
}
|
||||
|
||||
|
@ -651,7 +604,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
globalScene.updateGameInfo();
|
||||
const touchControls = document.getElementById("touchControls");
|
||||
if (touchControls) {
|
||||
touchControls.dataset.uiMode = Mode[this.mode];
|
||||
touchControls.dataset.uiMode = UiMode[this.mode];
|
||||
}
|
||||
resolve(true);
|
||||
};
|
||||
|
@ -678,7 +631,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
});
|
||||
}
|
||||
|
||||
public getModeChain(): Mode[] {
|
||||
public getModeChain(): UiMode[] {
|
||||
return this.modeChain;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { ModalUiHandler } from "./modal-ui-handler";
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import type { Mode } from "./ui";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { updateUserInfo } from "#app/account";
|
||||
import { removeCookie, sessionIdKey } from "#app/utils";
|
||||
import i18next from "i18next";
|
||||
|
@ -17,7 +17,7 @@ export default class UnavailableModalUiHandler extends ModalUiHandler {
|
|||
|
||||
private readonly randVarianceTime = 1000 * 10;
|
||||
|
||||
constructor(mode: Mode | null = null) {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
super(mode);
|
||||
this.reconnectDuration = this.minTime;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { BattleStyle } from "#app/enums/battle-style";
|
|||
import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Species } from "#enums/species";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
|
@ -40,9 +40,9 @@ describe("Ability Timing", () => {
|
|||
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
game.setMode(Mode.MESSAGE);
|
||||
game.setMode(UiMode.MESSAGE);
|
||||
game.endPhase();
|
||||
},
|
||||
() => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import Phaser from "phaser";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { getMovePosition } from "#test/testUtils/gameManagerUtils";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
|
@ -38,9 +38,9 @@ describe("Abilities - Intimidate", () => {
|
|||
await game.classicMode.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
game.setMode(Mode.MESSAGE);
|
||||
game.setMode(UiMode.MESSAGE);
|
||||
game.endPhase();
|
||||
},
|
||||
() => game.isCurrentPhase("CommandPhase") || game.isCurrentPhase("TurnInitPhase"),
|
||||
|
@ -69,9 +69,9 @@ describe("Abilities - Intimidate", () => {
|
|||
await game.classicMode.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
game.setMode(Mode.MESSAGE);
|
||||
game.setMode(UiMode.MESSAGE);
|
||||
game.endPhase();
|
||||
},
|
||||
() => game.isCurrentPhase("CommandPhase") || game.isCurrentPhase("TurnInitPhase"),
|
||||
|
|
|
@ -18,7 +18,7 @@ import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|||
import { VictoryPhase } from "#app/phases/victory-phase";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import { generateStarter } from "#test/testUtils/gameManagerUtils";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
|
@ -49,7 +49,7 @@ describe("Test Battle Phase", () => {
|
|||
it("test phase interceptor with prompt", async () => {
|
||||
await game.phaseInterceptor.run(LoginPhase);
|
||||
|
||||
game.onNextPrompt("SelectGenderPhase", Mode.OPTION_SELECT, () => {
|
||||
game.onNextPrompt("SelectGenderPhase", UiMode.OPTION_SELECT, () => {
|
||||
game.scene.gameData.gender = PlayerGender.MALE;
|
||||
game.endPhase();
|
||||
});
|
||||
|
@ -57,36 +57,36 @@ describe("Test Battle Phase", () => {
|
|||
await game.phaseInterceptor.run(SelectGenderPhase);
|
||||
|
||||
await game.phaseInterceptor.run(TitlePhase);
|
||||
await game.waitMode(Mode.TITLE);
|
||||
await game.waitMode(UiMode.TITLE);
|
||||
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.TITLE);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE);
|
||||
expect(game.scene.gameData.gender).toBe(PlayerGender.MALE);
|
||||
}, 20000);
|
||||
|
||||
it("test phase interceptor with prompt with preparation for a future prompt", async () => {
|
||||
await game.phaseInterceptor.run(LoginPhase);
|
||||
|
||||
game.onNextPrompt("SelectGenderPhase", Mode.OPTION_SELECT, () => {
|
||||
game.onNextPrompt("SelectGenderPhase", UiMode.OPTION_SELECT, () => {
|
||||
game.scene.gameData.gender = PlayerGender.MALE;
|
||||
game.endPhase();
|
||||
});
|
||||
|
||||
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
game.setMode(Mode.MESSAGE);
|
||||
game.onNextPrompt("CheckSwitchPhase", UiMode.CONFIRM, () => {
|
||||
game.setMode(UiMode.MESSAGE);
|
||||
game.endPhase();
|
||||
});
|
||||
await game.phaseInterceptor.run(SelectGenderPhase);
|
||||
|
||||
await game.phaseInterceptor.run(TitlePhase);
|
||||
await game.waitMode(Mode.TITLE);
|
||||
await game.waitMode(UiMode.TITLE);
|
||||
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.TITLE);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE);
|
||||
expect(game.scene.gameData.gender).toBe(PlayerGender.MALE);
|
||||
}, 20000);
|
||||
|
||||
it("newGame one-liner", async () => {
|
||||
await game.startBattle();
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
|
||||
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
||||
}, 20000);
|
||||
|
||||
|
@ -156,7 +156,7 @@ describe("Test Battle Phase", () => {
|
|||
await game.phaseInterceptor.run(LoginPhase);
|
||||
game.onNextPrompt(
|
||||
"SelectGenderPhase",
|
||||
Mode.OPTION_SELECT,
|
||||
UiMode.OPTION_SELECT,
|
||||
() => {
|
||||
game.scene.gameData.gender = PlayerGender.MALE;
|
||||
game.endPhase();
|
||||
|
@ -171,7 +171,7 @@ describe("Test Battle Phase", () => {
|
|||
await game.phaseInterceptor.run(LoginPhase);
|
||||
game.onNextPrompt(
|
||||
"SelectGenderPhase",
|
||||
Mode.OPTION_SELECT,
|
||||
UiMode.OPTION_SELECT,
|
||||
() => {
|
||||
game.scene.gameData.gender = PlayerGender.MALE;
|
||||
game.endPhase();
|
||||
|
@ -185,14 +185,14 @@ describe("Test Battle Phase", () => {
|
|||
await game.phaseInterceptor.run(LoginPhase);
|
||||
game.onNextPrompt(
|
||||
"SelectGenderPhase",
|
||||
Mode.OPTION_SELECT,
|
||||
UiMode.OPTION_SELECT,
|
||||
() => {
|
||||
game.scene.gameData.gender = PlayerGender.MALE;
|
||||
game.endPhase();
|
||||
},
|
||||
() => game.isCurrentPhase(TitlePhase),
|
||||
);
|
||||
game.onNextPrompt("TitlePhase", Mode.TITLE, () => {
|
||||
game.onNextPrompt("TitlePhase", UiMode.TITLE, () => {
|
||||
game.scene.gameMode = getGameMode(GameModes.CLASSIC);
|
||||
const starters = generateStarter(game.scene);
|
||||
const selectStarterPhase = new SelectStarterPhase();
|
||||
|
@ -208,7 +208,7 @@ describe("Test Battle Phase", () => {
|
|||
game.override.enemyAbility(Abilities.HYDRATION);
|
||||
game.override.ability(Abilities.HYDRATION);
|
||||
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
|
||||
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
||||
}, 20000);
|
||||
|
||||
|
@ -218,7 +218,7 @@ describe("Test Battle Phase", () => {
|
|||
game.override.enemyAbility(Abilities.HYDRATION);
|
||||
game.override.ability(Abilities.HYDRATION);
|
||||
await game.startBattle([Species.BLASTOISE]);
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
|
||||
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
||||
}, 20000);
|
||||
|
||||
|
@ -229,7 +229,7 @@ describe("Test Battle Phase", () => {
|
|||
game.override.ability(Abilities.HYDRATION);
|
||||
game.override.startingWave(3);
|
||||
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
|
||||
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
||||
}, 20000);
|
||||
|
||||
|
@ -240,7 +240,7 @@ describe("Test Battle Phase", () => {
|
|||
game.override.ability(Abilities.HYDRATION);
|
||||
game.override.startingWave(3);
|
||||
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD, Species.DARKRAI, Species.GABITE]);
|
||||
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
||||
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
|
||||
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
||||
}, 20000);
|
||||
|
||||
|
@ -328,7 +328,7 @@ describe("Test Battle Phase", () => {
|
|||
|
||||
game.onNextPrompt(
|
||||
"SwitchPhase",
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
() => {
|
||||
expect.fail("Switch was forced");
|
||||
},
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue