diff --git a/package.json b/package.json index f100b3865d2..d96c6c50bbe 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,9 @@ }, "imports": { "#app": "./src/main.js", - "#app/*": "./src/*" + "#app/*": "./src/*", + "#constants/*": "./src/constants/*", + "#enums/*": "./src/enums/*", + "#interfaces/*": "./src/interfaces/*" } } diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 5d2e2888c64..e0039dd2fbb 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -13,7 +13,7 @@ import { Biome } from "./data/enums/biome"; import { Arena, ArenaBase } from "./field/arena"; import { GameData } from "./system/game-data"; import { PlayerGender } from "./data/enums/player-gender"; -import { TextStyle, addTextObject, getTextColor } from "./ui/text"; +import { addTextObject, getTextColor } from "./ui/text"; import { Moves } from "./data/enums/moves"; import { allMoves } from "./data/move"; import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from "./modifier/modifier-type"; @@ -61,8 +61,9 @@ import { MoneyFormat } from "./enums/money-format"; import { NewArenaEvent } from "./events/battle-scene"; import { Abilities } from "./data/enums/abilities"; import ArenaFlyout from "./ui/arena-flyout"; -import { EaseType } from "./ui/enums/ease-type"; +import { EaseType } from "./enums/ease-type"; import { ExpNotification } from "./enums/exp-notification"; +import { TextStyle } from "#enums/text"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; diff --git a/src/constants/text.ts b/src/constants/text.ts new file mode 100644 index 00000000000..17e3ef9c7f2 --- /dev/null +++ b/src/constants/text.ts @@ -0,0 +1,27 @@ +export const FontConfig = { + XS: { + fontSize: 56, + offsetX: 3, + offsetY: 3 + }, + S: { + fontSize: 64, + offsetX: 3, + offsetY: 3 + }, + M: { + fontSize: 66, + offsetX: 3.5, + offsetY: 3.5 + }, + L: { + fontSize: 72, + offsetX: 3.5, + offsetY: 3.5 + }, + XL: { + fontSize: 96, + offsetX: 4, + offsetY: 4 + }, +}; diff --git a/src/data/nature.ts b/src/data/nature.ts index c9709d5ee4c..e6400e28709 100644 --- a/src/data/nature.ts +++ b/src/data/nature.ts @@ -1,6 +1,7 @@ import { Stat, getStatName } from "./pokemon-stat"; import * as Utils from "../utils"; -import { TextStyle, getBBCodeFrag } from "../ui/text"; +import { getBBCodeFrag } from "../ui/text"; +import { TextStyle } from "#enums/text.js"; import { UiTheme } from "#app/enums/ui-theme"; import i18next from "i18next"; @@ -53,7 +54,11 @@ export function getNatureName(nature: Nature, includeStatEffects: boolean = fals const textStyle = forStarterSelect ? TextStyle.SUMMARY_ALT : TextStyle.WINDOW; const getTextFrag = !ignoreBBCode ? (text: string, style: TextStyle) => getBBCodeFrag(text, style, uiTheme) : (text: string, style: TextStyle) => text; if (increasedStat && decreasedStat) { - ret = `${getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(`, textStyle)}${getTextFrag(`+${getStatName(increasedStat, true)}`, TextStyle.SUMMARY_PINK)}${getTextFrag("/", textStyle)}${getTextFrag(`-${getStatName(decreasedStat, true)}`, TextStyle.SUMMARY_BLUE)}${getTextFrag(")", textStyle)}`; + ret = `${getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(`, textStyle)}`; + ret += `${getTextFrag(`+${getStatName(increasedStat, true)}`, TextStyle.SUMMARY_PINK)}`; + ret += `${getTextFrag("/", textStyle)}`; + ret += `${getTextFrag(`-${getStatName(decreasedStat, true)}`, TextStyle.SUMMARY_BLUE)}`; + ret += `${getTextFrag(")", textStyle)}`; } else { ret = getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(-)`, textStyle); } diff --git a/src/enums/color.ts b/src/enums/color.ts new file mode 100644 index 00000000000..6992b9327c3 --- /dev/null +++ b/src/enums/color.ts @@ -0,0 +1,42 @@ +export enum Color { + WHITE = "#ffffff", + OFF_WHITE = "#f8f8f8", + LIGHT_GREY = "#a0a0a0", + GREY = "#484848", + DARK_GREY = "#404040", + PINK = "#f89890", + RED = "#e13d3d", + RED2 = "#e70808", + REDORANGE = "#d64b00", + ORANGE = "#f8b050", + LIGHT_YELLOW = "#e8e8a8", + YELLOW = "#ccbe00", + DARK_YELLOW = "#a68e17", + GREEN = "#78c850", + BLUE = "#40c8f8", + COMMON = "#ffffff", + GREAT = "#3890f8", + ULTRA = "#f8d038", + ROGUE = "#d52929", + MASTER = "#e020c0", + LUXURY = "#e64a18" +} + + +export enum ShadowColor { + GREY = "#636363", + PURPLE = "#6b5a73", + LIGHT_GREY = "#d0d0c8", + BROWN = "#69402a", + PINK = "#fca2a2", + BRIGHT_RED = "#f83018", + RED = "#984038", + MAROON = "#632929", + GREEN = "#306850", + BLUE = "#006090", + LIGHT_YELLOW = "#ded6b5", + YELLOW = "#ebd773", + DARK_YELLOW = "#a0a060", + ORANGE = "#c07800", + LIGHT_ORANGE = "#ffbd73", +} diff --git a/src/ui/enums/ease-type.ts b/src/enums/ease-type.ts similarity index 100% rename from src/ui/enums/ease-type.ts rename to src/enums/ease-type.ts diff --git a/src/enums/text.ts b/src/enums/text.ts new file mode 100644 index 00000000000..8516b47ca10 --- /dev/null +++ b/src/enums/text.ts @@ -0,0 +1,29 @@ +export enum TextStyle { + MESSAGE, + WINDOW, + WINDOW_ALT, + BATTLE_INFO, + PARTY, + PARTY_RED, + SUMMARY, + SUMMARY_ALT, + SUMMARY_RED, + SUMMARY_BLUE, + SUMMARY_PINK, + SUMMARY_GOLD, + SUMMARY_GRAY, + SUMMARY_GREEN, + MONEY, + STATS_LABEL, + STATS_VALUE, + SETTINGS_LABEL, + SETTINGS_SELECTED, + SETTINGS_LOCKED, + TOOLTIP_TITLE, + TOOLTIP_CONTENT, + MOVE_INFO_CONTENT, + MOVE_PP_FULL, + MOVE_PP_HALF_FULL, + MOVE_PP_NEAR_EMPTY, + MOVE_PP_EMPTY +} diff --git a/src/field/damage-number-handler.ts b/src/field/damage-number-handler.ts index cebde7c3ae9..46182418409 100644 --- a/src/field/damage-number-handler.ts +++ b/src/field/damage-number-handler.ts @@ -1,4 +1,5 @@ -import { TextStyle, addTextObject } from "../ui/text"; +import { addTextObject } from "../ui/text"; +import { TextStyle } from "#enums/text.js"; import Pokemon, { DamageResult, HitResult } from "./pokemon"; import * as Utils from "../utils"; import { BattlerIndex } from "../battle"; diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index e3434a824f6..3f818e4b355 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -22,7 +22,7 @@ import { FormChangeItem, SpeciesFormChangeItemTrigger, pokemonFormChanges } from import { ModifierTier } from "./modifier-tier"; import { Nature, getNatureName, getNatureStatMultiplier } from "#app/data/nature"; import i18next from "#app/plugins/i18n"; -import { getModifierTierTextTint } from "#app/ui/text"; +import { getModifierTierTextTint } from "#app/ui/text.js"; import { BattlerTagType } from "#app/data/enums/battler-tag-type.js"; import * as Overrides from "../overrides"; import { MoneyMultiplierModifier } from "./modifier"; diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 832c16ee4a9..2488aaa749b 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -5,7 +5,8 @@ import { getLevelTotalExp } from "../data/exp"; import { PokeballType } from "../data/pokeball"; import Pokemon, { PlayerPokemon } from "../field/pokemon"; import { Stat } from "../data/pokemon-stat"; -import { addTextObject, TextStyle } from "../ui/text"; +import { addTextObject } from "../ui/text"; +import { TextStyle } from "#enums/text.js"; import { Type } from "../data/type"; import { EvolutionPhase } from "../evolution-phase"; import { FusionSpeciesFormEvolution, pokemonEvolutions, pokemonPrevolutions } from "../data/pokemon-evolutions"; diff --git a/src/phases.ts b/src/phases.ts index 04212e284a0..5660d809169 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -60,7 +60,8 @@ import PokemonSpecies, { getPokemonSpecies, speciesStarters } from "./data/pokem import i18next from "./plugins/i18n"; import { Abilities } from "./data/enums/abilities"; import * as Overrides from "./overrides"; -import { TextStyle, addTextObject } from "./ui/text"; +import { addTextObject } from "./ui/text"; +import { TextStyle } from "#enums/text.js"; import { Type } from "./data/type"; import { BerryUsedEvent, EncounterPhaseEvent, MoveUsedEvent, TurnEndEvent, TurnInitEvent } from "./events/battle-scene"; import { ExpNotification } from "./enums/exp-notification"; diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index fb446e1e081..97aec50b7b8 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -7,7 +7,7 @@ import { PlayerGender } from "#app/data/enums/player-gender"; import { CandyUpgradeNotificationChangedEvent } from "../../events/battle-scene"; import { MoneyFormat } from "../../enums/money-format"; import SettingsUiHandler from "#app/ui/settings/settings-ui-handler"; -import { EaseType } from "#app/ui/enums/ease-type.js"; +import { EaseType } from "#enums/ease-type.js"; const MUTE = "Mute"; const VOLUME_OPTIONS = new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : MUTE); diff --git a/src/ui/ability-bar.ts b/src/ui/ability-bar.ts index 58717c3d2d0..aa0a8624604 100644 --- a/src/ui/ability-bar.ts +++ b/src/ui/ability-bar.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import Pokemon from "../field/pokemon"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; const hiddenX = -118; const shownX = 0; diff --git a/src/ui/abstact-option-select-ui-handler.ts b/src/ui/abstact-option-select-ui-handler.ts index 568c8208eac..24a3810b0a5 100644 --- a/src/ui/abstact-option-select-ui-handler.ts +++ b/src/ui/abstact-option-select-ui-handler.ts @@ -1,11 +1,13 @@ import BattleScene from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject2 } from "./text"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import { addWindow } from "./ui-theme"; import * as Utils from "../utils"; import { argbFromRgba } from "@material/material-color-utilities"; import {Button} from "../enums/buttons"; +import { Color, ShadowColor } from "#app/enums/color.js"; +import { FontConfig } from "#app/constants/text.js"; export interface OptionSelectConfig { xOffset?: number; @@ -81,7 +83,13 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler { this.optionSelectIcons.splice(0, this.optionSelectIcons.length); } - this.optionSelectText = addTextObject(this.scene, 0, 0, options.map(o => o.item ? ` ${o.label}` : o.label).join("\n"), TextStyle.WINDOW, { maxLines: options.length }); + const optionsText = options.map(o => o.item ? ` ${o.label}` : o.label).join("\n"); + const optionTextStyle = { + color: this.scene.uiTheme ? Color.GREY : Color.OFF_WHITE, + shadowColor: this.scene.uiTheme ? ShadowColor.LIGHT_GREY : ShadowColor.PURPLE, + fontConfig: FontConfig.XL + }; + this.optionSelectText = addTextObject2(this.scene, 0, 0, optionsText, optionTextStyle, { maxLines: options.length }); this.optionSelectText.setLineSpacing(12); this.optionSelectContainer.add(this.optionSelectText); this.optionSelectContainer.setPosition((this.scene.game.canvas.width / 6) - 1 - (this.config?.xOffset || 0), -48 + (this.config?.yOffset || 0)); diff --git a/src/ui/achv-bar.ts b/src/ui/achv-bar.ts index 9e9b20795e3..b749fa0c5f2 100644 --- a/src/ui/achv-bar.ts +++ b/src/ui/achv-bar.ts @@ -1,7 +1,8 @@ import BattleScene from "../battle-scene"; import { Achv, getAchievementDescription } from "../system/achv"; import { Voucher } from "../system/voucher"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { PlayerGender } from "#app/data/enums/player-gender"; export default class AchvBar extends Phaser.GameObjects.Container { diff --git a/src/ui/achvs-ui-handler.ts b/src/ui/achvs-ui-handler.ts index 464a967cbfd..55521e22494 100644 --- a/src/ui/achvs-ui-handler.ts +++ b/src/ui/achvs-ui-handler.ts @@ -3,7 +3,8 @@ import { Button } from "../enums/buttons"; import i18next from "../plugins/i18n"; import { Achv, achvs, getAchievementDescription } from "../system/achv"; import MessageUiHandler from "./message-ui-handler"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; import { PlayerGender } from "#app/data/enums/player-gender"; diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 5793582d6c4..84bd3779f47 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -1,4 +1,5 @@ -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import BattleScene from "#app/battle-scene.js"; import { ArenaTagSide } from "#app/data/arena-tag.js"; import { WeatherType } from "#app/data/weather.js"; diff --git a/src/ui/ball-ui-handler.ts b/src/ui/ball-ui-handler.ts index b96dd799b18..13da90ed291 100644 --- a/src/ui/ball-ui-handler.ts +++ b/src/ui/ball-ui-handler.ts @@ -1,7 +1,8 @@ import { CommandPhase } from "../phases"; import BattleScene from "../battle-scene"; import { getPokeballName } from "../data/pokeball"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Command } from "./command-ui-handler"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; diff --git a/src/ui/battle-flyout.ts b/src/ui/battle-flyout.ts index 812969a988d..47b60b1f5c8 100644 --- a/src/ui/battle-flyout.ts +++ b/src/ui/battle-flyout.ts @@ -1,5 +1,6 @@ import { default as Pokemon } from "../field/pokemon"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import * as Utils from "../utils"; import BattleScene from "#app/battle-scene.js"; import { UiTheme } from "#app/enums/ui-theme.js"; diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index c246af73d07..fe17c2e8a61 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -1,7 +1,8 @@ import { EnemyPokemon, default as Pokemon } from "../field/pokemon"; import { getLevelTotalExp, getLevelRelExp } from "../data/exp"; import * as Utils from "../utils"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { getGenderSymbol, getGenderColor, Gender } from "../data/gender"; import { StatusEffect } from "../data/status-effect"; import BattleScene from "../battle-scene"; diff --git a/src/ui/battle-message-ui-handler.ts b/src/ui/battle-message-ui-handler.ts index 0f856cbb390..76a0e621730 100644 --- a/src/ui/battle-message-ui-handler.ts +++ b/src/ui/battle-message-ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene from "../battle-scene"; -import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "./text"; +import { addBBCodeTextObject, addTextObject, getTextColor} from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import * as Utils from "../utils"; import MessageUiHandler from "./message-ui-handler"; diff --git a/src/ui/candy-bar.ts b/src/ui/candy-bar.ts index 84d1c2f70e7..c13c784c550 100644 --- a/src/ui/candy-bar.ts +++ b/src/ui/candy-bar.ts @@ -1,5 +1,6 @@ import BattleScene, { starterColors } from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { argbFromRgba } from "@material/material-color-utilities"; import * as Utils from "../utils"; import { Species } from "#app/data/enums/species"; diff --git a/src/ui/challenges-select-ui-handler.ts b/src/ui/challenges-select-ui-handler.ts index 092d954eae7..f7a2e91ae04 100644 --- a/src/ui/challenges-select-ui-handler.ts +++ b/src/ui/challenges-select-ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import { addWindow } from "./ui-theme"; diff --git a/src/ui/command-ui-handler.ts b/src/ui/command-ui-handler.ts index 7c21d5cc142..34a7ac02af4 100644 --- a/src/ui/command-ui-handler.ts +++ b/src/ui/command-ui-handler.ts @@ -1,6 +1,7 @@ import { CommandPhase } from "../phases"; import BattleScene from "../battle-scene"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import PartyUiHandler, { PartyUiMode } from "./party-ui-handler"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; diff --git a/src/ui/daily-run-scoreboard.ts b/src/ui/daily-run-scoreboard.ts index aa0cce62525..8d24dbddea0 100644 --- a/src/ui/daily-run-scoreboard.ts +++ b/src/ui/daily-run-scoreboard.ts @@ -1,5 +1,6 @@ import BattleScene from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { WindowVariant, addWindow } from "./ui-theme"; import * as Utils from "../utils"; import i18next from "i18next"; diff --git a/src/ui/egg-counter-container.ts b/src/ui/egg-counter-container.ts index 1c5779ef777..e288bd73fb1 100644 --- a/src/ui/egg-counter-container.ts +++ b/src/ui/egg-counter-container.ts @@ -1,6 +1,7 @@ import BattleScene from "#app/battle-scene.js"; import { addWindow } from "./ui-theme"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { EggCountChangedEvent, EggEventType } from "#app/events/egg.js"; import EggHatchSceneHandler from "./egg-hatch-scene-handler"; diff --git a/src/ui/egg-gacha-ui-handler.ts b/src/ui/egg-gacha-ui-handler.ts index 96874f439ff..dedb26f9965 100644 --- a/src/ui/egg-gacha-ui-handler.ts +++ b/src/ui/egg-gacha-ui-handler.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import { Mode } from "./ui"; -import { TextStyle, addTextObject, getEggTierTextTint } from "./text"; +import { addTextObject, getEggTierTextTint } from "./text"; +import { TextStyle } from "#enums/text.js"; import MessageUiHandler from "./message-ui-handler"; import * as Utils from "../utils"; import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp } from "../data/egg"; diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index 653789d4a20..b7f2a69b522 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -1,7 +1,8 @@ import BattleScene from "../battle-scene"; import { Mode } from "./ui"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import MessageUiHandler from "./message-ui-handler"; import { Egg, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from "../data/egg"; import { addWindow } from "./ui-theme"; diff --git a/src/ui/evolution-scene-handler.ts b/src/ui/evolution-scene-handler.ts index 12b6ccc93d1..5d6cc9e5f00 100644 --- a/src/ui/evolution-scene-handler.ts +++ b/src/ui/evolution-scene-handler.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import MessageUiHandler from "./message-ui-handler"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import {Button} from "../enums/buttons"; diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 657c8b7e311..13818a16b31 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene from "../battle-scene"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { getTypeDamageMultiplierColor, Type } from "../data/type"; import { Command } from "./command-ui-handler"; import { Mode } from "./ui"; diff --git a/src/ui/form-modal-ui-handler.ts b/src/ui/form-modal-ui-handler.ts index 227315f0b69..3e77d08ba32 100644 --- a/src/ui/form-modal-ui-handler.ts +++ b/src/ui/form-modal-ui-handler.ts @@ -1,7 +1,8 @@ import BattleScene from "../battle-scene"; import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; import { Mode } from "./ui"; -import { TextStyle, addTextInputObject, addTextObject } from "./text"; +import { addTextInputObject, addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { WindowVariant, addWindow } from "./ui-theme"; import InputText from "phaser3-rex-plugins/plugins/inputtext"; import * as Utils from "../utils"; diff --git a/src/ui/game-stats-ui-handler.ts b/src/ui/game-stats-ui-handler.ts index 57a02257810..ee0d013acb8 100644 --- a/src/ui/game-stats-ui-handler.ts +++ b/src/ui/game-stats-ui-handler.ts @@ -1,6 +1,7 @@ import Phaser from "phaser"; import BattleScene from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import { addWindow } from "./ui-theme"; diff --git a/src/ui/loading-modal-ui-handler.ts b/src/ui/loading-modal-ui-handler.ts index c335b59de9f..dafb8a228ed 100644 --- a/src/ui/loading-modal-ui-handler.ts +++ b/src/ui/loading-modal-ui-handler.ts @@ -1,7 +1,8 @@ import i18next from "i18next"; import BattleScene from "../battle-scene"; import { ModalUiHandler } from "./modal-ui-handler"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; export default class LoadingModalUiHandler extends ModalUiHandler { diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index a0b0c5da66b..a010709bc5b 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene, { bypassLogin } from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import * as Utils from "../utils"; import { addWindow } from "./ui-theme"; diff --git a/src/ui/modal-ui-handler.ts b/src/ui/modal-ui-handler.ts index b521ec43759..42ec1ede7da 100644 --- a/src/ui/modal-ui-handler.ts +++ b/src/ui/modal-ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import { WindowVariant, addWindow } from "./ui-theme"; diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 9a17f6e344d..8f8d3f35108 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -1,7 +1,8 @@ import BattleScene from "../battle-scene"; import { getPlayerShopModifierTypeOptionsForWave, ModifierTypeOption, TmModifierType } from "../modifier/modifier-type"; import { getPokeballAtlasKey, PokeballType } from "../data/pokeball"; -import { addTextObject, getModifierTierTextTint, getTextColor, TextStyle } from "./text"; +import { addTextObject, getModifierTierTextTint, getTextColor } from "./text"; +import { TextStyle } from "#enums/text.js"; import AwaitableUiHandler from "./awaitable-ui-handler"; import { Mode } from "./ui"; import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier"; diff --git a/src/ui/move-info-overlay.ts b/src/ui/move-info-overlay.ts index 3b947cb842d..72056e4d3b1 100644 --- a/src/ui/move-info-overlay.ts +++ b/src/ui/move-info-overlay.ts @@ -1,5 +1,6 @@ import BattleScene, {InfoToggle} from "../battle-scene"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { addWindow } from "./ui-theme"; import * as Utils from "../utils"; import Move, { MoveCategory } from "../data/move"; diff --git a/src/ui/outdated-modal-ui-handler.ts b/src/ui/outdated-modal-ui-handler.ts index 1e737cf638b..b1aded58079 100644 --- a/src/ui/outdated-modal-ui-handler.ts +++ b/src/ui/outdated-modal-ui-handler.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; export default class OutdatedModalUiHandler extends ModalUiHandler { diff --git a/src/ui/party-exp-bar.ts b/src/ui/party-exp-bar.ts index 506b8b5c825..7e6afb5e56f 100644 --- a/src/ui/party-exp-bar.ts +++ b/src/ui/party-exp-bar.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import Pokemon from "../field/pokemon"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; export default class PartyExpBar extends Phaser.GameObjects.Container { private bg: Phaser.GameObjects.NineSlice; diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index d965345d3de..a8327ce3e6c 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -1,7 +1,8 @@ import { CommandPhase, SelectModifierPhase } from "../phases"; import BattleScene from "../battle-scene"; import { PlayerPokemon, PokemonMove } from "../field/pokemon"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Command } from "./command-ui-handler"; import MessageUiHandler from "./message-ui-handler"; import { Mode } from "./ui"; diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index f28cf2e8a48..a39f88de17b 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -10,7 +10,8 @@ import { DexAttr } from "../system/game-data"; import * as Utils from "../utils"; import ConfirmUiHandler from "./confirm-ui-handler"; import { StatsContainer } from "./stats-container"; -import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "./text"; +import { TextStyle } from "#enums/text.js"; import { addWindow } from "./ui-theme"; interface LanguageSetting { diff --git a/src/ui/registration-form-ui-handler.ts b/src/ui/registration-form-ui-handler.ts index e4bb5c6395b..8b11ee639a3 100644 --- a/src/ui/registration-form-ui-handler.ts +++ b/src/ui/registration-form-ui-handler.ts @@ -2,7 +2,8 @@ import { FormModalUiHandler } from "./form-modal-ui-handler"; import { ModalConfig } from "./modal-ui-handler"; import * as Utils from "../utils"; import { Mode } from "./ui"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import i18next from "../plugins/i18n"; export default class RegistrationFormUiHandler extends FormModalUiHandler { diff --git a/src/ui/save-slot-select-ui-handler.ts b/src/ui/save-slot-select-ui-handler.ts index e5417f83596..654b0c0cb2c 100644 --- a/src/ui/save-slot-select-ui-handler.ts +++ b/src/ui/save-slot-select-ui-handler.ts @@ -7,7 +7,8 @@ import { SessionSaveData } from "../system/game-data"; import PokemonData from "../system/pokemon-data"; import * as Utils from "../utils"; import MessageUiHandler from "./message-ui-handler"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; diff --git a/src/ui/session-reload-modal-ui-handler.ts b/src/ui/session-reload-modal-ui-handler.ts index 5313de58580..ba13265856e 100644 --- a/src/ui/session-reload-modal-ui-handler.ts +++ b/src/ui/session-reload-modal-ui-handler.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; export default class SessionReloadModalUiHandler extends ModalUiHandler { diff --git a/src/ui/settings/abstract-binding-ui-handler.ts b/src/ui/settings/abstract-binding-ui-handler.ts index fe0736ce101..db35dd80fa0 100644 --- a/src/ui/settings/abstract-binding-ui-handler.ts +++ b/src/ui/settings/abstract-binding-ui-handler.ts @@ -2,7 +2,8 @@ import UiHandler from "../ui-handler"; import BattleScene from "../../battle-scene"; import {Mode} from "../ui"; import {addWindow} from "../ui-theme"; -import {addTextObject, TextStyle} from "../text"; +import {addTextObject } from "../text"; +import { TextStyle } from "#enums/text.js"; import {Button} from "../../enums/buttons"; import {NavigationManager} from "#app/ui/settings/navigationMenu"; diff --git a/src/ui/settings/abstract-control-settings-ui-handler.ts b/src/ui/settings/abstract-control-settings-ui-handler.ts index b8165d41980..afb75068675 100644 --- a/src/ui/settings/abstract-control-settings-ui-handler.ts +++ b/src/ui/settings/abstract-control-settings-ui-handler.ts @@ -3,8 +3,9 @@ import BattleScene from "../../battle-scene"; import {Mode} from "../ui"; import {InterfaceConfig} from "../../inputs-controller"; import {addWindow} from "../ui-theme"; -import {addTextObject, TextStyle} from "../text"; -import {Button} from "../../enums/buttons"; +import {addTextObject } from "../text"; +import { TextStyle } from "#enums/text.js"; +import {Button} from "#enums/buttons"; import {getIconWithSettingName} from "#app/configs/inputs/configHandler"; import NavigationMenu, {NavigationManager} from "#app/ui/settings/navigationMenu"; import { Device } from "#app/enums/devices.js"; diff --git a/src/ui/settings/abstract-settings-ui-handler.ts b/src/ui/settings/abstract-settings-ui-handler.ts index 87d6a611662..1da8a8f16b0 100644 --- a/src/ui/settings/abstract-settings-ui-handler.ts +++ b/src/ui/settings/abstract-settings-ui-handler.ts @@ -1,6 +1,7 @@ import BattleScene from "../../battle-scene"; import { hasTouchscreen, isMobile } from "../../touch-controls"; -import { TextStyle, addTextObject } from "../text"; +import { addTextObject } from "../text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "../ui"; import UiHandler from "../ui-handler"; import { addWindow } from "../ui-theme"; diff --git a/src/ui/settings/gamepad-binding-ui-handler.ts b/src/ui/settings/gamepad-binding-ui-handler.ts index 1ab705d3278..ce0c8de6fd9 100644 --- a/src/ui/settings/gamepad-binding-ui-handler.ts +++ b/src/ui/settings/gamepad-binding-ui-handler.ts @@ -3,7 +3,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler"; import {Mode} from "../ui"; import {Device} from "#app/enums/devices"; import {getIconWithSettingName, getKeyWithKeycode} from "#app/configs/inputs/configHandler"; -import {addTextObject, TextStyle} from "#app/ui/text"; +import {addTextObject } from "#app/ui/text.js"; +import { TextStyle } from "#enums/text.js"; export default class GamepadBindingUiHandler extends AbstractBindingUiHandler { diff --git a/src/ui/settings/keyboard-binding-ui-handler.ts b/src/ui/settings/keyboard-binding-ui-handler.ts index ca490857200..99d6e52a62a 100644 --- a/src/ui/settings/keyboard-binding-ui-handler.ts +++ b/src/ui/settings/keyboard-binding-ui-handler.ts @@ -3,7 +3,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler"; import {Mode} from "../ui"; import { getKeyWithKeycode} from "#app/configs/inputs/configHandler"; import {Device} from "#app/enums/devices"; -import {addTextObject, TextStyle} from "#app/ui/text"; +import {addTextObject } from "#app/ui/text.js"; +import { TextStyle } from "#enums/text.js"; export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler { diff --git a/src/ui/settings/navigationMenu.ts b/src/ui/settings/navigationMenu.ts index c35e60d3ac7..7791accd39d 100644 --- a/src/ui/settings/navigationMenu.ts +++ b/src/ui/settings/navigationMenu.ts @@ -1,7 +1,8 @@ import BattleScene from "#app/battle-scene"; import {Mode} from "#app/ui/ui"; import {InputsIcons} from "#app/ui/settings/abstract-control-settings-ui-handler.js"; -import {addTextObject, setTextStyle, TextStyle} from "#app/ui/text"; +import {addTextObject, setTextStyle } from "#app/ui/text.js"; +import { TextStyle } from "#enums/text.js"; import {addWindow} from "#app/ui/ui-theme"; import {Button} from "#app/enums/buttons"; diff --git a/src/ui/settings/settings-gamepad-ui-handler.ts b/src/ui/settings/settings-gamepad-ui-handler.ts index 20a713012ae..0a6fb89f500 100644 --- a/src/ui/settings/settings-gamepad-ui-handler.ts +++ b/src/ui/settings/settings-gamepad-ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene from "../../battle-scene"; -import {addTextObject, TextStyle} from "../text"; +import {addTextObject } from "../text"; +import { TextStyle } from "#enums/text.js"; import {Mode} from "../ui"; import { setSettingGamepad, @@ -13,7 +14,7 @@ import pad_dualshock from "#app/configs/inputs/pad_dualshock"; import pad_unlicensedSNES from "#app/configs/inputs/pad_unlicensedSNES"; import {InterfaceConfig} from "#app/inputs-controller"; import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler.js"; -import {Device} from "#app/enums/devices"; +import {Device} from "#enums/devices"; import {truncateString} from "#app/utils"; /** diff --git a/src/ui/settings/settings-keyboard-ui-handler.ts b/src/ui/settings/settings-keyboard-ui-handler.ts index 59b409fe990..3c8e94f4e4c 100644 --- a/src/ui/settings/settings-keyboard-ui-handler.ts +++ b/src/ui/settings/settings-keyboard-ui-handler.ts @@ -11,7 +11,8 @@ import { import {reverseValueToKeySetting, truncateString} from "#app/utils"; import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler.js"; import {InterfaceConfig} from "#app/inputs-controller"; -import {addTextObject, TextStyle} from "#app/ui/text"; +import {addTextObject} from "#app/ui/text.js"; +import { TextStyle } from "#enums/text.js"; import {deleteBind} from "#app/configs/inputs/configHandler"; import {Device} from "#app/enums/devices"; import {NavigationManager} from "#app/ui/settings/navigationMenu"; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 58d053ac14e..75915cc53a4 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -28,7 +28,8 @@ import { OptionSelectItem } from "./abstact-option-select-ui-handler"; import MessageUiHandler from "./message-ui-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import { StatsContainer } from "./stats-container"; -import { TextStyle, addBBCodeTextObject, addTextObject } from "./text"; +import { addBBCodeTextObject, addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; import {SettingKeyboard} from "#app/system/settings/settings-keyboard"; diff --git a/src/ui/stats-container.ts b/src/ui/stats-container.ts index 5414508ef70..8eaf800187c 100644 --- a/src/ui/stats-container.ts +++ b/src/ui/stats-container.ts @@ -1,7 +1,8 @@ import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; import BattleScene from "../battle-scene"; import { Stat, getStatName } from "../data/pokemon-stat"; -import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "./text"; +import { TextStyle } from "#enums/text.js"; const ivChartSize = 24; const ivChartStatCoordMultipliers = [[0, -1], [0.825, -0.5], [0.825, 0.5], [-0.825, -0.5], [-0.825, 0.5], [0, 1]]; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index fb788f2c9c0..52bbbe07006 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -6,7 +6,7 @@ import { PlayerPokemon } from "../field/pokemon"; import { getStarterValueFriendshipCap, speciesStarters } from "../data/pokemon-species"; import { argbFromRgba } from "@material/material-color-utilities"; import { Type, getTypeRgb } from "../data/type"; -import { TextStyle, addBBCodeTextObject, addTextObject, getBBCodeFrag } from "./text"; +import { addBBCodeTextObject, addTextObject, getBBCodeFrag } from "./text"; import Move, { MoveCategory } from "../data/move"; import { getPokeballAtlasKey } from "../data/pokeball"; import { getGenderColor, getGenderSymbol } from "../data/gender"; @@ -23,6 +23,7 @@ import {Button} from "../enums/buttons"; import { Ability } from "../data/ability.js"; import i18next from "i18next"; import {modifierSortFunc} from "../modifier/modifier"; +import { TextStyle } from "#enums/text.js"; enum Page { @@ -796,7 +797,13 @@ export default class SummaryUiHandler extends UiHandler { this.passiveContainer?.nameText.setVisible(false); this.passiveContainer?.descriptionText.setVisible(false); - const memoString = `${getBBCodeFrag(Utils.toReadableString(Nature[this.pokemon.getNature()]), TextStyle.SUMMARY_RED)}${getBBCodeFrag(" nature,", TextStyle.WINDOW_ALT)}\n${getBBCodeFrag(`${this.pokemon.metBiome === -1 ? "apparently " : ""}met at Lv`, TextStyle.WINDOW_ALT)}${getBBCodeFrag(this.pokemon.metLevel.toString(), TextStyle.SUMMARY_RED)}${getBBCodeFrag(",", TextStyle.WINDOW_ALT)}\n${getBBCodeFrag(getBiomeName(this.pokemon.metBiome), TextStyle.SUMMARY_RED)}${getBBCodeFrag(".", TextStyle.WINDOW_ALT)}`; + let memoString = ""; + memoString += `${getBBCodeFrag(Utils.toReadableString(Nature[this.pokemon.getNature()]), TextStyle.SUMMARY_RED)}`; + memoString += `${getBBCodeFrag(" nature,", TextStyle.WINDOW_ALT)}\n`; + memoString += `${getBBCodeFrag(`${this.pokemon.metBiome === -1 ? "apparently " : ""}met at Lv`, TextStyle.WINDOW_ALT)}`; + memoString += `${getBBCodeFrag(this.pokemon.metLevel.toString(), TextStyle.SUMMARY_RED)}`; + memoString += `${getBBCodeFrag(",", TextStyle.WINDOW_ALT)}\n${getBBCodeFrag(getBiomeName(this.pokemon.metBiome), TextStyle.SUMMARY_RED)}`; + memoString += `${getBBCodeFrag(".", TextStyle.WINDOW_ALT)}`; const memoText = addBBCodeTextObject(this.scene, 7, 113, memoString, TextStyle.WINDOW_ALT); memoText.setOrigin(0, 0); diff --git a/src/ui/text.ts b/src/ui/text.ts index 715e4f02430..5db2301c104 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -6,35 +6,48 @@ import { UiTheme } from "../enums/ui-theme"; import { ModifierTier } from "../modifier/modifier-tier"; import Phaser from "phaser"; import i18next from "i18next"; +import { TextStyle } from "#enums/text.js"; +import { Color, ShadowColor } from "#app/enums/color.js"; +import { FontConfig } from "#constants/text.js"; -export enum TextStyle { - MESSAGE, - WINDOW, - WINDOW_ALT, - BATTLE_INFO, - PARTY, - PARTY_RED, - SUMMARY, - SUMMARY_ALT, - SUMMARY_RED, - SUMMARY_BLUE, - SUMMARY_PINK, - SUMMARY_GOLD, - SUMMARY_GRAY, - SUMMARY_GREEN, - MONEY, - STATS_LABEL, - STATS_VALUE, - SETTINGS_LABEL, - SETTINGS_SELECTED, - SETTINGS_LOCKED, - TOOLTIP_TITLE, - TOOLTIP_CONTENT, - MOVE_INFO_CONTENT, - MOVE_PP_FULL, - MOVE_PP_HALF_FULL, - MOVE_PP_NEAR_EMPTY, - MOVE_PP_EMPTY +const defaultStyle: Phaser.Types.GameObjects.Text.TextStyle = { + fontFamily: "emerald, unifont", + fontSize: 96, + padding: { + bottom: 6 + } +}; + +const scale: number = 0.1666666667; + +interface Style { + color: Color, + fontConfig: {fontSize: number, offsetX: number, offsetY: number}, + shadowColor: ShadowColor, +} + +export function addTextObject2(scene: BattleScene, x: number, y: number, content: string, style: Style, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): Phaser.GameObjects.Text { + const ret = scene.add.text(x, y, content); + ret.setScale(scale); + ret.setColor(style.color); + + if (extraStyleOptions) { + if (extraStyleOptions.fontSize) { + const sizeRatio = parseInt(extraStyleOptions.fontSize.toString().slice(0, -2)) / parseInt(style.fontConfig.fontSize.toString().slice(0, -2)); + style.fontConfig.offsetX *= sizeRatio; + } + if (!extraStyleOptions.lineSpacing) { + ret.setLineSpacing(5); + } + } + const textStyle = structuredClone(defaultStyle); + Object.assign(textStyle, style); + ret.setStyle(textStyle); + ret.setFontSize(extraStyleOptions?.fontSize ?? style.fontConfig.fontSize); + ret.setShadow(style.fontConfig.offsetX, style.fontConfig.offsetY, style.shadowColor); + + + return ret; } export function addTextObject(scene: Phaser.Scene, x: number, y: number, content: string, style: TextStyle, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): Phaser.GameObjects.Text { @@ -87,19 +100,19 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio const {resolvedLanguage} = i18next; let shadowXpos = 4; let shadowYpos = 5; - const scale = 0.1666666667; - const defaultFontSize = 96; let styleOptions: Phaser.Types.GameObjects.Text.TextStyle = { - fontFamily: "emerald, unifont", - fontSize: 96, + ...defaultStyle, color: getTextColor(style, false, uiTheme), - padding: { - bottom: 6 - } }; switch (style) { + case TextStyle.STATS_LABEL: + case TextStyle.MESSAGE: + case TextStyle.SETTINGS_LABEL: + case TextStyle.SETTINGS_LOCKED: + case TextStyle.SETTINGS_SELECTED: + break; case TextStyle.SUMMARY: case TextStyle.SUMMARY_ALT: case TextStyle.SUMMARY_BLUE: @@ -114,33 +127,27 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio shadowXpos = 3; shadowYpos = 3; break; - case TextStyle.STATS_LABEL: - case TextStyle.MESSAGE: - case TextStyle.SETTINGS_LABEL: - case TextStyle.SETTINGS_LOCKED: - case TextStyle.SETTINGS_SELECTED: - break; case TextStyle.BATTLE_INFO: case TextStyle.MONEY: case TextStyle.TOOLTIP_TITLE: - styleOptions.fontSize = defaultFontSize - 24; - shadowXpos = 3.5; - shadowYpos = 3.5; + styleOptions.fontSize = FontConfig.L.fontSize; + shadowXpos = FontConfig.L.offsetX; + shadowYpos = FontConfig.L.offsetY; break; case TextStyle.PARTY: case TextStyle.PARTY_RED: - styleOptions.fontSize = defaultFontSize - 30; - styleOptions.fontFamily = "pkmnems"; + styleOptions.fontSize = FontConfig.M.fontSize; + styleOptions.fontFamily = "pkmnems, unifont"; break; case TextStyle.TOOLTIP_CONTENT: - styleOptions.fontSize = defaultFontSize - 32; - shadowXpos = 3; - shadowYpos = 3; + styleOptions.fontSize = FontConfig.S.fontSize; + shadowXpos = FontConfig.S.offsetX; + shadowYpos = FontConfig.S.offsetX; break; case TextStyle.MOVE_INFO_CONTENT: - styleOptions.fontSize = defaultFontSize - 40; - shadowXpos = 3; - shadowYpos = 3; + styleOptions.fontSize = FontConfig.XS.fontSize; + shadowXpos = FontConfig.XS.offsetX; + shadowYpos = FontConfig.XS.offsetX; break; } diff --git a/src/ui/time-of-day-widget.ts b/src/ui/time-of-day-widget.ts index da3503fb573..5076778bfdc 100644 --- a/src/ui/time-of-day-widget.ts +++ b/src/ui/time-of-day-widget.ts @@ -2,7 +2,7 @@ import * as Utils from "../utils"; import BattleScene from "#app/battle-scene.js"; import { TimeOfDay } from "#app/data/enums/time-of-day.js"; import { BattleSceneEventType } from "../events/battle-scene"; -import { EaseType } from "./enums/ease-type"; +import { EaseType } from "../enums/ease-type"; /** A small self contained UI element that displays the time of day as an icon */ export default class TimeOfDayWidget extends Phaser.GameObjects.Container { diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 673d8c870d9..88a00bc7e0f 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -3,7 +3,8 @@ import { DailyRunScoreboard } from "./daily-run-scoreboard"; import OptionSelectUiHandler from "./settings/option-select-ui-handler"; import { Mode } from "./ui"; import * as Utils from "../utils"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { getBattleCountSplashMessage, getSplashMessages } from "../data/splash-messages"; import i18next from "i18next"; diff --git a/src/ui/ui-handler.ts b/src/ui/ui-handler.ts index e74853276ea..4181a8ac664 100644 --- a/src/ui/ui-handler.ts +++ b/src/ui/ui-handler.ts @@ -1,5 +1,6 @@ import BattleScene from "../battle-scene"; -import { TextStyle, getTextColor } from "./text"; +import { getTextColor } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import {Button} from "../enums/buttons"; diff --git a/src/ui/ui.ts b/src/ui/ui.ts index 366be949374..57bec956f45 100644 --- a/src/ui/ui.ts +++ b/src/ui/ui.ts @@ -15,7 +15,8 @@ import TargetSelectUiHandler from "./target-select-ui-handler"; import SettingsUiHandler from "./settings/settings-ui-handler"; import SettingsGamepadUiHandler from "./settings/settings-gamepad-ui-handler"; import GameChallengesUiHandler from "./challenges-select-ui-handler"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import AchvBar from "./achv-bar"; import MenuUiHandler from "./menu-ui-handler"; import AchvsUiHandler from "./achvs-ui-handler"; diff --git a/src/ui/unavailable-modal-ui-handler.ts b/src/ui/unavailable-modal-ui-handler.ts index 60d01a93c82..6a89fb8523e 100644 --- a/src/ui/unavailable-modal-ui-handler.ts +++ b/src/ui/unavailable-modal-ui-handler.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; -import { addTextObject, TextStyle } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import { updateUserInfo } from "#app/account"; diff --git a/src/ui/vouchers-ui-handler.ts b/src/ui/vouchers-ui-handler.ts index 4508a5be193..6c81642dc19 100644 --- a/src/ui/vouchers-ui-handler.ts +++ b/src/ui/vouchers-ui-handler.ts @@ -3,7 +3,8 @@ import { Button } from "../enums/buttons"; import i18next from "../plugins/i18n"; import { Voucher, getVoucherTypeIcon, getVoucherTypeName, vouchers } from "../system/voucher"; import MessageUiHandler from "./message-ui-handler"; -import { TextStyle, addTextObject } from "./text"; +import { addTextObject } from "./text"; +import { TextStyle } from "#enums/text.js"; import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; diff --git a/tsconfig.json b/tsconfig.json index 3e8f300dd0c..11890b5787f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,10 @@ "baseUrl": "./src", "paths": { "#app/*": ["*.ts"], - "#app": ["."] + "#app": ["."], + "#constants/*": ["./constants/*"], + "#enums/*": ["./enums/*"], + "#interfaces/*": ["./interfaces/*"] }, "outDir": "./build", "noEmit": true diff --git a/vitest.config.js b/vitest.config.js index 5dcb326e1ea..77b7b6a0635 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -1,3 +1,4 @@ +import { resolve } from 'path'; import { defineConfig } from 'vite'; // import fs from 'vite-plugin-fs'; @@ -38,5 +39,8 @@ export default defineConfig(({ mode }) => { pure: mode === 'production' ? [ 'console.log' ] : [], keepNames: true, }, + resolve: { + alias: [{ find: "@", replacement: resolve(__dirname, "./src")}] + } } })