Create tooltip to show Pokemon generation
This commit is contained in:
parent
74a7b1bb79
commit
5e51a9e8cb
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const deConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -4,6 +4,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const enConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const esConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const frConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const itConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const koConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -4,6 +4,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const ptBrConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const zhCnConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
||||
|
||||
export const battleInfo: SimpleTranslationEntries = {
|
||||
"generation": "Generation {{generation}}",
|
||||
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
|||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { battle } from "./battle";
|
||||
import { battleInfo } from "./battle-info";
|
||||
import { battleMessageUiHandler } from "./battle-message-ui-handler";
|
||||
import { berry } from "./berry";
|
||||
import { bgmName } from "./bgm-name";
|
||||
|
@ -47,6 +48,7 @@ export const zhTwConfig = {
|
|||
ability: ability,
|
||||
abilityTriggers: abilityTriggers,
|
||||
battle: battle,
|
||||
battleInfo: battleInfo,
|
||||
battleMessageUiHandler: battleMessageUiHandler,
|
||||
berry: berry,
|
||||
bgmName: bgmName,
|
||||
|
|
|
@ -10,6 +10,7 @@ import { getVariantTint } from "#app/data/variant";
|
|||
import { BattleStat } from "#app/data/battle-stat";
|
||||
import BattleFlyout from "./battle-flyout";
|
||||
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 ];
|
||||
|
||||
|
@ -328,6 +329,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
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];
|
||||
this.ownedIcon.setVisible(!!dexEntry.caughtAttr);
|
||||
const opponentPokemonDexAttr = pokemon.getDexAttr();
|
||||
|
@ -644,6 +650,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||
|
||||
this.nameText.setText(displayName);
|
||||
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> {
|
||||
|
|
Loading…
Reference in New Issue