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": { "imports": {
"#app": "./src/main.js", "#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 { Arena, ArenaBase } from "./field/arena";
import { GameData } from "./system/game-data"; import { GameData } from "./system/game-data";
import { PlayerGender } from "./data/enums/player-gender"; 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 { Moves } from "./data/enums/moves";
import { allMoves } from "./data/move"; import { allMoves } from "./data/move";
import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from "./modifier/modifier-type"; 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 { NewArenaEvent } from "./events/battle-scene";
import { Abilities } from "./data/enums/abilities"; import { Abilities } from "./data/enums/abilities";
import ArenaFlyout from "./ui/arena-flyout"; 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 { ExpNotification } from "./enums/exp-notification";
import { TextStyle } from "#enums/text";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; 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 { Stat, getStatName } from "./pokemon-stat";
import * as Utils from "../utils"; 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 { UiTheme } from "#app/enums/ui-theme";
import i18next from "i18next"; 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 textStyle = forStarterSelect ? TextStyle.SUMMARY_ALT : TextStyle.WINDOW;
const getTextFrag = !ignoreBBCode ? (text: string, style: TextStyle) => getBBCodeFrag(text, style, uiTheme) : (text: string, style: TextStyle) => text; const getTextFrag = !ignoreBBCode ? (text: string, style: TextStyle) => getBBCodeFrag(text, style, uiTheme) : (text: string, style: TextStyle) => text;
if (increasedStat && decreasedStat) { 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 { } else {
ret = getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(-)`, textStyle); 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 Pokemon, { DamageResult, HitResult } from "./pokemon";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { BattlerIndex } from "../battle"; import { BattlerIndex } from "../battle";

View File

@ -22,7 +22,7 @@ import { FormChangeItem, SpeciesFormChangeItemTrigger, pokemonFormChanges } from
import { ModifierTier } from "./modifier-tier"; import { ModifierTier } from "./modifier-tier";
import { Nature, getNatureName, getNatureStatMultiplier } from "#app/data/nature"; import { Nature, getNatureName, getNatureStatMultiplier } from "#app/data/nature";
import i18next from "#app/plugins/i18n"; 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 { BattlerTagType } from "#app/data/enums/battler-tag-type.js";
import * as Overrides from "../overrides"; import * as Overrides from "../overrides";
import { MoneyMultiplierModifier } from "./modifier"; import { MoneyMultiplierModifier } from "./modifier";

View File

@ -5,7 +5,8 @@ import { getLevelTotalExp } from "../data/exp";
import { PokeballType } from "../data/pokeball"; import { PokeballType } from "../data/pokeball";
import Pokemon, { PlayerPokemon } from "../field/pokemon"; import Pokemon, { PlayerPokemon } from "../field/pokemon";
import { Stat } from "../data/pokemon-stat"; 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 { Type } from "../data/type";
import { EvolutionPhase } from "../evolution-phase"; import { EvolutionPhase } from "../evolution-phase";
import { FusionSpeciesFormEvolution, pokemonEvolutions, pokemonPrevolutions } from "../data/pokemon-evolutions"; 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 i18next from "./plugins/i18n";
import { Abilities } from "./data/enums/abilities"; import { Abilities } from "./data/enums/abilities";
import * as Overrides from "./overrides"; 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 { Type } from "./data/type";
import { BerryUsedEvent, EncounterPhaseEvent, MoveUsedEvent, TurnEndEvent, TurnInitEvent } from "./events/battle-scene"; import { BerryUsedEvent, EncounterPhaseEvent, MoveUsedEvent, TurnEndEvent, TurnInitEvent } from "./events/battle-scene";
import { ExpNotification } from "./enums/exp-notification"; 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 { CandyUpgradeNotificationChangedEvent } from "../../events/battle-scene";
import { MoneyFormat } from "../../enums/money-format"; import { MoneyFormat } from "../../enums/money-format";
import SettingsUiHandler from "#app/ui/settings/settings-ui-handler"; 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 MUTE = "Mute";
const VOLUME_OPTIONS = new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 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 BattleScene from "../battle-scene";
import Pokemon from "../field/pokemon"; import Pokemon from "../field/pokemon";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text.js";
const hiddenX = -118; const hiddenX = -118;
const shownX = 0; const shownX = 0;

View File

@ -1,11 +1,13 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { TextStyle, addTextObject } from "./text"; import { addTextObject2 } from "./text";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { argbFromRgba } from "@material/material-color-utilities"; import { argbFromRgba } from "@material/material-color-utilities";
import {Button} from "../enums/buttons"; import {Button} from "../enums/buttons";
import { Color, ShadowColor } from "#app/enums/color.js";
import { FontConfig } from "#app/constants/text.js";
export interface OptionSelectConfig { export interface OptionSelectConfig {
xOffset?: number; xOffset?: number;
@ -81,7 +83,13 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
this.optionSelectIcons.splice(0, this.optionSelectIcons.length); 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.optionSelectText.setLineSpacing(12);
this.optionSelectContainer.add(this.optionSelectText); this.optionSelectContainer.add(this.optionSelectText);
this.optionSelectContainer.setPosition((this.scene.game.canvas.width / 6) - 1 - (this.config?.xOffset || 0), -48 + (this.config?.yOffset || 0)); 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 BattleScene from "../battle-scene";
import { Achv, getAchievementDescription } from "../system/achv"; import { Achv, getAchievementDescription } from "../system/achv";
import { Voucher } from "../system/voucher"; 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"; import { PlayerGender } from "#app/data/enums/player-gender";
export default class AchvBar extends Phaser.GameObjects.Container { 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 i18next from "../plugins/i18n";
import { Achv, achvs, getAchievementDescription } from "../system/achv"; import { Achv, achvs, getAchievementDescription } from "../system/achv";
import MessageUiHandler from "./message-ui-handler"; 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 { Mode } from "./ui";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { PlayerGender } from "#app/data/enums/player-gender"; 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 BattleScene from "#app/battle-scene.js";
import { ArenaTagSide } from "#app/data/arena-tag.js"; import { ArenaTagSide } from "#app/data/arena-tag.js";
import { WeatherType } from "#app/data/weather.js"; import { WeatherType } from "#app/data/weather.js";

View File

@ -1,7 +1,8 @@
import { CommandPhase } from "../phases"; import { CommandPhase } from "../phases";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { getPokeballName } from "../data/pokeball"; 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 { Command } from "./command-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";

View File

@ -1,5 +1,6 @@
import { default as Pokemon } from "../field/pokemon"; 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 * as Utils from "../utils";
import BattleScene from "#app/battle-scene.js"; import BattleScene from "#app/battle-scene.js";
import { UiTheme } from "#app/enums/ui-theme.js"; import { UiTheme } from "#app/enums/ui-theme.js";

View File

@ -1,7 +1,8 @@
import { EnemyPokemon, default as Pokemon } from "../field/pokemon"; import { EnemyPokemon, default as Pokemon } from "../field/pokemon";
import { getLevelTotalExp, getLevelRelExp } from "../data/exp"; import { getLevelTotalExp, getLevelRelExp } from "../data/exp";
import * as Utils from "../utils"; 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 { getGenderSymbol, getGenderColor, Gender } from "../data/gender";
import { StatusEffect } from "../data/status-effect"; import { StatusEffect } from "../data/status-effect";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";

View File

@ -1,5 +1,6 @@
import BattleScene from "../battle-scene"; 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 { Mode } from "./ui";
import * as Utils from "../utils"; import * as Utils from "../utils";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";

View File

@ -1,5 +1,6 @@
import BattleScene, { starterColors } from "../battle-scene"; 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 { argbFromRgba } from "@material/material-color-utilities";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { Species } from "#app/data/enums/species"; import { Species } from "#app/data/enums/species";

View File

@ -1,5 +1,6 @@
import BattleScene from "../battle-scene"; 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 { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,6 +1,7 @@
import { CommandPhase } from "../phases"; import { CommandPhase } from "../phases";
import BattleScene from "../battle-scene"; 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 PartyUiHandler, { PartyUiMode } from "./party-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";

View File

@ -1,5 +1,6 @@
import BattleScene from "../battle-scene"; 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 { WindowVariant, addWindow } from "./ui-theme";
import * as Utils from "../utils"; import * as Utils from "../utils";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,6 +1,7 @@
import BattleScene from "#app/battle-scene.js"; import BattleScene from "#app/battle-scene.js";
import { addWindow } from "./ui-theme"; 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 { EggCountChangedEvent, EggEventType } from "#app/events/egg.js";
import EggHatchSceneHandler from "./egg-hatch-scene-handler"; import EggHatchSceneHandler from "./egg-hatch-scene-handler";

View File

@ -1,6 +1,7 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { Mode } from "./ui"; 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 MessageUiHandler from "./message-ui-handler";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp } from "../data/egg"; import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp } from "../data/egg";

View File

@ -1,7 +1,8 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { Mode } from "./ui"; import { Mode } from "./ui";
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; 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 MessageUiHandler from "./message-ui-handler";
import { Egg, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from "../data/egg"; import { Egg, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from "../data/egg";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,6 +1,7 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import MessageUiHandler from "./message-ui-handler"; 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 { Mode } from "./ui";
import {Button} from "../enums/buttons"; import {Button} from "../enums/buttons";

View File

@ -1,5 +1,6 @@
import BattleScene from "../battle-scene"; 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 { getTypeDamageMultiplierColor, Type } from "../data/type";
import { Command } from "./command-ui-handler"; import { Command } from "./command-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";

View File

@ -1,7 +1,8 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; import { ModalConfig, ModalUiHandler } from "./modal-ui-handler";
import { Mode } from "./ui"; 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 { WindowVariant, addWindow } from "./ui-theme";
import InputText from "phaser3-rex-plugins/plugins/inputtext"; import InputText from "phaser3-rex-plugins/plugins/inputtext";
import * as Utils from "../utils"; import * as Utils from "../utils";

View File

@ -1,6 +1,7 @@
import Phaser from "phaser"; import Phaser from "phaser";
import BattleScene from "../battle-scene"; 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 { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,7 +1,8 @@
import i18next from "i18next"; import i18next from "i18next";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { ModalUiHandler } from "./modal-ui-handler"; 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"; import { Mode } from "./ui";
export default class LoadingModalUiHandler extends ModalUiHandler { export default class LoadingModalUiHandler extends ModalUiHandler {

View File

@ -1,5 +1,6 @@
import BattleScene, { bypassLogin } from "../battle-scene"; 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 { Mode } from "./ui";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,5 +1,6 @@
import BattleScene from "../battle-scene"; 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 { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";

View File

@ -1,7 +1,8 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { getPlayerShopModifierTypeOptionsForWave, ModifierTypeOption, TmModifierType } from "../modifier/modifier-type"; import { getPlayerShopModifierTypeOptionsForWave, ModifierTypeOption, TmModifierType } from "../modifier/modifier-type";
import { getPokeballAtlasKey, PokeballType } from "../data/pokeball"; 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 AwaitableUiHandler from "./awaitable-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier"; import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier";

View File

@ -1,5 +1,6 @@
import BattleScene, {InfoToggle} from "../battle-scene"; 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 { addWindow } from "./ui-theme";
import * as Utils from "../utils"; import * as Utils from "../utils";
import Move, { MoveCategory } from "../data/move"; import Move, { MoveCategory } from "../data/move";

View File

@ -1,6 +1,7 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; 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 { Mode } from "./ui";
export default class OutdatedModalUiHandler extends ModalUiHandler { export default class OutdatedModalUiHandler extends ModalUiHandler {

View File

@ -1,6 +1,7 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import Pokemon from "../field/pokemon"; 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 { export default class PartyExpBar extends Phaser.GameObjects.Container {
private bg: Phaser.GameObjects.NineSlice; private bg: Phaser.GameObjects.NineSlice;

View File

@ -1,7 +1,8 @@
import { CommandPhase, SelectModifierPhase } from "../phases"; import { CommandPhase, SelectModifierPhase } from "../phases";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { PlayerPokemon, PokemonMove } from "../field/pokemon"; 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 { Command } from "./command-ui-handler";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";

View File

@ -10,7 +10,8 @@ import { DexAttr } from "../system/game-data";
import * as Utils from "../utils"; import * as Utils from "../utils";
import ConfirmUiHandler from "./confirm-ui-handler"; import ConfirmUiHandler from "./confirm-ui-handler";
import { StatsContainer } from "./stats-container"; 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"; import { addWindow } from "./ui-theme";
interface LanguageSetting { interface LanguageSetting {

View File

@ -2,7 +2,8 @@ import { FormModalUiHandler } from "./form-modal-ui-handler";
import { ModalConfig } from "./modal-ui-handler"; import { ModalConfig } from "./modal-ui-handler";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { Mode } from "./ui"; import { Mode } from "./ui";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text.js";
import i18next from "../plugins/i18n"; import i18next from "../plugins/i18n";
export default class RegistrationFormUiHandler extends FormModalUiHandler { 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 PokemonData from "../system/pokemon-data";
import * as Utils from "../utils"; import * as Utils from "../utils";
import MessageUiHandler from "./message-ui-handler"; 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 { Mode } from "./ui";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,6 +1,7 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; 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 { Mode } from "./ui";
export default class SessionReloadModalUiHandler extends ModalUiHandler { export default class SessionReloadModalUiHandler extends ModalUiHandler {

View File

@ -2,7 +2,8 @@ import UiHandler from "../ui-handler";
import BattleScene from "../../battle-scene"; import BattleScene from "../../battle-scene";
import {Mode} from "../ui"; import {Mode} from "../ui";
import {addWindow} from "../ui-theme"; 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 {Button} from "../../enums/buttons";
import {NavigationManager} from "#app/ui/settings/navigationMenu"; import {NavigationManager} from "#app/ui/settings/navigationMenu";

View File

@ -3,8 +3,9 @@ import BattleScene from "../../battle-scene";
import {Mode} from "../ui"; import {Mode} from "../ui";
import {InterfaceConfig} from "../../inputs-controller"; import {InterfaceConfig} from "../../inputs-controller";
import {addWindow} from "../ui-theme"; import {addWindow} from "../ui-theme";
import {addTextObject, TextStyle} from "../text"; import {addTextObject } from "../text";
import {Button} from "../../enums/buttons"; import { TextStyle } from "#enums/text.js";
import {Button} from "#enums/buttons";
import {getIconWithSettingName} from "#app/configs/inputs/configHandler"; import {getIconWithSettingName} from "#app/configs/inputs/configHandler";
import NavigationMenu, {NavigationManager} from "#app/ui/settings/navigationMenu"; import NavigationMenu, {NavigationManager} from "#app/ui/settings/navigationMenu";
import { Device } from "#app/enums/devices.js"; import { Device } from "#app/enums/devices.js";

View File

@ -1,6 +1,7 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../battle-scene";
import { hasTouchscreen, isMobile } from "../../touch-controls"; 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 { Mode } from "../ui";
import UiHandler from "../ui-handler"; import UiHandler from "../ui-handler";
import { addWindow } from "../ui-theme"; import { addWindow } from "../ui-theme";

View File

@ -3,7 +3,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
import {Mode} from "../ui"; import {Mode} from "../ui";
import {Device} from "#app/enums/devices"; import {Device} from "#app/enums/devices";
import {getIconWithSettingName, getKeyWithKeycode} from "#app/configs/inputs/configHandler"; 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 { export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {

View File

@ -3,7 +3,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
import {Mode} from "../ui"; import {Mode} from "../ui";
import { getKeyWithKeycode} from "#app/configs/inputs/configHandler"; import { getKeyWithKeycode} from "#app/configs/inputs/configHandler";
import {Device} from "#app/enums/devices"; 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 { export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {

View File

@ -1,7 +1,8 @@
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import {Mode} from "#app/ui/ui"; import {Mode} from "#app/ui/ui";
import {InputsIcons} from "#app/ui/settings/abstract-control-settings-ui-handler.js"; 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 {addWindow} from "#app/ui/ui-theme";
import {Button} from "#app/enums/buttons"; import {Button} from "#app/enums/buttons";

View File

@ -1,5 +1,6 @@
import BattleScene from "../../battle-scene"; 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 {Mode} from "../ui";
import { import {
setSettingGamepad, setSettingGamepad,
@ -13,7 +14,7 @@ import pad_dualshock from "#app/configs/inputs/pad_dualshock";
import pad_unlicensedSNES from "#app/configs/inputs/pad_unlicensedSNES"; import pad_unlicensedSNES from "#app/configs/inputs/pad_unlicensedSNES";
import {InterfaceConfig} from "#app/inputs-controller"; import {InterfaceConfig} from "#app/inputs-controller";
import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler.js"; 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"; import {truncateString} from "#app/utils";
/** /**

View File

@ -11,7 +11,8 @@ import {
import {reverseValueToKeySetting, truncateString} from "#app/utils"; import {reverseValueToKeySetting, truncateString} from "#app/utils";
import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler.js"; import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler.js";
import {InterfaceConfig} from "#app/inputs-controller"; 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 {deleteBind} from "#app/configs/inputs/configHandler";
import {Device} from "#app/enums/devices"; import {Device} from "#app/enums/devices";
import {NavigationManager} from "#app/ui/settings/navigationMenu"; 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 MessageUiHandler from "./message-ui-handler";
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler";
import { StatsContainer } from "./stats-container"; 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 { Mode } from "./ui";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import {SettingKeyboard} from "#app/system/settings/settings-keyboard"; 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 BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { Stat, getStatName } from "../data/pokemon-stat"; 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 ivChartSize = 24;
const ivChartStatCoordMultipliers = [[0, -1], [0.825, -0.5], [0.825, 0.5], [-0.825, -0.5], [-0.825, 0.5], [0, 1]]; 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 { getStarterValueFriendshipCap, speciesStarters } from "../data/pokemon-species";
import { argbFromRgba } from "@material/material-color-utilities"; import { argbFromRgba } from "@material/material-color-utilities";
import { Type, getTypeRgb } from "../data/type"; 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 Move, { MoveCategory } from "../data/move";
import { getPokeballAtlasKey } from "../data/pokeball"; import { getPokeballAtlasKey } from "../data/pokeball";
import { getGenderColor, getGenderSymbol } from "../data/gender"; import { getGenderColor, getGenderSymbol } from "../data/gender";
@ -23,6 +23,7 @@ import {Button} from "../enums/buttons";
import { Ability } from "../data/ability.js"; import { Ability } from "../data/ability.js";
import i18next from "i18next"; import i18next from "i18next";
import {modifierSortFunc} from "../modifier/modifier"; import {modifierSortFunc} from "../modifier/modifier";
import { TextStyle } from "#enums/text.js";
enum Page { enum Page {
@ -796,7 +797,13 @@ export default class SummaryUiHandler extends UiHandler {
this.passiveContainer?.nameText.setVisible(false); this.passiveContainer?.nameText.setVisible(false);
this.passiveContainer?.descriptionText.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); const memoText = addBBCodeTextObject(this.scene, 7, 113, memoString, TextStyle.WINDOW_ALT);
memoText.setOrigin(0, 0); memoText.setOrigin(0, 0);

View File

@ -6,35 +6,48 @@ import { UiTheme } from "../enums/ui-theme";
import { ModifierTier } from "../modifier/modifier-tier"; import { ModifierTier } from "../modifier/modifier-tier";
import Phaser from "phaser"; import Phaser from "phaser";
import i18next from "i18next"; 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 { const defaultStyle: Phaser.Types.GameObjects.Text.TextStyle = {
MESSAGE, fontFamily: "emerald, unifont",
WINDOW, fontSize: 96,
WINDOW_ALT, padding: {
BATTLE_INFO, bottom: 6
PARTY, }
PARTY_RED, };
SUMMARY,
SUMMARY_ALT, const scale: number = 0.1666666667;
SUMMARY_RED,
SUMMARY_BLUE, interface Style {
SUMMARY_PINK, color: Color,
SUMMARY_GOLD, fontConfig: {fontSize: number, offsetX: number, offsetY: number},
SUMMARY_GRAY, shadowColor: ShadowColor,
SUMMARY_GREEN, }
MONEY,
STATS_LABEL, export function addTextObject2(scene: BattleScene, x: number, y: number, content: string, style: Style, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): Phaser.GameObjects.Text {
STATS_VALUE, const ret = scene.add.text(x, y, content);
SETTINGS_LABEL, ret.setScale(scale);
SETTINGS_SELECTED, ret.setColor(style.color);
SETTINGS_LOCKED,
TOOLTIP_TITLE, if (extraStyleOptions) {
TOOLTIP_CONTENT, if (extraStyleOptions.fontSize) {
MOVE_INFO_CONTENT, const sizeRatio = parseInt(extraStyleOptions.fontSize.toString().slice(0, -2)) / parseInt(style.fontConfig.fontSize.toString().slice(0, -2));
MOVE_PP_FULL, style.fontConfig.offsetX *= sizeRatio;
MOVE_PP_HALF_FULL, }
MOVE_PP_NEAR_EMPTY, if (!extraStyleOptions.lineSpacing) {
MOVE_PP_EMPTY 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 { 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; const {resolvedLanguage} = i18next;
let shadowXpos = 4; let shadowXpos = 4;
let shadowYpos = 5; let shadowYpos = 5;
const scale = 0.1666666667;
const defaultFontSize = 96;
let styleOptions: Phaser.Types.GameObjects.Text.TextStyle = { let styleOptions: Phaser.Types.GameObjects.Text.TextStyle = {
fontFamily: "emerald, unifont", ...defaultStyle,
fontSize: 96,
color: getTextColor(style, false, uiTheme), color: getTextColor(style, false, uiTheme),
padding: {
bottom: 6
}
}; };
switch (style) { 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:
case TextStyle.SUMMARY_ALT: case TextStyle.SUMMARY_ALT:
case TextStyle.SUMMARY_BLUE: case TextStyle.SUMMARY_BLUE:
@ -114,33 +127,27 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio
shadowXpos = 3; shadowXpos = 3;
shadowYpos = 3; shadowYpos = 3;
break; 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.BATTLE_INFO:
case TextStyle.MONEY: case TextStyle.MONEY:
case TextStyle.TOOLTIP_TITLE: case TextStyle.TOOLTIP_TITLE:
styleOptions.fontSize = defaultFontSize - 24; styleOptions.fontSize = FontConfig.L.fontSize;
shadowXpos = 3.5; shadowXpos = FontConfig.L.offsetX;
shadowYpos = 3.5; shadowYpos = FontConfig.L.offsetY;
break; break;
case TextStyle.PARTY: case TextStyle.PARTY:
case TextStyle.PARTY_RED: case TextStyle.PARTY_RED:
styleOptions.fontSize = defaultFontSize - 30; styleOptions.fontSize = FontConfig.M.fontSize;
styleOptions.fontFamily = "pkmnems"; styleOptions.fontFamily = "pkmnems, unifont";
break; break;
case TextStyle.TOOLTIP_CONTENT: case TextStyle.TOOLTIP_CONTENT:
styleOptions.fontSize = defaultFontSize - 32; styleOptions.fontSize = FontConfig.S.fontSize;
shadowXpos = 3; shadowXpos = FontConfig.S.offsetX;
shadowYpos = 3; shadowYpos = FontConfig.S.offsetX;
break; break;
case TextStyle.MOVE_INFO_CONTENT: case TextStyle.MOVE_INFO_CONTENT:
styleOptions.fontSize = defaultFontSize - 40; styleOptions.fontSize = FontConfig.XS.fontSize;
shadowXpos = 3; shadowXpos = FontConfig.XS.offsetX;
shadowYpos = 3; shadowYpos = FontConfig.XS.offsetX;
break; break;
} }

View File

@ -2,7 +2,7 @@ import * as Utils from "../utils";
import BattleScene from "#app/battle-scene.js"; import BattleScene from "#app/battle-scene.js";
import { TimeOfDay } from "#app/data/enums/time-of-day.js"; import { TimeOfDay } from "#app/data/enums/time-of-day.js";
import { BattleSceneEventType } from "../events/battle-scene"; 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 */ /** A small self contained UI element that displays the time of day as an icon */
export default class TimeOfDayWidget extends Phaser.GameObjects.Container { 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 OptionSelectUiHandler from "./settings/option-select-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import * as Utils from "../utils"; 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 { getBattleCountSplashMessage, getSplashMessages } from "../data/splash-messages";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,5 +1,6 @@
import BattleScene from "../battle-scene"; 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 { Mode } from "./ui";
import {Button} from "../enums/buttons"; 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 SettingsUiHandler from "./settings/settings-ui-handler";
import SettingsGamepadUiHandler from "./settings/settings-gamepad-ui-handler"; import SettingsGamepadUiHandler from "./settings/settings-gamepad-ui-handler";
import GameChallengesUiHandler from "./challenges-select-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 AchvBar from "./achv-bar";
import MenuUiHandler from "./menu-ui-handler"; import MenuUiHandler from "./menu-ui-handler";
import AchvsUiHandler from "./achvs-ui-handler"; import AchvsUiHandler from "./achvs-ui-handler";

View File

@ -1,6 +1,7 @@
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { ModalConfig, ModalUiHandler } from "./modal-ui-handler"; 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 { Mode } from "./ui";
import { updateUserInfo } from "#app/account"; import { updateUserInfo } from "#app/account";

View File

@ -3,7 +3,8 @@ import { Button } from "../enums/buttons";
import i18next from "../plugins/i18n"; import i18next from "../plugins/i18n";
import { Voucher, getVoucherTypeIcon, getVoucherTypeName, vouchers } from "../system/voucher"; import { Voucher, getVoucherTypeIcon, getVoucherTypeName, vouchers } from "../system/voucher";
import MessageUiHandler from "./message-ui-handler"; 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 { Mode } from "./ui";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

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

View File

@ -1,3 +1,4 @@
import { resolve } from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
// import fs from 'vite-plugin-fs'; // import fs from 'vite-plugin-fs';
@ -38,5 +39,8 @@ export default defineConfig(({ mode }) => {
pure: mode === 'production' ? [ 'console.log' ] : [], pure: mode === 'production' ? [ 'console.log' ] : [],
keepNames: true, keepNames: true,
}, },
resolve: {
alias: [{ find: "@", replacement: resolve(__dirname, "./src")}]
}
} }
}) })