Create tooltip to show Pokemon generation

This commit is contained in:
EmberCM 2024-06-26 14:30:59 -05:00
parent 74a7b1bb79
commit 5e51a9e8cb
19 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const deConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -4,6 +4,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const enConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const esConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const frConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const itConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const koConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -4,6 +4,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const ptBrConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const zhCnConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const battleInfo: SimpleTranslationEntries = {
"generation": "Generation {{generation}}",
} as const;

View File

@ -2,6 +2,7 @@ import { ability } from "./ability";
import { abilityTriggers } from "./ability-trigger"; import { abilityTriggers } from "./ability-trigger";
import { PGFachv, PGMachv } from "./achv"; import { PGFachv, PGMachv } from "./achv";
import { battle } from "./battle"; import { battle } from "./battle";
import { battleInfo } from "./battle-info";
import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry"; import { berry } from "./berry";
import { bgmName } from "./bgm-name"; import { bgmName } from "./bgm-name";
@ -47,6 +48,7 @@ export const zhTwConfig = {
ability: ability, ability: ability,
abilityTriggers: abilityTriggers, abilityTriggers: abilityTriggers,
battle: battle, battle: battle,
battleInfo: battleInfo,
battleMessageUiHandler: battleMessageUiHandler, battleMessageUiHandler: battleMessageUiHandler,
berry: berry, berry: berry,
bgmName: bgmName, bgmName: bgmName,

View File

@ -10,6 +10,7 @@ import { getVariantTint } from "#app/data/variant";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import BattleFlyout from "./battle-flyout"; import BattleFlyout from "./battle-flyout";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";
import i18next from "i18next";
const battleStatOrder = [ BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.ACC, BattleStat.EVA, BattleStat.SPD ]; const battleStatOrder = [ BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.ACC, BattleStat.EVA, BattleStat.SPD ];
@ -328,6 +329,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
} }
if (!this.player) { if (!this.player) {
if (this.nameText.visible) {
this.nameText.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, i18next.t("battleInfo:generation", { generation: pokemon.species.generation })));
this.nameText.on("pointerout", () => (this.scene as BattleScene).ui.hideTooltip());
}
const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId]; const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId];
this.ownedIcon.setVisible(!!dexEntry.caughtAttr); this.ownedIcon.setVisible(!!dexEntry.caughtAttr);
const opponentPokemonDexAttr = pokemon.getDexAttr(); const opponentPokemonDexAttr = pokemon.getDexAttr();
@ -644,6 +650,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.nameText.setText(displayName); this.nameText.setText(displayName);
this.lastName = pokemon.name; this.lastName = pokemon.name;
if (this.nameText.visible) {
this.nameText.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.nameText.width, this.nameText.height), Phaser.Geom.Rectangle.Contains);
}
} }
updatePokemonExp(pokemon: Pokemon, instant?: boolean, levelDurationMultiplier: number = 1): Promise<void> { updatePokemonExp(pokemon: Pokemon, instant?: boolean, levelDurationMultiplier: number = 1): Promise<void> {