text configurable

This commit is contained in:
Matthew Olker 2024-06-11 17:31:07 -04:00
parent a0a42ed2ec
commit 8c80ec32ff
64 changed files with 301 additions and 116 deletions

View File

@ -54,6 +54,9 @@
},
"imports": {
"#app": "./src/main.js",
"#app/*": "./src/*"
"#app/*": "./src/*",
"#constants/*": "./src/constants/*",
"#enums/*": "./src/enums/*",
"#interfaces/*": "./src/interfaces/*"
}
}

View File

@ -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";

27
src/constants/text.ts Normal file
View File

@ -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
},
};

View File

@ -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);
}

42
src/enums/color.ts Normal file
View File

@ -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",
}

29
src/enums/text.ts Normal file
View File

@ -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
}

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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);

View File

@ -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;

View File

@ -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));

View File

@ -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 {

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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 {

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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 {

View File

@ -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;

View File

@ -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";

View File

@ -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 {

View File

@ -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 {

View File

@ -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";

View File

@ -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 {

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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 {

View File

@ -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 {

View File

@ -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";

View File

@ -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";
/**

View File

@ -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";

View File

@ -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";

View File

@ -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]];

View File

@ -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);

View File

@ -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;
}

View File

@ -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 {

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -12,7 +12,10 @@
"baseUrl": "./src",
"paths": {
"#app/*": ["*.ts"],
"#app": ["."]
"#app": ["."],
"#constants/*": ["./constants/*"],
"#enums/*": ["./enums/*"],
"#interfaces/*": ["./interfaces/*"]
},
"outDir": "./build",
"noEmit": true

View File

@ -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")}]
}
}
})