So many commits for so little

This commit is contained in:
Frutescens 2024-07-30 10:21:11 -07:00
parent df967c2682
commit 358101774a
1 changed files with 25 additions and 15 deletions

View File

@ -44,9 +44,11 @@ import SettingsKeyboardUiHandler from "#app/ui/settings/settings-keyboard-ui-han
import KeyboardBindingUiHandler from "#app/ui/settings/keyboard-binding-ui-handler"; import KeyboardBindingUiHandler from "#app/ui/settings/keyboard-binding-ui-handler";
import SettingsDisplayUiHandler from "./settings/settings-display-ui-handler"; import SettingsDisplayUiHandler from "./settings/settings-display-ui-handler";
import SettingsAudioUiHandler from "./settings/settings-audio-ui-handler"; import SettingsAudioUiHandler from "./settings/settings-audio-ui-handler";
import { PlayerGender } from "#enums/player-gender";
import BgmBar from "#app/ui/bgm-bar";
import RenameFormUiHandler from "./rename-form-ui-handler";
import RunHistoryUiHandler from "./run-history-ui-handler"; import RunHistoryUiHandler from "./run-history-ui-handler";
import RunInfoUiHandler from "./run-info-ui-handler"; import RunInfoUiHandler from "./run-info-ui-handler";
import { PlayerGender } from "#enums/player-gender";
export enum Mode { export enum Mode {
MESSAGE, MESSAGE,
@ -74,8 +76,6 @@ export enum Mode {
SETTINGS_KEYBOARD, SETTINGS_KEYBOARD,
KEYBOARD_BINDING, KEYBOARD_BINDING,
ACHIEVEMENTS, ACHIEVEMENTS,
RUN_HISTORY,
RUN_INFO,
GAME_STATS, GAME_STATS,
VOUCHERS, VOUCHERS,
EGG_LIST, EGG_LIST,
@ -86,7 +86,10 @@ export enum Mode {
SESSION_RELOAD, SESSION_RELOAD,
UNAVAILABLE, UNAVAILABLE,
OUTDATED, OUTDATED,
CHALLENGE_SELECT CHALLENGE_SELECT,
RENAME_POKEMON,
RUN_HISTORY,
RUN_INFO,
} }
const transitionModes = [ const transitionModes = [
@ -98,7 +101,8 @@ const transitionModes = [
Mode.EGG_HATCH_SCENE, Mode.EGG_HATCH_SCENE,
Mode.EGG_LIST, Mode.EGG_LIST,
Mode.EGG_GACHA, Mode.EGG_GACHA,
Mode.CHALLENGE_SELECT Mode.CHALLENGE_SELECT,
Mode.RUN_HISTORY,
]; ];
const noTransitionModes = [ const noTransitionModes = [
@ -118,12 +122,12 @@ const noTransitionModes = [
Mode.GAME_STATS, Mode.GAME_STATS,
Mode.VOUCHERS, Mode.VOUCHERS,
Mode.LOGIN_FORM, Mode.LOGIN_FORM,
Mode.RUN_HISTORY,
Mode.REGISTRATION_FORM, Mode.REGISTRATION_FORM,
Mode.LOADING, Mode.LOADING,
Mode.SESSION_RELOAD, Mode.SESSION_RELOAD,
Mode.UNAVAILABLE, Mode.UNAVAILABLE,
Mode.OUTDATED Mode.OUTDATED,
Mode.RENAME_POKEMON,
]; ];
export default class UI extends Phaser.GameObjects.Container { export default class UI extends Phaser.GameObjects.Container {
@ -132,6 +136,7 @@ export default class UI extends Phaser.GameObjects.Container {
public handlers: UiHandler[]; public handlers: UiHandler[];
private overlay: Phaser.GameObjects.Rectangle; private overlay: Phaser.GameObjects.Rectangle;
public achvBar: AchvBar; public achvBar: AchvBar;
public bgmBar: BgmBar;
public savingIcon: SavingIconHandler; public savingIcon: SavingIconHandler;
private tooltipContainer: Phaser.GameObjects.Container; private tooltipContainer: Phaser.GameObjects.Container;
@ -164,6 +169,7 @@ export default class UI extends Phaser.GameObjects.Container {
new OptionSelectUiHandler(scene), new OptionSelectUiHandler(scene),
new MenuUiHandler(scene), new MenuUiHandler(scene),
new OptionSelectUiHandler(scene, Mode.MENU_OPTION_SELECT), new OptionSelectUiHandler(scene, Mode.MENU_OPTION_SELECT),
// settings
new SettingsUiHandler(scene), new SettingsUiHandler(scene),
new SettingsDisplayUiHandler(scene), new SettingsDisplayUiHandler(scene),
new SettingsAudioUiHandler(scene), new SettingsAudioUiHandler(scene),
@ -172,8 +178,6 @@ export default class UI extends Phaser.GameObjects.Container {
new SettingsKeyboardUiHandler(scene), new SettingsKeyboardUiHandler(scene),
new KeyboardBindingUiHandler(scene), new KeyboardBindingUiHandler(scene),
new AchvsUiHandler(scene), new AchvsUiHandler(scene),
new RunHistoryUiHandler(scene),
new RunInfoUiHandler(scene),
new GameStatsUiHandler(scene), new GameStatsUiHandler(scene),
new VouchersUiHandler(scene), new VouchersUiHandler(scene),
new EggListUiHandler(scene), new EggListUiHandler(scene),
@ -184,16 +188,20 @@ export default class UI extends Phaser.GameObjects.Container {
new SessionReloadModalUiHandler(scene), new SessionReloadModalUiHandler(scene),
new UnavailableModalUiHandler(scene), new UnavailableModalUiHandler(scene),
new OutdatedModalUiHandler(scene), new OutdatedModalUiHandler(scene),
new GameChallengesUiHandler(scene) new GameChallengesUiHandler(scene),
new RenameFormUiHandler(scene),
new RunHistoryUiHandler(scene),
new RunInfoUiHandler(scene),
]; ];
} }
setup(): void { setup(): void {
this.setName("container-ui"); this.setName(`ui-${Mode[this.mode]}`);
for (const handler of this.handlers) { for (const handler of this.handlers) {
handler.setup(); handler.setup();
} }
this.overlay = this.scene.add.rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6, 0); this.overlay = this.scene.add.rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6, 0);
this.overlay.setName("rect-ui-overlay");
this.overlay.setOrigin(0, 0); this.overlay.setOrigin(0, 0);
(this.scene as BattleScene).uiContainer.add(this.overlay); (this.scene as BattleScene).uiContainer.add(this.overlay);
this.overlay.setVisible(false); this.overlay.setVisible(false);
@ -212,15 +220,19 @@ export default class UI extends Phaser.GameObjects.Container {
private setupTooltip() { private setupTooltip() {
this.tooltipContainer = this.scene.add.container(0, 0); this.tooltipContainer = this.scene.add.container(0, 0);
this.tooltipContainer.setName("tooltip");
this.tooltipContainer.setVisible(false); this.tooltipContainer.setVisible(false);
this.tooltipBg = addWindow(this.scene as BattleScene, 0, 0, 128, 31); this.tooltipBg = addWindow(this.scene as BattleScene, 0, 0, 128, 31);
this.tooltipBg.setName("window-tooltip-bg");
this.tooltipBg.setOrigin(0, 0); this.tooltipBg.setOrigin(0, 0);
this.tooltipTitle = addTextObject(this.scene, 64, 4, "", TextStyle.TOOLTIP_TITLE); this.tooltipTitle = addTextObject(this.scene, 64, 4, "", TextStyle.TOOLTIP_TITLE);
this.tooltipTitle.setName("text-tooltip-title");
this.tooltipTitle.setOrigin(0.5, 0); this.tooltipTitle.setOrigin(0.5, 0);
this.tooltipContent = addTextObject(this.scene, 6, 16, "", TextStyle.TOOLTIP_CONTENT); this.tooltipContent = addTextObject(this.scene, 6, 16, "", TextStyle.TOOLTIP_CONTENT);
this.tooltipContent.setName("text-tooltip-content");
this.tooltipContent.setWordWrapWidth(696); this.tooltipContent.setWordWrapWidth(696);
this.tooltipContainer.add(this.tooltipBg); this.tooltipContainer.add(this.tooltipBg);
@ -230,8 +242,8 @@ export default class UI extends Phaser.GameObjects.Container {
(this.scene as BattleScene).uiContainer.add(this.tooltipContainer); (this.scene as BattleScene).uiContainer.add(this.tooltipContainer);
} }
getHandler(): UiHandler { getHandler<H extends UiHandler = UiHandler>(): H {
return this.handlers[this.mode]; return this.handlers[this.mode] as H;
} }
getMessageHandler(): BattleMessageUiHandler { getMessageHandler(): BattleMessageUiHandler {
@ -248,7 +260,6 @@ export default class UI extends Phaser.GameObjects.Container {
battleScene?.processInfoButton(pressed); battleScene?.processInfoButton(pressed);
return true; return true;
} }
battleScene?.processInfoButton(false); battleScene?.processInfoButton(false);
return true; return true;
} }
@ -455,7 +466,6 @@ export default class UI extends Phaser.GameObjects.Container {
touchControls.dataset.uiMode = Mode[mode]; touchControls.dataset.uiMode = Mode[mode];
} }
this.getHandler().show(args); this.getHandler().show(args);
console.log(args);
} }
resolve(); resolve();
}; };