[QoL] Add setting to control volume of UI sound efffects (#3354)

* 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>
This commit is contained in:
Taylor Le Lievre 2024-08-26 16:01:54 -04:00 committed by GitHub
parent 392bb1803c
commit f688ed7329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View File

@ -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;

View File

@ -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",

View File

@ -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<Setting> = [
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;

View File

@ -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;
}
}