From e879b3c6a01e6a48a7571ad7a9ee1f8576803788 Mon Sep 17 00:00:00 2001 From: Adrian T <68144167+torranx@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:54:37 +0800 Subject: [PATCH] [Enhancement][QoL] Add option to adjust shop overlay opacity (#2622) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add option to adjust shop overlay opacity * add localization * fix bug * Update src/locales/fr/settings.ts Co-authored-by: Lugiad' * Update src/locales/zh_CN/settings.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/fr/settings.ts Co-authored-by: Lugiad' * update default value * update setting values * re-add value 10 * Update src/locales/pt_BR/settings.ts Co-authored-by: José Ricardo Fleury Oliveira * Update src/locales/ko/settings.ts Co-authored-by: Enoch * Update src/locales/es/settings.ts Co-authored-by: InnocentGameDev * Update settings.ts --------- Co-authored-by: Lugiad' Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira Co-authored-by: Enoch Co-authored-by: InnocentGameDev Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> --- src/battle-scene.ts | 17 +++++++++++++++-- src/locales/de/settings.ts | 1 + src/locales/en/settings.ts | 1 + src/locales/es/settings.ts | 1 + src/locales/fr/settings.ts | 3 ++- src/locales/it/settings.ts | 7 ++++--- src/locales/ko/settings.ts | 1 + src/locales/pt_BR/settings.ts | 1 + src/locales/zh_CN/settings.ts | 1 + src/locales/zh_TW/settings.ts | 1 + src/system/settings/settings.ts | 20 +++++++++++++++++++- 11 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 39442fc21df..9b13a56bb8e 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -224,6 +224,9 @@ export default class BattleScene extends SceneBase { private fieldOverlay: Phaser.GameObjects.Rectangle; private shopOverlay: Phaser.GameObjects.Rectangle; + private shopOverlayShown: boolean = false; + private shopOverlayOpacity: number = .80; + public modifiers: PersistentModifier[]; private enemyModifiers: PersistentModifier[]; public uiContainer: Phaser.GameObjects.Container; @@ -1428,19 +1431,29 @@ export default class BattleScene extends SceneBase { }); } + updateShopOverlayOpacity(value: number): void { + this.shopOverlayOpacity = value; + + if (this.shopOverlayShown) { + this.shopOverlay.setAlpha(this.shopOverlayOpacity); + } + } + showShopOverlay(duration: integer): Promise { + this.shopOverlayShown = true; return new Promise(resolve => { this.tweens.add({ targets: this.shopOverlay, - alpha: 0.8, + alpha: this.shopOverlayOpacity, ease: "Sine.easeOut", - duration: duration, + duration, onComplete: () => resolve() }); }); } hideShopOverlay(duration: integer): Promise { + this.shopOverlayShown = false; return new Promise(resolve => { this.tweens.add({ targets: this.shopOverlay, diff --git a/src/locales/de/settings.ts b/src/locales/de/settings.ts index 0254611b5d5..2ec9f790d10 100644 --- a/src/locales/de/settings.ts +++ b/src/locales/de/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "Controller", "gamepadSupport": "Controllerunterstützung", "showBgmBar": "Musiknamen anzeigen", + "shopOverlayOpacity": "Shop Overlay Opacity" } as const; diff --git a/src/locales/en/settings.ts b/src/locales/en/settings.ts index f68a649269f..491bfa4a481 100644 --- a/src/locales/en/settings.ts +++ b/src/locales/en/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "Controller", "gamepadSupport": "Gamepad Support", "showBgmBar": "Show Music Names", + "shopOverlayOpacity": "Shop Overlay Opacity" } as const; diff --git a/src/locales/es/settings.ts b/src/locales/es/settings.ts index dfd6f097242..407bfab602f 100644 --- a/src/locales/es/settings.ts +++ b/src/locales/es/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "Controller", "gamepadSupport": "Gamepad Support", "showBgmBar": "Show Music Names", + "shopOverlayOpacity": "Opacidad de la fase de compra" } as const; diff --git a/src/locales/fr/settings.ts b/src/locales/fr/settings.ts index cd85b0f8cb9..9e3bd04923a 100644 --- a/src/locales/fr/settings.ts +++ b/src/locales/fr/settings.ts @@ -95,5 +95,6 @@ export const settings: SimpleTranslationEntries = { "mute": "Muet", "controller": "Controller", "gamepadSupport": "Gamepad Support", - "showBgmBar": "Montrer titre de la musique", + "showBgmBar": "Titre de la musique", + "shopOverlayOpacity": "Opacité boutique" } as const; diff --git a/src/locales/it/settings.ts b/src/locales/it/settings.ts index af48368aeeb..07cbe6b7f46 100644 --- a/src/locales/it/settings.ts +++ b/src/locales/it/settings.ts @@ -3,7 +3,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales.js"; export const settings: SimpleTranslationEntries = { "boy": "Ragazzo", "girl": "Ragazza", - "general": "General", + "general": "Generale", "display": "Display", "audio": "Audio", "gamepad": "Gamepad", @@ -94,6 +94,7 @@ export const settings: SimpleTranslationEntries = { "alt": " (Alt)", "mute": "Mute", "controller": "Controller", - "gamepadSupport": "Gamepad Support", - "showBgmBar": "Show Music Names", + "gamepadSupport": "Supporto Gamepad", + "showBgmBar": "Mostra Nomi Musica", + "shopOverlayOpacity": "Opacità Finestra Negozio" } as const; diff --git a/src/locales/ko/settings.ts b/src/locales/ko/settings.ts index 6514683cd94..40e9676b6da 100644 --- a/src/locales/ko/settings.ts +++ b/src/locales/ko/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "컨트롤러", "gamepadSupport": "게임패드 지원", "showBgmBar": "BGM 제목 보여주기", + "shopOverlayOpacity": "상점 오버레이 투명도" } as const; diff --git a/src/locales/pt_BR/settings.ts b/src/locales/pt_BR/settings.ts index 9d336cf0757..b6a48143435 100644 --- a/src/locales/pt_BR/settings.ts +++ b/src/locales/pt_BR/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "Controle", "gamepadSupport": "Suporte para Controle", "showBgmBar": "Show Music Names", + "shopOverlayOpacity": "Opacidade da Loja" } as const; diff --git a/src/locales/zh_CN/settings.ts b/src/locales/zh_CN/settings.ts index 3ca6cb435c6..92372deec42 100644 --- a/src/locales/zh_CN/settings.ts +++ b/src/locales/zh_CN/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "控制器", "gamepadSupport": "手柄支持", "showBgmBar": "显示音乐名称", + "shopOverlayOpacity": "商店显示不透明度" } as const; diff --git a/src/locales/zh_TW/settings.ts b/src/locales/zh_TW/settings.ts index dcb87fafe35..c6c055ed4d2 100644 --- a/src/locales/zh_TW/settings.ts +++ b/src/locales/zh_TW/settings.ts @@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = { "controller": "控制器", "gamepadSupport": "手柄支持", "showBgmBar": "Show Music Names", + "shopOverlayOpacity": "Shop Overlay Opacity" } as const; diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index 25abd74541e..af27613136c 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -16,6 +16,13 @@ const VOLUME_OPTIONS: SettingOption[] = new Array(11).fill(null).map((_, i) => i value: "Mute", label: i18next.t("settings:mute") }); +const SHOP_OVERLAY_OPACITY_OPTIONS: SettingOption[] = new Array(9).fill(null).map((_, i) => { + const value = ((i + 1) * 10).toString(); + return { + value, + label: value, + }; +}); const OFF_ON: SettingOption[] = [ { value: "Off", @@ -98,6 +105,7 @@ export const SettingKeys = { SE_Volume: "SE_VOLUME", Music_Preference: "MUSIC_PREFERENCE", Show_BGM_Bar: "SHOW_BGM_BAR", + Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY" }; /** @@ -534,7 +542,14 @@ export const Setting: Array = [ type: SettingType.AUDIO, requireReload: true }, - + { + key: SettingKeys.Shop_Overlay_Opacity, + label: i18next.t("settings:shopOverlayOpacity"), + options: SHOP_OVERLAY_OPACITY_OPTIONS, + default: 7, + type: SettingType.DISPLAY, + requireReload: false + }, ]; /** @@ -759,6 +774,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer): } } break; + case SettingKeys.Shop_Overlay_Opacity: + scene.updateShopOverlayOpacity(parseInt(Setting[index].options[value].value) * .01); + break; } return true;