feat: added localisation for eggs and french translations (#403)
* feat: added localisation for eggs and french translations * fixes on french translations after review --------- Co-authored-by: Madmadness65 <59298170+Madmadness65@users.noreply.github.com> Co-authored-by: Benjamin Odom <bennybroseph@gmail.com>
This commit is contained in:
parent
482accda18
commit
975d1ed562
|
@ -4,6 +4,7 @@ import BattleScene from "../battle-scene";
|
||||||
import { Species } from "./enums/species";
|
import { Species } from "./enums/species";
|
||||||
import { getPokemonSpecies, speciesStarters } from "./pokemon-species";
|
import { getPokemonSpecies, speciesStarters } from "./pokemon-species";
|
||||||
import { EggTier } from "./enums/egg-type";
|
import { EggTier } from "./enums/egg-type";
|
||||||
|
import i18next from '../plugins/i18n';
|
||||||
|
|
||||||
export const EGG_SEED = 1073741824;
|
export const EGG_SEED = 1073741824;
|
||||||
|
|
||||||
|
@ -56,34 +57,34 @@ export function getEggDescriptor(egg: Egg): string {
|
||||||
return 'Manaphy';
|
return 'Manaphy';
|
||||||
switch (egg.tier) {
|
switch (egg.tier) {
|
||||||
case EggTier.GREAT:
|
case EggTier.GREAT:
|
||||||
return 'Rare';
|
return i18next.t('egg:greatTier');
|
||||||
case EggTier.ULTRA:
|
case EggTier.ULTRA:
|
||||||
return 'Epic';
|
return i18next.t('egg:ultraTier');
|
||||||
case EggTier.MASTER:
|
case EggTier.MASTER:
|
||||||
return 'Legendary';
|
return i18next.t('egg:masterTier');
|
||||||
default:
|
default:
|
||||||
return 'Common';
|
return i18next.t('egg:defaultTier');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getEggHatchWavesMessage(hatchWaves: integer): string {
|
export function getEggHatchWavesMessage(hatchWaves: integer): string {
|
||||||
if (hatchWaves <= 5)
|
if (hatchWaves <= 5)
|
||||||
return 'Sounds can be heard coming from inside! It will hatch soon!';
|
return i18next.t('egg:hatchWavesMessageSoon');
|
||||||
if (hatchWaves <= 15)
|
if (hatchWaves <= 15)
|
||||||
return 'It appears to move occasionally. It may be close to hatching.';
|
return i18next.t('egg:hatchWavesMessageClose');
|
||||||
if (hatchWaves <= 50)
|
if (hatchWaves <= 50)
|
||||||
return 'What will hatch from this? It doesn\'t seem close to hatching.';
|
return i18next.t('egg:hatchWavesMessageNotClose');
|
||||||
return 'It looks like this Egg will take a long time to hatch.';
|
return i18next.t('egg:hatchWavesMessageLongTime');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getEggGachaTypeDescriptor(scene: BattleScene, egg: Egg): string {
|
export function getEggGachaTypeDescriptor(scene: BattleScene, egg: Egg): string {
|
||||||
switch (egg.gachaType) {
|
switch (egg.gachaType) {
|
||||||
case GachaType.LEGENDARY:
|
case GachaType.LEGENDARY:
|
||||||
return `Legendary Rate Up (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})`;
|
return `${i18next.t('egg:gachaTypeLegendary')} (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})`;
|
||||||
case GachaType.MOVE:
|
case GachaType.MOVE:
|
||||||
return 'Rare Egg Move Rate Up';
|
return i18next.t('egg:gachaTypeMove');
|
||||||
case GachaType.SHINY:
|
case GachaType.SHINY:
|
||||||
return 'Shiny Rate Up';
|
return i18next.t('egg:gachaTypeShiny');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
||||||
import { abilityTriggers } from "./ability-trigger";
|
import { abilityTriggers } from "./ability-trigger";
|
||||||
import { battle } from "./battle";
|
import { battle } from "./battle";
|
||||||
import { commandUiHandler } from "./command-ui-handler";
|
import { commandUiHandler } from "./command-ui-handler";
|
||||||
|
import { egg } from "./egg";
|
||||||
import { fightUiHandler } from "./fight-ui-handler";
|
import { fightUiHandler } from "./fight-ui-handler";
|
||||||
import { growth } from "./growth";
|
import { growth } from "./growth";
|
||||||
import { menu } from "./menu";
|
import { menu } from "./menu";
|
||||||
|
@ -21,6 +22,7 @@ export const deConfig = {
|
||||||
abilityTriggers: abilityTriggers,
|
abilityTriggers: abilityTriggers,
|
||||||
battle: battle,
|
battle: battle,
|
||||||
commandUiHandler: commandUiHandler,
|
commandUiHandler: commandUiHandler,
|
||||||
|
egg: egg,
|
||||||
fightUiHandler: fightUiHandler,
|
fightUiHandler: fightUiHandler,
|
||||||
menuUiHandler: menuUiHandler,
|
menuUiHandler: menuUiHandler,
|
||||||
menu: menu,
|
menu: menu,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const egg: SimpleTranslationEntries = {
|
||||||
|
"egg": "Egg",
|
||||||
|
"greatTier": "Rare",
|
||||||
|
"ultraTier": "Epic",
|
||||||
|
"masterTier": "Legendary",
|
||||||
|
"defaultTier": "Common",
|
||||||
|
"hatchWavesMessageSoon": "Sounds can be heard coming from inside! It will hatch soon!",
|
||||||
|
"hatchWavesMessageClose": "It appears to move occasionally. It may be close to hatching.",
|
||||||
|
"hatchWavesMessageNotClose": "What will hatch from this? It doesn't seem close to hatching.",
|
||||||
|
"hatchWavesMessageLongTime": "It looks like this Egg will take a long time to hatch.",
|
||||||
|
"gachaTypeLegendary": "Legendary Rate Up",
|
||||||
|
"gachaTypeMove": "Rare Egg Move Rate Up",
|
||||||
|
"gachaTypeShiny": "Shiny Rate Up",
|
||||||
|
"selectMachine": "Select a machine.",
|
||||||
|
"notEnoughVouchers": "You don't have enough vouchers!",
|
||||||
|
"tooManyEggs": "You have too many eggs!",
|
||||||
|
"pull": "Pull",
|
||||||
|
"pulls": "Pulls"
|
||||||
|
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
||||||
import { abilityTriggers } from "./ability-trigger";
|
import { abilityTriggers } from "./ability-trigger";
|
||||||
import { battle } from "./battle";
|
import { battle } from "./battle";
|
||||||
import { commandUiHandler } from "./command-ui-handler";
|
import { commandUiHandler } from "./command-ui-handler";
|
||||||
|
import { egg } from "./egg";
|
||||||
import { fightUiHandler } from "./fight-ui-handler";
|
import { fightUiHandler } from "./fight-ui-handler";
|
||||||
import { growth } from "./growth";
|
import { growth } from "./growth";
|
||||||
import { menu } from "./menu";
|
import { menu } from "./menu";
|
||||||
|
@ -22,6 +23,7 @@ export const enConfig = {
|
||||||
abilityTriggers: abilityTriggers,
|
abilityTriggers: abilityTriggers,
|
||||||
battle: battle,
|
battle: battle,
|
||||||
commandUiHandler: commandUiHandler,
|
commandUiHandler: commandUiHandler,
|
||||||
|
egg: egg,
|
||||||
fightUiHandler: fightUiHandler,
|
fightUiHandler: fightUiHandler,
|
||||||
menuUiHandler: menuUiHandler,
|
menuUiHandler: menuUiHandler,
|
||||||
menu: menu,
|
menu: menu,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const egg: SimpleTranslationEntries = {
|
||||||
|
"egg": "Egg",
|
||||||
|
"greatTier": "Rare",
|
||||||
|
"ultraTier": "Epic",
|
||||||
|
"masterTier": "Legendary",
|
||||||
|
"defaultTier": "Common",
|
||||||
|
"hatchWavesMessageSoon": "Sounds can be heard coming from inside! It will hatch soon!",
|
||||||
|
"hatchWavesMessageClose": "It appears to move occasionally. It may be close to hatching.",
|
||||||
|
"hatchWavesMessageNotClose": "What will hatch from this? It doesn't seem close to hatching.",
|
||||||
|
"hatchWavesMessageLongTime": "It looks like this Egg will take a long time to hatch.",
|
||||||
|
"gachaTypeLegendary": "Legendary Rate Up",
|
||||||
|
"gachaTypeMove": "Rare Egg Move Rate Up",
|
||||||
|
"gachaTypeShiny": "Shiny Rate Up",
|
||||||
|
"selectMachine": "Select a machine.",
|
||||||
|
"notEnoughVouchers": "You don't have enough vouchers!",
|
||||||
|
"tooManyEggs": "You have too many eggs!",
|
||||||
|
"pull": "Pull",
|
||||||
|
"pulls": "Pulls"
|
||||||
|
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
||||||
import { abilityTriggers } from "./ability-trigger";
|
import { abilityTriggers } from "./ability-trigger";
|
||||||
import { battle } from "./battle";
|
import { battle } from "./battle";
|
||||||
import { commandUiHandler } from "./command-ui-handler";
|
import { commandUiHandler } from "./command-ui-handler";
|
||||||
|
import { egg } from "./egg";
|
||||||
import { fightUiHandler } from "./fight-ui-handler";
|
import { fightUiHandler } from "./fight-ui-handler";
|
||||||
import { growth } from "./growth";
|
import { growth } from "./growth";
|
||||||
import { menu } from "./menu";
|
import { menu } from "./menu";
|
||||||
|
@ -22,6 +23,7 @@ export const esConfig = {
|
||||||
abilityTriggers: abilityTriggers,
|
abilityTriggers: abilityTriggers,
|
||||||
battle: battle,
|
battle: battle,
|
||||||
commandUiHandler: commandUiHandler,
|
commandUiHandler: commandUiHandler,
|
||||||
|
egg: egg,
|
||||||
fightUiHandler: fightUiHandler,
|
fightUiHandler: fightUiHandler,
|
||||||
menuUiHandler: menuUiHandler,
|
menuUiHandler: menuUiHandler,
|
||||||
menu: menu,
|
menu: menu,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const egg: SimpleTranslationEntries = {
|
||||||
|
"egg": "Egg",
|
||||||
|
"greatTier": "Rare",
|
||||||
|
"ultraTier": "Epic",
|
||||||
|
"masterTier": "Legendary",
|
||||||
|
"defaultTier": "Common",
|
||||||
|
"hatchWavesMessageSoon": "Sounds can be heard coming from inside! It will hatch soon!",
|
||||||
|
"hatchWavesMessageClose": "It appears to move occasionally. It may be close to hatching.",
|
||||||
|
"hatchWavesMessageNotClose": "What will hatch from this? It doesn't seem close to hatching.",
|
||||||
|
"hatchWavesMessageLongTime": "It looks like this Egg will take a long time to hatch.",
|
||||||
|
"gachaTypeLegendary": "Legendary Rate Up",
|
||||||
|
"gachaTypeMove": "Rare Egg Move Rate Up",
|
||||||
|
"gachaTypeShiny": "Shiny Rate Up",
|
||||||
|
"selectMachine": "Select a machine.",
|
||||||
|
"notEnoughVouchers": "You don't have enough vouchers!",
|
||||||
|
"tooManyEggs": "You have too many eggs!",
|
||||||
|
"pull": "Pull",
|
||||||
|
"pulls": "Pulls"
|
||||||
|
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
||||||
import { abilityTriggers } from "./ability-trigger";
|
import { abilityTriggers } from "./ability-trigger";
|
||||||
import { battle } from "./battle";
|
import { battle } from "./battle";
|
||||||
import { commandUiHandler } from "./command-ui-handler";
|
import { commandUiHandler } from "./command-ui-handler";
|
||||||
|
import { egg } from "./egg";
|
||||||
import { fightUiHandler } from "./fight-ui-handler";
|
import { fightUiHandler } from "./fight-ui-handler";
|
||||||
import { growth } from "./growth";
|
import { growth } from "./growth";
|
||||||
import { menu } from "./menu";
|
import { menu } from "./menu";
|
||||||
|
@ -22,6 +23,7 @@ export const frConfig = {
|
||||||
abilityTriggers: abilityTriggers,
|
abilityTriggers: abilityTriggers,
|
||||||
battle: battle,
|
battle: battle,
|
||||||
commandUiHandler: commandUiHandler,
|
commandUiHandler: commandUiHandler,
|
||||||
|
egg: egg,
|
||||||
fightUiHandler: fightUiHandler,
|
fightUiHandler: fightUiHandler,
|
||||||
menuUiHandler: menuUiHandler,
|
menuUiHandler: menuUiHandler,
|
||||||
menu: menu,
|
menu: menu,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const egg: SimpleTranslationEntries = {
|
||||||
|
"egg": "Œuf",
|
||||||
|
"greatTier": "Rare",
|
||||||
|
"ultraTier": "Épique",
|
||||||
|
"masterTier": "Légendaire",
|
||||||
|
"defaultTier": "Commun",
|
||||||
|
"hatchWavesMessageSoon": "Il fait du bruit. Il va éclore !",
|
||||||
|
"hatchWavesMessageClose": "Il bouge de temps en temps. Il devrait bientôt éclore.",
|
||||||
|
"hatchWavesMessageNotClose": "Qu’est-ce qui va en sortir ? Ça va mettre du temps.",
|
||||||
|
"hatchWavesMessageLongTime": "Cet Œuf va sûrement mettre du temps à éclore.",
|
||||||
|
"gachaTypeLegendary": "Taux de Légendaires élevé",
|
||||||
|
"gachaTypeMove": "Taux de Capacité Œuf Rare élevé",
|
||||||
|
"gachaTypeShiny": "Taux de Chromatiques élevé",
|
||||||
|
"selectMachine": "Sélectionnez une machine.",
|
||||||
|
"notEnoughVouchers": "Vous n’avez pas assez de coupons !",
|
||||||
|
"tooManyEggs": "Vous avez trop d’Œufs !",
|
||||||
|
"pull": "Tirage",
|
||||||
|
"pulls": "Tirages"
|
||||||
|
} as const;
|
|
@ -2,6 +2,7 @@ import { ability } from "./ability";
|
||||||
import { abilityTriggers } from "./ability-trigger";
|
import { abilityTriggers } from "./ability-trigger";
|
||||||
import { battle } from "./battle";
|
import { battle } from "./battle";
|
||||||
import { commandUiHandler } from "./command-ui-handler";
|
import { commandUiHandler } from "./command-ui-handler";
|
||||||
|
import { egg } from "./egg";
|
||||||
import { fightUiHandler } from "./fight-ui-handler";
|
import { fightUiHandler } from "./fight-ui-handler";
|
||||||
import { growth } from "./growth";
|
import { growth } from "./growth";
|
||||||
import { menu } from "./menu";
|
import { menu } from "./menu";
|
||||||
|
@ -22,6 +23,7 @@ export const itConfig = {
|
||||||
abilityTriggers: abilityTriggers,
|
abilityTriggers: abilityTriggers,
|
||||||
battle: battle,
|
battle: battle,
|
||||||
commandUiHandler: commandUiHandler,
|
commandUiHandler: commandUiHandler,
|
||||||
|
egg: egg,
|
||||||
fightUiHandler: fightUiHandler,
|
fightUiHandler: fightUiHandler,
|
||||||
menuUiHandler: menuUiHandler,
|
menuUiHandler: menuUiHandler,
|
||||||
menu: menu,
|
menu: menu,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const egg: SimpleTranslationEntries = {
|
||||||
|
"egg": "Egg",
|
||||||
|
"greatTier": "Rare",
|
||||||
|
"ultraTier": "Epic",
|
||||||
|
"masterTier": "Legendary",
|
||||||
|
"defaultTier": "Common",
|
||||||
|
"hatchWavesMessageSoon": "Sounds can be heard coming from inside! It will hatch soon!",
|
||||||
|
"hatchWavesMessageClose": "It appears to move occasionally. It may be close to hatching.",
|
||||||
|
"hatchWavesMessageNotClose": "What will hatch from this? It doesn't seem close to hatching.",
|
||||||
|
"hatchWavesMessageLongTime": "It looks like this Egg will take a long time to hatch.",
|
||||||
|
"gachaTypeLegendary": "Legendary Rate Up",
|
||||||
|
"gachaTypeMove": "Rare Egg Move Rate Up",
|
||||||
|
"gachaTypeShiny": "Shiny Rate Up",
|
||||||
|
"selectMachine": "Select a machine.",
|
||||||
|
"notEnoughVouchers": "You don't have enough vouchers!",
|
||||||
|
"tooManyEggs": "You have too many eggs!",
|
||||||
|
"pull": "Pull",
|
||||||
|
"pulls": "Pulls"
|
||||||
|
} as const;
|
|
@ -126,6 +126,7 @@ declare module 'i18next' {
|
||||||
starterSelectUiHandler: SimpleTranslationEntries;
|
starterSelectUiHandler: SimpleTranslationEntries;
|
||||||
nature: SimpleTranslationEntries;
|
nature: SimpleTranslationEntries;
|
||||||
growth: SimpleTranslationEntries;
|
growth: SimpleTranslationEntries;
|
||||||
|
egg: SimpleTranslationEntries;
|
||||||
weather: SimpleTranslationEntries;
|
weather: SimpleTranslationEntries;
|
||||||
modifierType: ModifierTypeTranslationEntries;
|
modifierType: ModifierTypeTranslationEntries;
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,8 +10,7 @@ import { addWindow } from "./ui-theme";
|
||||||
import { Tutorial, handleTutorial } from "../tutorial";
|
import { Tutorial, handleTutorial } from "../tutorial";
|
||||||
import { EggTier } from "../data/enums/egg-type";
|
import { EggTier } from "../data/enums/egg-type";
|
||||||
import {Button} from "../enums/buttons";
|
import {Button} from "../enums/buttons";
|
||||||
|
import i18next from '../plugins/i18n';
|
||||||
const defaultText = 'Select a machine.';
|
|
||||||
|
|
||||||
export default class EggGachaUiHandler extends MessageUiHandler {
|
export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
private eggGachaContainer: Phaser.GameObjects.Container;
|
private eggGachaContainer: Phaser.GameObjects.Container;
|
||||||
|
@ -33,6 +32,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
private cursorObj: Phaser.GameObjects.Image;
|
private cursorObj: Phaser.GameObjects.Image;
|
||||||
private transitioning: boolean;
|
private transitioning: boolean;
|
||||||
private transitionCancelled: boolean;
|
private transitionCancelled: boolean;
|
||||||
|
private defaultText: string;
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
super(scene, Mode.EGG_GACHA);
|
super(scene, Mode.EGG_GACHA);
|
||||||
|
@ -43,6 +43,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
this.gachaInfoContainers = [];
|
this.gachaInfoContainers = [];
|
||||||
|
|
||||||
this.voucherCountLabels = [];
|
this.voucherCountLabels = [];
|
||||||
|
this.defaultText = i18next.t('egg:selectMachine');
|
||||||
}
|
}
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -151,8 +152,27 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
this.eggGachaOptionSelectBg.setOrigin(1, 1);
|
this.eggGachaOptionSelectBg.setOrigin(1, 1);
|
||||||
this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg);
|
this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg);
|
||||||
|
|
||||||
const optionText = addTextObject(this.scene, 0, 0, ' x1 1 Pull\n x10 10 Pulls\n x1 5 Pulls\n x1 10 Pulls\n x1 25 Pulls\nCancel', TextStyle.WINDOW);
|
const pullOptions = [
|
||||||
optionText.setLineSpacing(12);
|
{ multiplier: 'x1', description: `1 ${i18next.t('egg:pull')}` },
|
||||||
|
{ multiplier: 'x10', description: `10 ${i18next.t('egg:pulls')}` },
|
||||||
|
{ multiplier: 'x1', description: `5 ${i18next.t('egg:pulls')}` },
|
||||||
|
{ multiplier: 'x1', description: `10 ${i18next.t('egg:pulls')}` },
|
||||||
|
{ multiplier: 'x1', description: `25 ${i18next.t('egg:pulls')}` }
|
||||||
|
];
|
||||||
|
|
||||||
|
const pullOptionsText = pullOptions.map(option => ` ${option.multiplier.padEnd(4)} ${option.description}`).join('\n');
|
||||||
|
|
||||||
|
const optionText = addTextObject(
|
||||||
|
this.scene,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
`${pullOptionsText}\n${i18next.t('menu:cancel')}`,
|
||||||
|
TextStyle.WINDOW,
|
||||||
|
);
|
||||||
|
|
||||||
|
optionText.setLineSpacing(28);
|
||||||
|
optionText.setFontSize('80px');
|
||||||
|
|
||||||
this.eggGachaOptionsContainer.add(optionText);
|
this.eggGachaOptionsContainer.add(optionText);
|
||||||
|
|
||||||
optionText.setPositionRelative(this.eggGachaOptionSelectBg, 16, 9);
|
optionText.setPositionRelative(this.eggGachaOptionSelectBg, 16, 9);
|
||||||
|
@ -223,7 +243,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
show(args: any[]): boolean {
|
show(args: any[]): boolean {
|
||||||
super.show(args);
|
super.show(args);
|
||||||
|
|
||||||
this.getUi().showText(defaultText, 0);
|
this.getUi().showText(this.defaultText, 0);
|
||||||
|
|
||||||
this.setGachaCursor(1);
|
this.setGachaCursor(1);
|
||||||
|
|
||||||
|
@ -474,7 +494,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
|
|
||||||
showText(text: string, delay?: number, callback?: Function, callbackDelay?: number, prompt?: boolean, promptDelay?: number): void {
|
showText(text: string, delay?: number, callback?: Function, callbackDelay?: number, prompt?: boolean, promptDelay?: number): void {
|
||||||
if (!text)
|
if (!text)
|
||||||
text = defaultText;
|
text = this.defaultText;
|
||||||
|
|
||||||
if (text?.indexOf('\n') === -1) {
|
if (text?.indexOf('\n') === -1) {
|
||||||
this.eggGachaMessageBox.setSize(320, 32);
|
this.eggGachaMessageBox.setSize(320, 32);
|
||||||
|
@ -490,7 +510,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
showError(text: string): void {
|
showError(text: string): void {
|
||||||
this.showText(text, null, () => this.showText(defaultText), Utils.fixedInt(1500));
|
this.showText(text, null, () => this.showText(this.defaultText), Utils.fixedInt(1500));
|
||||||
}
|
}
|
||||||
|
|
||||||
setTransitioning(transitioning: boolean): void {
|
setTransitioning(transitioning: boolean): void {
|
||||||
|
@ -526,27 +546,27 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
case 0:
|
case 0:
|
||||||
if (!this.scene.gameData.voucherCounts[VoucherType.REGULAR]) {
|
if (!this.scene.gameData.voucherCounts[VoucherType.REGULAR]) {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You don\'t have enough vouchers!');
|
this.showError(i18next.t('egg:notEnoughVouchers'));
|
||||||
} else if (this.scene.gameData.eggs.length < 99) {
|
} else if (this.scene.gameData.eggs.length < 99) {
|
||||||
this.consumeVouchers(VoucherType.REGULAR, 1);
|
this.consumeVouchers(VoucherType.REGULAR, 1);
|
||||||
this.pull();
|
this.pull();
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You have too many eggs!');
|
this.showError(i18next.t('egg:tooManyEggs'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!this.scene.gameData.voucherCounts[VoucherType.PLUS]) {
|
if (!this.scene.gameData.voucherCounts[VoucherType.PLUS]) {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You don\'t have enough vouchers!');
|
this.showError(i18next.t('egg:notEnoughVouchers'));
|
||||||
} else if (this.scene.gameData.eggs.length < 95) {
|
} else if (this.scene.gameData.eggs.length < 95) {
|
||||||
this.consumeVouchers(VoucherType.PLUS, 1);
|
this.consumeVouchers(VoucherType.PLUS, 1);
|
||||||
this.pull(5);
|
this.pull(5);
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You have too many eggs!');
|
this.showError(i18next.t('egg:tooManyEggs'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -554,7 +574,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
if ((this.cursor === 1 && this.scene.gameData.voucherCounts[VoucherType.REGULAR] < 10)
|
if ((this.cursor === 1 && this.scene.gameData.voucherCounts[VoucherType.REGULAR] < 10)
|
||||||
|| (this.cursor === 3 && !this.scene.gameData.voucherCounts[VoucherType.PREMIUM])) {
|
|| (this.cursor === 3 && !this.scene.gameData.voucherCounts[VoucherType.PREMIUM])) {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You don\'t have enough vouchers!');
|
this.showError(i18next.t('egg:notEnoughVouchers'));
|
||||||
} else if (this.scene.gameData.eggs.length < 90) {
|
} else if (this.scene.gameData.eggs.length < 90) {
|
||||||
if (this.cursor === 3)
|
if (this.cursor === 3)
|
||||||
this.consumeVouchers(VoucherType.PREMIUM, 1);
|
this.consumeVouchers(VoucherType.PREMIUM, 1);
|
||||||
|
@ -564,20 +584,20 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You have too many eggs!');
|
this.showError(i18next.t('egg:tooManyEggs'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (!this.scene.gameData.voucherCounts[VoucherType.GOLDEN]) {
|
if (!this.scene.gameData.voucherCounts[VoucherType.GOLDEN]) {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You don\'t have enough vouchers!');
|
this.showError(i18next.t('egg:notEnoughVouchers'));
|
||||||
} else if (this.scene.gameData.eggs.length < 75) {
|
} else if (this.scene.gameData.eggs.length < 75) {
|
||||||
this.consumeVouchers(VoucherType.GOLDEN, 1);
|
this.consumeVouchers(VoucherType.GOLDEN, 1);
|
||||||
this.pull(25);
|
this.pull(25);
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
this.showError('You have too many eggs!');
|
this.showError(i18next.t('egg:tooManyEggs'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { EGG_SEED, Egg, GachaType, getEggGachaTypeDescriptor, getEggHatchWavesMe
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { addWindow } from "./ui-theme";
|
import { addWindow } from "./ui-theme";
|
||||||
import {Button} from "../enums/buttons";
|
import {Button} from "../enums/buttons";
|
||||||
|
import i18next from '../plugins/i18n';
|
||||||
|
|
||||||
export default class EggListUiHandler extends MessageUiHandler {
|
export default class EggListUiHandler extends MessageUiHandler {
|
||||||
private eggListContainer: Phaser.GameObjects.Container;
|
private eggListContainer: Phaser.GameObjects.Container;
|
||||||
|
@ -165,7 +166,7 @@ export default class EggListUiHandler extends MessageUiHandler {
|
||||||
|
|
||||||
setEggDetails(egg: Egg): void {
|
setEggDetails(egg: Egg): void {
|
||||||
this.eggSprite.setFrame(`egg_${egg.getKey()}`);
|
this.eggSprite.setFrame(`egg_${egg.getKey()}`);
|
||||||
this.eggNameText.setText(`Egg (${getEggDescriptor(egg)})`);
|
this.eggNameText.setText(`${i18next.t('egg:egg')} (${getEggDescriptor(egg)})`);
|
||||||
this.eggDateText.setText(
|
this.eggDateText.setText(
|
||||||
new Date(egg.timestamp).toLocaleString(undefined, {
|
new Date(egg.timestamp).toLocaleString(undefined, {
|
||||||
weekday: 'short',
|
weekday: 'short',
|
||||||
|
|
Loading…
Reference in New Issue