From f688ed73294b032f23986144b5e8191080cd0f15 Mon Sep 17 00:00:00 2001 From: Taylor Le Lievre <78890517+tlelievre26@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:01:54 -0400 Subject: [PATCH] [QoL] Add setting to control volume of UI sound efffects (#3354) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added settings option to toggle UI sound effects * Added text to other locales * Localizations except es and it * New language locales * Added italian translation Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Refactored on top of PR #3527 * Rebased and updated setting name * Added comments for the included sound effects --------- Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> --- src/battle-scene.ts | 7 ++++++- src/locales/en/settings.json | 1 + src/system/settings/settings.ts | 11 +++++++++++ src/ui/settings/settings-audio-ui-handler.ts | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 922a145780b..0ffa7c95196 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -126,6 +126,7 @@ export default class BattleScene extends SceneBase { public bgmVolume: number = 1; public fieldVolume: number = 1; public seVolume: number = 1; + public uiVolume: number = 1; public gameSpeed: integer = 1; public damageNumbersMode: integer = 0; public reroll: boolean = false; @@ -1799,11 +1800,15 @@ export default class BattleScene extends SceneBase { config["volume"] *= 0.5; } break; - case "se": case "ui": + //As of, right now this applies to the "select", "menu_open", "error" sound effects + config["volume"] = this.masterVolume * this.uiVolume; + break; + case "se": default: config["volume"] = this.masterVolume * this.seVolume; break; + } this.sound.play(key, config); return this.sound.get(key) as AnySound; diff --git a/src/locales/en/settings.json b/src/locales/en/settings.json index 947dfe98bb4..6528f0368fe 100644 --- a/src/locales/en/settings.json +++ b/src/locales/en/settings.json @@ -63,6 +63,7 @@ "bgmVolume": "BGM Volume", "fieldVolume": "Field Volume", "seVolume": "SE Volume", + "uiVolume": "UI Volume", "musicPreference": "Music Preference", "mixed": "Mixed", "gamepadPleasePlug": "Please Plug in a Gamepad or Press a Button", diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index a7ad3f6697e..7b0fea95a98 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -119,6 +119,7 @@ export const SettingKeys = { BGM_Volume: "BGM_VOLUME", Field_Volume: "FIELD_VOLUME", SE_Volume: "SE_VOLUME", + UI_Volume: "UI_SOUND_EFFECTS", Music_Preference: "MUSIC_PREFERENCE", Show_BGM_Bar: "SHOW_BGM_BAR", Move_Touch_Controls: "MOVE_TOUCH_CONTROLS", @@ -556,6 +557,13 @@ export const Setting: Array = [ default: 10, type: SettingType.AUDIO }, + { + key: SettingKeys.UI_Volume, + label: i18next.t("settings:uiVolume"), + options: VOLUME_OPTIONS, + default: 10, + type: SettingType.AUDIO + }, { key: SettingKeys.Music_Preference, label: i18next.t("settings:musicPreference"), @@ -670,6 +678,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer): scene.seVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0; scene.updateSoundVolume(); break; + case SettingKeys.UI_Volume: + scene.uiVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0; + break; case SettingKeys.Music_Preference: scene.musicPreference = value; break; diff --git a/src/ui/settings/settings-audio-ui-handler.ts b/src/ui/settings/settings-audio-ui-handler.ts index 27ca7e35354..4a895fc3170 100644 --- a/src/ui/settings/settings-audio-ui-handler.ts +++ b/src/ui/settings/settings-audio-ui-handler.ts @@ -15,6 +15,6 @@ export default class SettingsAudioUiHandler extends AbstractSettingsUiHandler { super(scene, SettingType.AUDIO, mode); this.title = "Audio"; this.localStorageKey = "settings"; - this.rowsToDisplay = 5; + this.rowsToDisplay = 6; } }