From 8d75670a8146d94cd2c7ca46f18fb612d0760125 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 10 Jun 2024 21:58:01 -0400 Subject: [PATCH] [UI] egg and starter formatting (#2043) * egg and starter formatting * localization update * localization update * fix local voucher test * pr comments * pr comments * account for new font --- src/locales/de/starter-select-ui-handler.ts | 12 +++---- src/locales/en/starter-select-ui-handler.ts | 12 +++---- src/locales/es/starter-select-ui-handler.ts | 12 +++---- src/locales/it/starter-select-ui-handler.ts | 12 +++---- src/locales/ko/starter-select-ui-handler.ts | 10 +++--- .../zh_CN/starter-select-ui-handler.ts | 12 +++---- .../zh_TW/starter-select-ui-handler.ts | 12 +++---- src/ui/egg-gacha-ui-handler.ts | 32 +++++++++++++------ src/ui/egg-list-ui-handler.ts | 7 ---- 9 files changed, 63 insertions(+), 58 deletions(-) diff --git a/src/locales/de/starter-select-ui-handler.ts b/src/locales/de/starter-select-ui-handler.ts index bae094563cb..a448dcedad8 100644 --- a/src/locales/de/starter-select-ui-handler.ts +++ b/src/locales/de/starter-select-ui-handler.ts @@ -30,12 +30,12 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "selectMoveSwapWith": "Wähle die gewünschte Attacke.", "unlockPassive": "Passiv-Skill freischalten", "reduceCost": "Preis reduzieren", - "cycleShiny": "R: Schillernd Ja/Nein", - "cycleForm": "F: Form ändern", - "cycleGender": "G: Geschlecht ändern", - "cycleAbility": "E: Fähigkeit ändern", - "cycleNature": "N: Wesen Ändern", - "cycleVariant": "V: Seltenheit ändern", + "cycleShiny": ": Schillernd", + "cycleForm": ": Form", + "cycleGender": ": Geschlecht", + "cycleAbility": ": Fähigkeit", + "cycleNature": ": Wesen", + "cycleVariant": ": Seltenheit", "enablePassive": "Passiv-Skill aktivieren", "disablePassive": "Passiv-Skill deaktivieren", "locked": "Gesperrt", diff --git a/src/locales/en/starter-select-ui-handler.ts b/src/locales/en/starter-select-ui-handler.ts index f001c621cc4..fd2eb6c40df 100644 --- a/src/locales/en/starter-select-ui-handler.ts +++ b/src/locales/en/starter-select-ui-handler.ts @@ -30,12 +30,12 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "selectMoveSwapWith": "Select a move to swap with", "unlockPassive": "Unlock Passive", "reduceCost": "Reduce Cost", - "cycleShiny": ": Cycle Shiny", - "cycleForm": ": Cycle Form", - "cycleGender": ": Cycle Gender", - "cycleAbility": ": Cycle Ability", - "cycleNature": ": Cycle Nature", - "cycleVariant": ": Cycle Variant", + "cycleShiny": ": Shiny", + "cycleForm": ": Form", + "cycleGender": ": Gender", + "cycleAbility": ": Ability", + "cycleNature": ": Nature", + "cycleVariant": ": Variant", "enablePassive": "Enable Passive", "disablePassive": "Disable Passive", "locked": "Locked", diff --git a/src/locales/es/starter-select-ui-handler.ts b/src/locales/es/starter-select-ui-handler.ts index e41f151965a..4d025820260 100644 --- a/src/locales/es/starter-select-ui-handler.ts +++ b/src/locales/es/starter-select-ui-handler.ts @@ -30,12 +30,12 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "selectMoveSwapWith": "Elige el movimiento que sustituirá a", "unlockPassive": "Añadir Pasiva", "reduceCost": "Reducir Coste", - "cycleShiny": ": Cambiar Shiny", - "cycleForm": ": Cambiar Forma", - "cycleGender": ": Cambiar Género", - "cycleAbility": ": Cambiar Habilidad", - "cycleNature": ": Cambiar Naturaleza", - "cycleVariant": ": Cambiar Variante", + "cycleShiny": ": Shiny", + "cycleForm": ": Forma", + "cycleGender": ": Género", + "cycleAbility": ": Habilidad", + "cycleNature": ": Naturaleza", + "cycleVariant": ": Variante", "enablePassive": "Activar Pasiva", "disablePassive": "Desactivar Pasiva", "locked": "Bloqueado", diff --git a/src/locales/it/starter-select-ui-handler.ts b/src/locales/it/starter-select-ui-handler.ts index ae406183a90..16061766f30 100644 --- a/src/locales/it/starter-select-ui-handler.ts +++ b/src/locales/it/starter-select-ui-handler.ts @@ -30,12 +30,12 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "selectMoveSwapWith": "Seleziona una mossa da scambiare con", "unlockPassive": "Sblocca Passiva", "reduceCost": "Riduci Costo", - "cycleShiny": ": Alterna Shiny", - "cycleForm": ": Alterna Forma", - "cycleGender": ": Alterna Sesso", - "cycleAbility": ": Alterna Abilità", - "cycleNature": ": Alterna Natura", - "cycleVariant": ": Alterna Variante", + "cycleShiny": ": Shiny", + "cycleForm": ": Forma", + "cycleGender": ": Sesso", + "cycleAbility": ": Abilità", + "cycleNature": ": Natura", + "cycleVariant": ": Variante", "enablePassive": "Attiva Passiva", "disablePassive": "Disattiva Passiva", "locked": "Bloccato", diff --git a/src/locales/ko/starter-select-ui-handler.ts b/src/locales/ko/starter-select-ui-handler.ts index 41001488458..587baa3abc4 100644 --- a/src/locales/ko/starter-select-ui-handler.ts +++ b/src/locales/ko/starter-select-ui-handler.ts @@ -31,11 +31,11 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "unlockPassive": "패시브 해금", "reduceCost": "코스트 줄이기", "cycleShiny": ": 특별한 색", - "cycleForm": ": 폼 체인지", - "cycleGender": ": 암수 전환", - "cycleAbility": ": 특성 전환", - "cycleNature": ": 성격 전환", - "cycleVariant": ": 색상 전환", + "cycleForm": ": 폼", + "cycleGender": ": 암수", + "cycleAbility": ": 특성", + "cycleNature": ": 성격", + "cycleVariant": ": 색상", "enablePassive": "패시브 활성화", "disablePassive": "패시브 비활성화", "locked": "잠김", diff --git a/src/locales/zh_CN/starter-select-ui-handler.ts b/src/locales/zh_CN/starter-select-ui-handler.ts index a05c7348ab5..803e64e0439 100644 --- a/src/locales/zh_CN/starter-select-ui-handler.ts +++ b/src/locales/zh_CN/starter-select-ui-handler.ts @@ -30,12 +30,12 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "selectMoveSwapWith": "选择要替换成的招式", "unlockPassive": "解锁被动", "reduceCost": "降低花费", - "cycleShiny": ": 切换闪光", - "cycleForm": ": 切换形态", - "cycleGender": ": 切换性别", - "cycleAbility": ": 切换特性", - "cycleNature": ": 切换性格", - "cycleVariant": ": 切换变种", + "cycleShiny": ": 闪光", + "cycleForm": ": 形态", + "cycleGender": ": 性别", + "cycleAbility": ": 特性", + "cycleNature": ": 性格", + "cycleVariant": ": 变种", "enablePassive": "启用被动", "disablePassive": "禁用被动", "locked": "未解锁", diff --git a/src/locales/zh_TW/starter-select-ui-handler.ts b/src/locales/zh_TW/starter-select-ui-handler.ts index 89642588ee4..c28cb39b94b 100644 --- a/src/locales/zh_TW/starter-select-ui-handler.ts +++ b/src/locales/zh_TW/starter-select-ui-handler.ts @@ -30,12 +30,12 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "selectMoveSwapWith": "選擇想要替換成的招式", "unlockPassive": "解鎖被動", "reduceCost": "降低花費", - "cycleShiny": ": 切換閃光", - "cycleForm": ": 切換形態", - "cycleGender": ": 切換性別", - "cycleAbility": ": 切換特性", - "cycleNature": ": 切換性格", - "cycleVariant": ": 切換變種", + "cycleShiny": ": 閃光", + "cycleForm": ": 形態", + "cycleGender": ": 性別", + "cycleAbility": ": 特性", + "cycleNature": ": 性格", + "cycleVariant": ": 變種", "enablePassive": "啟用被動", "disablePassive": "禁用被動", "locked": "未解鎖", diff --git a/src/ui/egg-gacha-ui-handler.ts b/src/ui/egg-gacha-ui-handler.ts index f0e55e04801..96874f439ff 100644 --- a/src/ui/egg-gacha-ui-handler.ts +++ b/src/ui/egg-gacha-ui-handler.ts @@ -156,15 +156,27 @@ export default class EggGachaUiHandler extends MessageUiHandler { this.eggGachaOptionSelectBg.setOrigin(1, 1); this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg); + const multiplierOne = "x1"; + const multiplierTen = "x10"; const pullOptions = [ - { 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")}` } + { multiplier: multiplierOne, description: `1 ${i18next.t("egg:pull")}`, icon: getVoucherTypeIcon(VoucherType.REGULAR) }, + { multiplier: multiplierTen, description: `10 ${i18next.t("egg:pulls")}`, icon: getVoucherTypeIcon(VoucherType.REGULAR) }, + { multiplier: multiplierOne, description: `5 ${i18next.t("egg:pulls")}`, icon: getVoucherTypeIcon(VoucherType.PLUS) }, + { multiplier: multiplierOne, description: `10 ${i18next.t("egg:pulls")}`, icon: getVoucherTypeIcon(VoucherType.PREMIUM) }, + { multiplier: multiplierOne, description: `25 ${i18next.t("egg:pulls")}`, icon: getVoucherTypeIcon(VoucherType.GOLDEN) } ]; - const pullOptionsText = pullOptions.map(option => ` ${option.multiplier.padEnd(4)} ${option.description}`).join("\n"); + const { resolvedLanguage } = i18next; + const pullOptionsText = pullOptions.map(option =>{ + const desc = option.description.split(" "); + if (desc[0].length < 2) { + desc[0] += ["zh", "ko"].includes(resolvedLanguage.substring(0,2)) ? " " : " "; + } + if (option.multiplier === multiplierOne) { + desc[0] = " " + desc[0]; + } + return ` ${option.multiplier.padEnd(5)}${desc.join(" ")}`; + }).join("\n"); const optionText = addTextObject( this.scene, @@ -181,9 +193,8 @@ export default class EggGachaUiHandler extends MessageUiHandler { optionText.setPositionRelative(this.eggGachaOptionSelectBg, 16, 9); - new Array(5).fill(null).map((_, i) => { - const voucherType = i < 2 ? VoucherType.REGULAR : i === 2 ? VoucherType.PLUS : i === 3 ? VoucherType.PREMIUM : VoucherType.GOLDEN; - const icon = this.scene.add.sprite(0, 0, "items", getVoucherTypeIcon(voucherType)); + pullOptions.forEach((option, i) => { + const icon = this.scene.add.sprite(0, 0, "items", option.icon); icon.setScale(0.5); icon.setPositionRelative(this.eggGachaOptionSelectBg, 20, 17 + i * 16); this.eggGachaOptionsContainer.add(icon); @@ -396,7 +407,8 @@ export default class EggGachaUiHandler extends MessageUiHandler { const timestamp = new Date().getTime(); for (const tier of tiers) { - const egg = new Egg(Utils.randInt(EGG_SEED, EGG_SEED * tier), this.gachaCursor, getEggTierDefaultHatchWaves(tier), timestamp); + const eggId = Utils.randInt(EGG_SEED, EGG_SEED * tier); + const egg = new Egg(eggId, this.gachaCursor, getEggTierDefaultHatchWaves(tier), timestamp); if (egg.isManaphyEgg()) { this.scene.gameData.gameStats.manaphyEggsPulled++; egg.hatchWaves = getEggTierDefaultHatchWaves(EggTier.ULTRA); diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index 92c7faf5477..653789d4a20 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -98,13 +98,6 @@ export default class EggListUiHandler extends MessageUiHandler { let e = 0; - /*this.scene.gameData.eggs = [ - new Egg(1, 1, 5, new Date().getTime()), - new Egg(1 + EGG_SEED, 1, 15, new Date().getTime()), - new Egg(1 + EGG_SEED * 2, 1, 50, new Date().getTime()), - new Egg(1 + EGG_SEED * 3, GachaType.LEGENDARY, 100, new Date().getTime()) - ];*/ - for (const egg of this.scene.gameData.eggs) { const x = (e % 11) * 18; const y = Math.floor(e / 11) * 18;