[Localization] Ability Bar can now be localized. In a way that pokemonName abilityNa… (#1921)

* Ability Bar can now be localized. In a way that pokemonName abilityName and passive string can be ordered freely

* Update src/locales/ko/fight-ui-handler.ts

Co-authored-by: returntoice <dieandbecome@gmail.com>

* Update src/locales/de/fight-ui-handler.ts

* Update src/locales/de/fight-ui-handler.ts

---------

Co-authored-by: returntoice <dieandbecome@gmail.com>
This commit is contained in:
Jannik Tappert 2024-06-12 15:45:20 +02:00 committed by GitHub
parent 124ef7065f
commit 6e52bc7980
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 26 additions and 12 deletions

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "AP", "pp": "AP",
"power": "Stärke", "power": "Stärke",
"accuracy": "Genauigkeit", "accuracy": "Genauigkeit",
"abilityFlyInText": "{{passive}}{{abilityName}} von {{pokemonName}} wirkt!",
"passive": "Passive Fähigkeit ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "Power", "power": "Power",
"accuracy": "Accuracy", "accuracy": "Accuracy",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "Potencia", "power": "Potencia",
"accuracy": "Precisión", "accuracy": "Precisión",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "Puissance", "power": "Puissance",
"accuracy": "Précision", "accuracy": "Précision",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "Potenza", "power": "Potenza",
"accuracy": "Precisione", "accuracy": "Precisione",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "위력", "power": "위력",
"accuracy": "명중률", "accuracy": "명중률",
"abilityFlyInText": " {{pokemonName}}의 {{passive}}{{abilityName}}",
"passive": "패시브 ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "Poder", "power": "Poder",
"accuracy": "Precisão", "accuracy": "Precisão",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "威力", "power": "威力",
"accuracy": "命中", "accuracy": "命中",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

View File

@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = {
"pp": "PP", "pp": "PP",
"power": "威力", "power": "威力",
"accuracy": "命中率", "accuracy": "命中率",
"abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}",
"passive": "Passive ", // The space at the end is important
} as const; } as const;

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 { TextStyle, addTextObject } from "./text";
import i18next from "i18next";
const hiddenX = -118; const hiddenX = -118;
const shownX = 0; const shownX = 0;
@ -8,8 +9,7 @@ const baseY = -116;
export default class AbilityBar extends Phaser.GameObjects.Container { export default class AbilityBar extends Phaser.GameObjects.Container {
private bg: Phaser.GameObjects.Image; private bg: Phaser.GameObjects.Image;
private pokemonNameText: Phaser.GameObjects.Text; private abilityBarText: Phaser.GameObjects.Text;
private abilityNameText: Phaser.GameObjects.Text;
private tween: Phaser.Tweens.Tween; private tween: Phaser.Tweens.Tween;
private autoHideTimer: NodeJS.Timeout; private autoHideTimer: NodeJS.Timeout;
@ -26,21 +26,17 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
this.add(this.bg); this.add(this.bg);
this.pokemonNameText = addTextObject(this.scene, 15, 3, "", TextStyle.MESSAGE, { fontSize: "72px" }); this.abilityBarText = addTextObject(this.scene, 15, 3, "", TextStyle.MESSAGE, { fontSize: "72px" });
this.pokemonNameText.setOrigin(0, 0); this.abilityBarText.setOrigin(0, 0);
this.add(this.pokemonNameText); this.abilityBarText.setWordWrapWidth(600, true);
this.add(this.abilityBarText);
this.abilityNameText = addTextObject(this.scene, 97, 16, "", TextStyle.WINDOW, { fontSize: "72px" });
this.abilityNameText.setOrigin(1, 0);
this.add(this.abilityNameText);
this.setVisible(false); this.setVisible(false);
this.shown = false; this.shown = false;
} }
showAbility(pokemon: Pokemon, passive: boolean = false): void { showAbility(pokemon: Pokemon, passive: boolean = false): void {
this.pokemonNameText.setText(`${pokemon.name}'s${passive ? " Passive" : ""}`); this.abilityBarText.setText(`${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: pokemon.name, passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: !passive ? pokemon.getAbility().name : pokemon.getPassiveAbility().name })}`);
this.abilityNameText.setText((!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name);
if (this.shown) { if (this.shown) {
return; return;