mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Add setting for disabling background music
This commit is contained in:
@@ -179,6 +179,16 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
|||||||
"Enable Sounds",
|
"Enable Sounds",
|
||||||
"Enable sound effects during the game."),
|
"Enable sound effects during the game."),
|
||||||
7);
|
7);
|
||||||
|
lstSettings.addItem(new BooleanSetting(FPref.UI_ENABLE_MUSIC,
|
||||||
|
"Enable Music",
|
||||||
|
"Enable background music during the game.") {
|
||||||
|
@Override
|
||||||
|
public void select() {
|
||||||
|
super.select();
|
||||||
|
//update background music when this setting changes
|
||||||
|
Forge.getSoundSystem().changeBackgroundTrack();
|
||||||
|
}
|
||||||
|
}, 7);
|
||||||
/*lstSettings.addItem(new BooleanSetting(FPref.UI_ALT_SOUND_SYSTEM,
|
/*lstSettings.addItem(new BooleanSetting(FPref.UI_ALT_SOUND_SYSTEM,
|
||||||
"Use Alternate Sound System",
|
"Use Alternate Sound System",
|
||||||
"Use the alternate sound system (only use if you have issues with sound not playing or disappearing)."),
|
"Use the alternate sound system (only use if you have issues with sound not playing or disappearing)."),
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
|||||||
UI_PREFERRED_AVATARS_ONLY ("false"),
|
UI_PREFERRED_AVATARS_ONLY ("false"),
|
||||||
UI_TARGETING_OVERLAY ("false"),
|
UI_TARGETING_OVERLAY ("false"),
|
||||||
UI_ENABLE_SOUNDS ("true"),
|
UI_ENABLE_SOUNDS ("true"),
|
||||||
|
UI_ENABLE_MUSIC ("true"),
|
||||||
UI_ALT_SOUND_SYSTEM ("false"),
|
UI_ALT_SOUND_SYSTEM ("false"),
|
||||||
UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH),
|
UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH),
|
||||||
UI_CLONE_MODE_SOURCE ("false"), /** */
|
UI_CLONE_MODE_SOURCE ("false"), /** */
|
||||||
|
|||||||
@@ -168,14 +168,16 @@ public class SoundSystem {
|
|||||||
changeBackgroundTrack();
|
changeBackgroundTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeBackgroundTrack() {
|
public void changeBackgroundTrack() {
|
||||||
//ensure old track stopped and disposed of if needed
|
//ensure old track stopped and disposed of if needed
|
||||||
if (currentTrack != null) {
|
if (currentTrack != null) {
|
||||||
currentTrack.dispose();
|
currentTrack.dispose();
|
||||||
currentTrack = null;
|
currentTrack = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPlaylist == null) { return; }
|
if (currentPlaylist == null || !FModel.getPreferences().getPrefBoolean(FPref.UI_ENABLE_MUSIC)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String filename = currentPlaylist.getRandomFilename();
|
String filename = currentPlaylist.getRandomFilename();
|
||||||
if (filename == null) { return; }
|
if (filename == null) { return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user