From 238a3ea17af57718e1b7cd8908b2011791b7b69f Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 08:49:52 +0300 Subject: [PATCH 1/6] - Initial implementation of sound profiles, part 1. --- .../home/settings/CSubmenuPreferences.java | 9 ++++++ .../home/settings/VSubmenuPreferences.java | 8 +++++ .../src/main/java/forge/sound/AudioClip.java | 4 +-- forge-gui-mobile/src/forge/GuiMobile.java | 7 ++-- forge-gui/res/languages/de-DE.properties | 1 + forge-gui/res/languages/en-US.properties | 2 ++ forge-gui/res/languages/es-ES.properties | 1 + forge-gui/res/languages/it-IT.properties | 1 + forge-gui/res/languages/ja-JP.properties | 1 + forge-gui/res/languages/zh-CN.properties | 1 + .../properties/ForgeConstants.java | 1 + .../properties/ForgePreferences.java | 1 + .../java/forge/sound/EventVisualizer.java | 2 +- .../main/java/forge/sound/SoundSystem.java | 32 +++++++++++++++++-- 14 files changed, 60 insertions(+), 11 deletions(-) diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java index 39e16160f03..a547ab5c2cf 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java @@ -262,6 +262,7 @@ public enum CSubmenuPreferences implements ICDoc { initializeAutoUpdaterComboBox(); initializeMulliganRuleComboBox(); initializeAiProfilesComboBox(); + initializeSoundProfilesComboBox(); initializeStackAdditionsComboBox(); initializeLandPlayedComboBox(); initializeColorIdentityCombobox(); @@ -466,6 +467,14 @@ public enum CSubmenuPreferences implements ICDoc { panel.setComboBox(comboBox, selectedItem); } + private void initializeSoundProfilesComboBox() { + final FPref userSetting = FPref.UI_CURRENT_SOUND_PROFILE; + final FComboBoxPanel panel = this.view.getSoundProfilesComboBoxPanel(); + final FComboBox comboBox = createComboBox(SoundSystem.getAvailableSoundProfiles(), userSetting); + final String selectedItem = this.prefs.getPref(userSetting); + panel.setComboBox(comboBox, selectedItem); + } + private void initializeCardArtPreference() { final String latestOpt = Localizer.getInstance().getMessage("latestArtOpt"); final String originalOpt = Localizer.getInstance().getMessage("originalArtOpt"); diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java index 31934975948..2a542284e1c 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java @@ -128,6 +128,7 @@ public enum VSubmenuPreferences implements IVSubmenu { private final FComboBoxPanel cbpCardArtFormat = new FComboBoxPanel<>(localizer.getMessage("cbpCardArtFormat")+":"); private final FComboBoxPanel cbpCardArtPreference = new FComboBoxPanel<>(localizer.getMessage("lblPreferredArt")+":"); private final FComboBoxPanel cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":"); + private final FComboBoxPanel cbpSoundProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpSoundProfiles")+":"); private final FComboBoxPanel cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":"); private final FComboBoxPanel cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":"); private final FComboBoxPanel cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":"); @@ -414,6 +415,9 @@ public enum VSubmenuPreferences implements IVSubmenu { pnlPrefs.add(cbEnableSounds, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnableSounds")), descriptionConstraints); + pnlPrefs.add(cbpSoundProfiles, comboBoxConstraints); + pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpSoundProfiles")), descriptionConstraints); + pnlPrefs.add(cbEnableMusic, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnableMusic")), descriptionConstraints); @@ -740,6 +744,10 @@ public enum VSubmenuPreferences implements IVSubmenu { return cbpMulliganRule; } + public FComboBoxPanel getSoundProfilesComboBoxPanel() { + return cbpSoundProfiles; + } + public FComboBoxPanel getAiProfilesComboBoxPanel() { return cbpAiProfiles; } diff --git a/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java b/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java index ac2e0be5db5..7fe6ed340c1 100644 --- a/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java +++ b/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java @@ -64,7 +64,7 @@ public class AudioClip implements IAudioClip { } public static boolean fileExists(String fileName) { - File fSound = new File(ForgeConstants.SOUND_DIR, fileName); + File fSound = new File(SoundSystem.getSoundDirectory(), fileName); return fSound.exists(); } @@ -195,7 +195,7 @@ public class AudioClip implements IAudioClip { } private Clip createClip(String filename) { - File fSound = new File(ForgeConstants.SOUND_DIR, filename); + File fSound = new File(SoundSystem.getSoundDirectory(), filename); if (!fSound.exists()) { throw new IllegalArgumentException("Sound file " + fSound.toString() + " does not exist, cannot make a clip of it"); } diff --git a/forge-gui-mobile/src/forge/GuiMobile.java b/forge-gui-mobile/src/forge/GuiMobile.java index f04a3fcc76c..e7a4531c842 100644 --- a/forge-gui-mobile/src/forge/GuiMobile.java +++ b/forge-gui-mobile/src/forge/GuiMobile.java @@ -21,10 +21,7 @@ import forge.screens.LoadingOverlay; import forge.screens.match.MatchController; import forge.screens.quest.QuestMenu; import forge.screens.settings.GuiDownloader; -import forge.sound.AudioClip; -import forge.sound.AudioMusic; -import forge.sound.IAudioClip; -import forge.sound.IAudioMusic; +import forge.sound.*; import forge.toolbox.FOptionPane; import forge.toolbox.GuiChoose; import forge.util.*; @@ -272,7 +269,7 @@ public class GuiMobile implements IGuiBase { @Override public IAudioClip createAudioClip(final String filename) { - return AudioClip.createClip(ForgeConstants.SOUND_DIR + filename); + return AudioClip.createClip(SoundSystem.getSoundDirectory() + filename); } @Override diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index 31cb928ee23..4fc681fb5cb 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -111,6 +111,7 @@ cbpGameLogEntryType=Spielberichtsumfang cbpCloseAction=Beenden cbpDefaultFontSize=Standard Schriftgröße cbpCardArtFormat=Kartenbildformat +cbpSoundProfiles=Sound Profile cbpAiProfiles=KI Persönlichkeit cbpStackAdditions=Nachricht bei Stapeländerung cbpDisplayCurrentCardColors=Zeige detaillierte Kartenfarben diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index c22b8e08639..9a5c351eb9e 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -113,6 +113,7 @@ cbpCloseAction=Close Action cbpDefaultFontSize=Default Font Size cbpCardArtFormat=Card Art Format cbpAiProfiles=AI Personality +cbpSoundProfiles=Sound Profile cbpStackAdditions=Stack effect notifications cbpDisplayCurrentCardColors=Show Detailed Card Color cbpAutoYieldMode=Auto-Yield @@ -142,6 +143,7 @@ nlCompactMainMenu=Enable for a space efficient sidebar that displays only one me nlUseSentry=When enabled, automatically submits bug reports to developers. GamePlay=Gameplay nlpMulliganRule=Choose the version of the Mulligan rule +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Choose your AI opponent nlpStackAdditions=Choose when you want to get visual notifications for an effect added to the stack: Never, always, or only for the effects cast/activated by a AI player or triggered by any player nlAnte=Determines whether or not the game is played for ante. diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index 8ea46c95fe9..3a5fbf406ce 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -112,6 +112,7 @@ cbpGameLogEntryType=Registro del juego cbpCloseAction=Acción al cerrar cbpDefaultFontSize=Tamaño de fuente predeterminado cbpCardArtFormat=Card Art Format +cbpSoundProfiles=Sound Profile cbpAiProfiles=Personalidad de la IA cbpStackAdditions=Efecto de la pila de notificaciones cbpDisplayCurrentCardColors=Mostrar color de la carta diff --git a/forge-gui/res/languages/it-IT.properties b/forge-gui/res/languages/it-IT.properties index c089272c174..7b81edf4e5b 100644 --- a/forge-gui/res/languages/it-IT.properties +++ b/forge-gui/res/languages/it-IT.properties @@ -111,6 +111,7 @@ cbpGameLogEntryType=Verbosità del registro di gioco cbpCloseAction=Chiudi cbpDefaultFontSize=Dimensione carattere predefinita cbpCardArtFormat=Formato dell'Illustrazione delle carte +cbpSoundProfiles=Sound Profile cbpAiProfiles=Personalità dell''IA cbpStackAdditions=Notifiche degli effetti in pila cbpDisplayCurrentCardColors=Mostra colore scheda dettagliato diff --git a/forge-gui/res/languages/ja-JP.properties b/forge-gui/res/languages/ja-JP.properties index ec920c6c054..107ca2e0963 100644 --- a/forge-gui/res/languages/ja-JP.properties +++ b/forge-gui/res/languages/ja-JP.properties @@ -112,6 +112,7 @@ cbpGameLogEntryType=ゲームログの詳細レベル cbpCloseAction=閉じる時の動作 cbpDefaultFontSize=デフォルトのフォントサイズ cbpCardArtFormat=カードのアートフォーマット +cbpSoundProfiles=Sound Profile cbpAiProfiles=AI の性格 cbpStackAdditions=スタック効果通知 cbpDisplayCurrentCardColors=詳細なカードの色を表示 diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index 77ea552a0be..da80b481fb3 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -112,6 +112,7 @@ cbpGameLogEntryType=游戏日志详细程度 cbpCloseAction=关闭动作 cbpDefaultFontSize=默认字体大小 cbpCardArtFormat=牌张插画格式 +cbpSoundProfiles=Sound Profile cbpAiProfiles=AI强度 cbpStackAdditions=堆叠效应通知 cbpDisplayCurrentCardColors=显示卡牌颜色详情 diff --git a/forge-gui/src/main/java/forge/localinstance/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/localinstance/properties/ForgeConstants.java index 792074b7a8d..aeb1bd369f5 100644 --- a/forge-gui/src/main/java/forge/localinstance/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/localinstance/properties/ForgeConstants.java @@ -283,6 +283,7 @@ public final class ForgeConstants { public static final String DB_DIR = CACHE_DIR + "db" + PATH_SEPARATOR; public static final String FONTS_DIR = CACHE_DIR + "fonts" + PATH_SEPARATOR; public static final String CACHE_SKINS_DIR = CACHE_DIR + "skins" + PATH_SEPARATOR; + public static final String CACHE_SOUND_DIR = CACHE_DIR + "sound" + PATH_SEPARATOR; public static final String CACHE_TOKEN_PICS_DIR = PICS_DIR + "tokens" + PATH_SEPARATOR; public static final String CACHE_ICON_PICS_DIR = PICS_DIR + "icons" + PATH_SEPARATOR; public static final String CACHE_SYMBOLS_DIR = PICS_DIR + "symbols" + PATH_SEPARATOR; diff --git a/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java b/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java index 24def10e2a2..348c1e795c4 100644 --- a/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java +++ b/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java @@ -121,6 +121,7 @@ public class ForgePreferences extends PreferencesStore { UI_VOL_SOUNDS ("100"), UI_VOL_MUSIC ("100"), UI_ALT_SOUND_SYSTEM ("false"), + UI_CURRENT_SOUND_PROFILE ("Default"), UI_CURRENT_AI_PROFILE ("Default"), UI_CLONE_MODE_SOURCE ("false"), UI_MATCH_IMAGE_VISIBLE ("true"), diff --git a/forge-gui/src/main/java/forge/sound/EventVisualizer.java b/forge-gui/src/main/java/forge/sound/EventVisualizer.java index 884a8871127..3165ce06e7f 100644 --- a/forge-gui/src/main/java/forge/sound/EventVisualizer.java +++ b/forge-gui/src/main/java/forge/sound/EventVisualizer.java @@ -331,7 +331,7 @@ public class EventVisualizer extends IGameEventVisitor.Base imp } // Only proceed if the file actually exists - return new File(ForgeConstants.SOUND_DIR, effect).exists(); + return new File(SoundSystem.getSoundDirectory(), effect).exists(); } diff --git a/forge-gui/src/main/java/forge/sound/SoundSystem.java b/forge-gui/src/main/java/forge/sound/SoundSystem.java index d1dcab487c0..ca2b9e7f6fd 100644 --- a/forge-gui/src/main/java/forge/sound/SoundSystem.java +++ b/forge-gui/src/main/java/forge/sound/SoundSystem.java @@ -1,8 +1,7 @@ package forge.sound; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Map; +import java.io.File; +import java.util.*; import com.google.common.eventbus.Subscribe; @@ -245,4 +244,31 @@ public class SoundSystem { currentTrack = null; } } + + public static String[] getAvailableSoundProfiles() + { + final List availableProfiles = new ArrayList<>(); + availableProfiles.add("Default"); + + final File dir = new File(ForgeConstants.CACHE_SOUND_DIR); + if (dir != null && dir.exists()) { + final String[] files = dir.list(); + for (String fileName : files) { + if (!fileName.equals("Default") && new File(fileName).isDirectory()) { + availableProfiles.add(fileName); + } + } + } + + return availableProfiles.toArray(new String[availableProfiles.size()]); + } + + public static String getSoundDirectory() { + String profileName = FModel.getPreferences().getPref(FPref.UI_CURRENT_SOUND_PROFILE); + if (profileName.equals("Default")) { + return ForgeConstants.SOUND_DIR; + } else { + return ForgeConstants.CACHE_SOUND_DIR + profileName + ForgeConstants.PATH_SEPARATOR; + } + } } From 5aa25f7ad0a53e85332b9c189f6dc5069f965dba Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 09:01:53 +0300 Subject: [PATCH 2/6] - Initial implementation of sound profiles, part 2. --- forge-gui/res/languages/de-DE.properties | 1 + forge-gui/res/languages/es-ES.properties | 1 + forge-gui/res/languages/it-IT.properties | 1 + forge-gui/res/languages/ja-JP.properties | 1 + forge-gui/res/languages/zh-CN.properties | 1 + forge-gui/src/main/java/forge/sound/SoundSystem.java | 11 +++++++---- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index 4fc681fb5cb..efff3deed71 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -142,6 +142,7 @@ nlCompactMainMenu=Aktiviere, um im Seitenmenü platzsparend immer nur eine Menü nlUseSentry=Aktiviere, um automatische Fehlerberichte an die Entwickler zu senden. GamePlay=Spiel nlpMulliganRule=Wähle die Version der Mulligan Regel +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Wähle die Spielweise deines KI-Gegners. nlpStackAdditions=Wähle, wann du über Änderungen am Stapel benachrichtigt werden möchtest: Niemals, immer oder nur für durch andere Spieler ausgelöste Effekte und Fähigkeiten nlAnte=Entscheidet, ob um einen Einsatz (Ante) gespielt wird. diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index 3a5fbf406ce..26c598bfcd8 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -143,6 +143,7 @@ nlCompactMainMenu=Habilitar para una barra lateral eficiente en espacio que mues nlUseSentry=Cuando está habilitado, envía automáticamente informes de errores a los desarrolladores. GamePlay=Juego nlpMulliganRule=Elige versión de reglas de mulligan +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Elige tu oponente de la IA nlpStackAdditions=Elige cuándo quieres recibir notificaciones visuales para un efecto añadido a la pila: Nunca, siempre o sólo para los efectos lanzados/activados por un jugador IA o activados por cualquier jugador nlAnte=Determina si el juego se juega con apuesta o no. diff --git a/forge-gui/res/languages/it-IT.properties b/forge-gui/res/languages/it-IT.properties index 7b81edf4e5b..fecd87005cc 100644 --- a/forge-gui/res/languages/it-IT.properties +++ b/forge-gui/res/languages/it-IT.properties @@ -142,6 +142,7 @@ nlCompactMainMenu=Abilitare per una barra laterale efficiente in termini di spaz nlUseSentry=Se abilitato, invia automaticamente segnalazioni di bug agli sviluppatori. GamePlay=Gameplay nlpMulliganRule=Scegli il tipo di Mulligan +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Scegli il tuo avversario (IA) nlpStackAdditions=Scegli quando vuoi ricevere una notifica visiva di un effetto aggiunto alla pila: Mai, sempre, o solo per gli effetti lanciati/attivati da un giocatore IA o innescati da un qualsiasi giocatore nlAnte=Determina se l''incontro è giocato o meno con la posta. diff --git a/forge-gui/res/languages/ja-JP.properties b/forge-gui/res/languages/ja-JP.properties index 107ca2e0963..0dcf28edee0 100644 --- a/forge-gui/res/languages/ja-JP.properties +++ b/forge-gui/res/languages/ja-JP.properties @@ -143,6 +143,7 @@ nlCompactMainMenu=サイドバーに同時に一つのメニューグループ nlUseSentry=有効にすると、バグレポートが開発者に自動的に送信されます。 GamePlay=ゲーム設定 nlpMulliganRule=マリガンルールを選択する。 +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=対戦相手 AI の性格を選択する。 nlpStackAdditions=スタックに追加された能力の視覚通知をいつ取得するかを選択します:(Never[しない]、Always[常時]、またはAIプレーヤーによってキャスト/起動された能力、または任意のプレーヤーによって誘発された能力に対してのみ nlAnte=ゲームでアンティ(賭け)ルールを適用するか選択する。 diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index da80b481fb3..459eb5bad68 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -143,6 +143,7 @@ nlCompactMainMenu=启用节省空间的侧边栏,一次只显示一个菜单 nlUseSentry=启用后,会自动向开发人员提交错误报告。 GamePlay=游戏 nlpMulliganRule=选择调度规则 +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=选择你的AI对手 nlpStackAdditions=选择何时因效应进入堆叠而提供视觉提醒:从不,总是,任何由AI释放或起动以及由任何玩家触发的效应。 nlAnte=确定游戏是否使用赌注 diff --git a/forge-gui/src/main/java/forge/sound/SoundSystem.java b/forge-gui/src/main/java/forge/sound/SoundSystem.java index ca2b9e7f6fd..ba18121a3ab 100644 --- a/forge-gui/src/main/java/forge/sound/SoundSystem.java +++ b/forge-gui/src/main/java/forge/sound/SoundSystem.java @@ -107,7 +107,7 @@ public class SoundSystem { */ public void play(final String resourceFileName, final boolean isSynchronized) { if (isUsingAltSystem()) { - GuiBase.getInterface().startAltSoundSystem(ForgeConstants.SOUND_DIR + resourceFileName, isSynchronized); + GuiBase.getInterface().startAltSoundSystem(getSoundDirectory() + resourceFileName, isSynchronized); } else { final IAudioClip snd = fetchResource(resourceFileName); @@ -122,7 +122,7 @@ public class SoundSystem { */ public void play(final SoundEffectType type, final boolean isSynchronized) { if (isUsingAltSystem()) { - GuiBase.getInterface().startAltSoundSystem(ForgeConstants.SOUND_DIR + type.getResourceFileName(), isSynchronized); + GuiBase.getInterface().startAltSoundSystem(getSoundDirectory() + type.getResourceFileName(), isSynchronized); } else { final IAudioClip snd = fetchResource(type); if (!isSynchronized || snd.isDone()) { @@ -248,18 +248,21 @@ public class SoundSystem { public static String[] getAvailableSoundProfiles() { final List availableProfiles = new ArrayList<>(); - availableProfiles.add("Default"); final File dir = new File(ForgeConstants.CACHE_SOUND_DIR); if (dir != null && dir.exists()) { final String[] files = dir.list(); for (String fileName : files) { - if (!fileName.equals("Default") && new File(fileName).isDirectory()) { + String fullPath = ForgeConstants.CACHE_SOUND_DIR + fileName; + if (!fileName.equals("Default") && new File(fullPath).isDirectory()) { availableProfiles.add(fileName); } } } + Collections.sort(availableProfiles); + availableProfiles.add(0, "Default"); + return availableProfiles.toArray(new String[availableProfiles.size()]); } From 74fbb1ed57cf8633a2afb9355d9b7d177b7cbf23 Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 09:14:57 +0300 Subject: [PATCH 3/6] - Mobile settings for the sound profile. - Tweaked the sound profile setting hint. --- .../src/forge/screens/settings/SettingsPage.java | 5 +++++ forge-gui/res/languages/de-DE.properties | 2 +- forge-gui/res/languages/en-US.properties | 2 +- forge-gui/res/languages/es-ES.properties | 2 +- forge-gui/res/languages/it-IT.properties | 2 +- forge-gui/res/languages/ja-JP.properties | 2 +- forge-gui/res/languages/zh-CN.properties | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java index fca57671c7b..207f14fcef7 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java @@ -612,6 +612,11 @@ public class SettingsPage extends TabPage { localizer.getMessage("nlVibrateAfterLongPress")), 6); //Sound Options + lstSettings.addItem(new CustomSelectSetting(FPref.UI_CURRENT_SOUND_PROFILE, + localizer.getMessage("cbpSoundProfiles"), + localizer.getMessage("nlpSoundProfiles"), + SoundSystem.getAvailableSoundProfiles()), + 7); lstSettings.addItem(new CustomSelectSetting(FPref.UI_VOL_SOUNDS, localizer.getMessage("cbAdjustSoundsVolume"), localizer.getMessage("nlAdjustSoundsVolume"), diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index efff3deed71..6f5226c42f3 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -142,7 +142,7 @@ nlCompactMainMenu=Aktiviere, um im Seitenmenü platzsparend immer nur eine Menü nlUseSentry=Aktiviere, um automatische Fehlerberichte an die Entwickler zu senden. GamePlay=Spiel nlpMulliganRule=Wähle die Version der Mulligan Regel -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Wähle die Spielweise deines KI-Gegners. nlpStackAdditions=Wähle, wann du über Änderungen am Stapel benachrichtigt werden möchtest: Niemals, immer oder nur für durch andere Spieler ausgelöste Effekte und Fähigkeiten nlAnte=Entscheidet, ob um einen Einsatz (Ante) gespielt wird. diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index 9a5c351eb9e..a36347c8601 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=Enable for a space efficient sidebar that displays only one me nlUseSentry=When enabled, automatically submits bug reports to developers. GamePlay=Gameplay nlpMulliganRule=Choose the version of the Mulligan rule -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Choose your AI opponent nlpStackAdditions=Choose when you want to get visual notifications for an effect added to the stack: Never, always, or only for the effects cast/activated by a AI player or triggered by any player nlAnte=Determines whether or not the game is played for ante. diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index 26c598bfcd8..b72fc2cf7d0 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=Habilitar para una barra lateral eficiente en espacio que mues nlUseSentry=Cuando está habilitado, envía automáticamente informes de errores a los desarrolladores. GamePlay=Juego nlpMulliganRule=Elige versión de reglas de mulligan -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Elige tu oponente de la IA nlpStackAdditions=Elige cuándo quieres recibir notificaciones visuales para un efecto añadido a la pila: Nunca, siempre o sólo para los efectos lanzados/activados por un jugador IA o activados por cualquier jugador nlAnte=Determina si el juego se juega con apuesta o no. diff --git a/forge-gui/res/languages/it-IT.properties b/forge-gui/res/languages/it-IT.properties index fecd87005cc..bbe9422b146 100644 --- a/forge-gui/res/languages/it-IT.properties +++ b/forge-gui/res/languages/it-IT.properties @@ -142,7 +142,7 @@ nlCompactMainMenu=Abilitare per una barra laterale efficiente in termini di spaz nlUseSentry=Se abilitato, invia automaticamente segnalazioni di bug agli sviluppatori. GamePlay=Gameplay nlpMulliganRule=Scegli il tipo di Mulligan -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Scegli il tuo avversario (IA) nlpStackAdditions=Scegli quando vuoi ricevere una notifica visiva di un effetto aggiunto alla pila: Mai, sempre, o solo per gli effetti lanciati/attivati da un giocatore IA o innescati da un qualsiasi giocatore nlAnte=Determina se l''incontro è giocato o meno con la posta. diff --git a/forge-gui/res/languages/ja-JP.properties b/forge-gui/res/languages/ja-JP.properties index 0dcf28edee0..1709332021a 100644 --- a/forge-gui/res/languages/ja-JP.properties +++ b/forge-gui/res/languages/ja-JP.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=サイドバーに同時に一つのメニューグループ nlUseSentry=有効にすると、バグレポートが開発者に自動的に送信されます。 GamePlay=ゲーム設定 nlpMulliganRule=マリガンルールを選択する。 -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=対戦相手 AI の性格を選択する。 nlpStackAdditions=スタックに追加された能力の視覚通知をいつ取得するかを選択します:(Never[しない]、Always[常時]、またはAIプレーヤーによってキャスト/起動された能力、または任意のプレーヤーによって誘発された能力に対してのみ nlAnte=ゲームでアンティ(賭け)ルールを適用するか選択する。 diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index 459eb5bad68..bdb471160b7 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=启用节省空间的侧边栏,一次只显示一个菜单 nlUseSentry=启用后,会自动向开发人员提交错误报告。 GamePlay=游戏 nlpMulliganRule=选择调度规则 -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory +nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=选择你的AI对手 nlpStackAdditions=选择何时因效应进入堆叠而提供视觉提醒:从不,总是,任何由AI释放或起动以及由任何玩家触发的效应。 nlAnte=确定游戏是否使用赌注 From 61ce25f2ddf1fc4f2f9e8d08719d2a9dfce2a996 Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 09:33:01 +0300 Subject: [PATCH 4/6] - Change the name "sound profile" to "sound set", which makes more sense. - Reset to Default profile in absence of custom sound sets. --- .../home/settings/CSubmenuPreferences.java | 10 +++++----- .../home/settings/VSubmenuPreferences.java | 10 +++++----- .../forge/screens/settings/SettingsPage.java | 8 ++++---- forge-gui/res/languages/de-DE.properties | 4 ++-- forge-gui/res/languages/en-US.properties | 4 ++-- forge-gui/res/languages/es-ES.properties | 4 ++-- forge-gui/res/languages/it-IT.properties | 4 ++-- forge-gui/res/languages/ja-JP.properties | 4 ++-- forge-gui/res/languages/zh-CN.properties | 4 ++-- .../properties/ForgePreferences.java | 2 +- .../main/java/forge/sound/SoundSystem.java | 19 ++++++++++++------- 11 files changed, 39 insertions(+), 34 deletions(-) diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java index a547ab5c2cf..326734bf455 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java @@ -262,7 +262,7 @@ public enum CSubmenuPreferences implements ICDoc { initializeAutoUpdaterComboBox(); initializeMulliganRuleComboBox(); initializeAiProfilesComboBox(); - initializeSoundProfilesComboBox(); + initializeSoundSetsComboBox(); initializeStackAdditionsComboBox(); initializeLandPlayedComboBox(); initializeColorIdentityCombobox(); @@ -467,10 +467,10 @@ public enum CSubmenuPreferences implements ICDoc { panel.setComboBox(comboBox, selectedItem); } - private void initializeSoundProfilesComboBox() { - final FPref userSetting = FPref.UI_CURRENT_SOUND_PROFILE; - final FComboBoxPanel panel = this.view.getSoundProfilesComboBoxPanel(); - final FComboBox comboBox = createComboBox(SoundSystem.getAvailableSoundProfiles(), userSetting); + private void initializeSoundSetsComboBox() { + final FPref userSetting = FPref.UI_CURRENT_SOUND_SET; + final FComboBoxPanel panel = this.view.getSoundSetsComboBoxPanel(); + final FComboBox comboBox = createComboBox(SoundSystem.getAvailableSoundSets(), userSetting); final String selectedItem = this.prefs.getPref(userSetting); panel.setComboBox(comboBox, selectedItem); } diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java index 2a542284e1c..fdcd35780b7 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java @@ -128,7 +128,7 @@ public enum VSubmenuPreferences implements IVSubmenu { private final FComboBoxPanel cbpCardArtFormat = new FComboBoxPanel<>(localizer.getMessage("cbpCardArtFormat")+":"); private final FComboBoxPanel cbpCardArtPreference = new FComboBoxPanel<>(localizer.getMessage("lblPreferredArt")+":"); private final FComboBoxPanel cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":"); - private final FComboBoxPanel cbpSoundProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpSoundProfiles")+":"); + private final FComboBoxPanel cbpSoundSets = new FComboBoxPanel<>(localizer.getMessage("cbpSoundSets")+":"); private final FComboBoxPanel cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":"); private final FComboBoxPanel cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":"); private final FComboBoxPanel cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":"); @@ -415,8 +415,8 @@ public enum VSubmenuPreferences implements IVSubmenu { pnlPrefs.add(cbEnableSounds, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnableSounds")), descriptionConstraints); - pnlPrefs.add(cbpSoundProfiles, comboBoxConstraints); - pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpSoundProfiles")), descriptionConstraints); + pnlPrefs.add(cbpSoundSets, comboBoxConstraints); + pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpSoundSets")), descriptionConstraints); pnlPrefs.add(cbEnableMusic, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnableMusic")), descriptionConstraints); @@ -744,8 +744,8 @@ public enum VSubmenuPreferences implements IVSubmenu { return cbpMulliganRule; } - public FComboBoxPanel getSoundProfilesComboBoxPanel() { - return cbpSoundProfiles; + public FComboBoxPanel getSoundSetsComboBoxPanel() { + return cbpSoundSets; } public FComboBoxPanel getAiProfilesComboBoxPanel() { diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java index 207f14fcef7..0ee51464882 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java @@ -612,10 +612,10 @@ public class SettingsPage extends TabPage { localizer.getMessage("nlVibrateAfterLongPress")), 6); //Sound Options - lstSettings.addItem(new CustomSelectSetting(FPref.UI_CURRENT_SOUND_PROFILE, - localizer.getMessage("cbpSoundProfiles"), - localizer.getMessage("nlpSoundProfiles"), - SoundSystem.getAvailableSoundProfiles()), + lstSettings.addItem(new CustomSelectSetting(FPref.UI_CURRENT_SOUND_SET, + localizer.getMessage("cbpSoundSets"), + localizer.getMessage("nlpSoundSets"), + SoundSystem.getAvailableSoundSets()), 7); lstSettings.addItem(new CustomSelectSetting(FPref.UI_VOL_SOUNDS, localizer.getMessage("cbAdjustSoundsVolume"), diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index 6f5226c42f3..521024167ed 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -111,7 +111,7 @@ cbpGameLogEntryType=Spielberichtsumfang cbpCloseAction=Beenden cbpDefaultFontSize=Standard Schriftgröße cbpCardArtFormat=Kartenbildformat -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=KI Persönlichkeit cbpStackAdditions=Nachricht bei Stapeländerung cbpDisplayCurrentCardColors=Zeige detaillierte Kartenfarben @@ -142,7 +142,7 @@ nlCompactMainMenu=Aktiviere, um im Seitenmenü platzsparend immer nur eine Menü nlUseSentry=Aktiviere, um automatische Fehlerberichte an die Entwickler zu senden. GamePlay=Spiel nlpMulliganRule=Wähle die Version der Mulligan Regel -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Wähle die Spielweise deines KI-Gegners. nlpStackAdditions=Wähle, wann du über Änderungen am Stapel benachrichtigt werden möchtest: Niemals, immer oder nur für durch andere Spieler ausgelöste Effekte und Fähigkeiten nlAnte=Entscheidet, ob um einen Einsatz (Ante) gespielt wird. diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index a36347c8601..e411e11e178 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -113,7 +113,7 @@ cbpCloseAction=Close Action cbpDefaultFontSize=Default Font Size cbpCardArtFormat=Card Art Format cbpAiProfiles=AI Personality -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpStackAdditions=Stack effect notifications cbpDisplayCurrentCardColors=Show Detailed Card Color cbpAutoYieldMode=Auto-Yield @@ -143,7 +143,7 @@ nlCompactMainMenu=Enable for a space efficient sidebar that displays only one me nlUseSentry=When enabled, automatically submits bug reports to developers. GamePlay=Gameplay nlpMulliganRule=Choose the version of the Mulligan rule -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Choose your AI opponent nlpStackAdditions=Choose when you want to get visual notifications for an effect added to the stack: Never, always, or only for the effects cast/activated by a AI player or triggered by any player nlAnte=Determines whether or not the game is played for ante. diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index b72fc2cf7d0..3219c9a111b 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -112,7 +112,7 @@ cbpGameLogEntryType=Registro del juego cbpCloseAction=Acción al cerrar cbpDefaultFontSize=Tamaño de fuente predeterminado cbpCardArtFormat=Card Art Format -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=Personalidad de la IA cbpStackAdditions=Efecto de la pila de notificaciones cbpDisplayCurrentCardColors=Mostrar color de la carta @@ -143,7 +143,7 @@ nlCompactMainMenu=Habilitar para una barra lateral eficiente en espacio que mues nlUseSentry=Cuando está habilitado, envía automáticamente informes de errores a los desarrolladores. GamePlay=Juego nlpMulliganRule=Elige versión de reglas de mulligan -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Elige tu oponente de la IA nlpStackAdditions=Elige cuándo quieres recibir notificaciones visuales para un efecto añadido a la pila: Nunca, siempre o sólo para los efectos lanzados/activados por un jugador IA o activados por cualquier jugador nlAnte=Determina si el juego se juega con apuesta o no. diff --git a/forge-gui/res/languages/it-IT.properties b/forge-gui/res/languages/it-IT.properties index bbe9422b146..eb05fc1b8ff 100644 --- a/forge-gui/res/languages/it-IT.properties +++ b/forge-gui/res/languages/it-IT.properties @@ -111,7 +111,7 @@ cbpGameLogEntryType=Verbosità del registro di gioco cbpCloseAction=Chiudi cbpDefaultFontSize=Dimensione carattere predefinita cbpCardArtFormat=Formato dell'Illustrazione delle carte -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=Personalità dell''IA cbpStackAdditions=Notifiche degli effetti in pila cbpDisplayCurrentCardColors=Mostra colore scheda dettagliato @@ -142,7 +142,7 @@ nlCompactMainMenu=Abilitare per una barra laterale efficiente in termini di spaz nlUseSentry=Se abilitato, invia automaticamente segnalazioni di bug agli sviluppatori. GamePlay=Gameplay nlpMulliganRule=Scegli il tipo di Mulligan -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Scegli il tuo avversario (IA) nlpStackAdditions=Scegli quando vuoi ricevere una notifica visiva di un effetto aggiunto alla pila: Mai, sempre, o solo per gli effetti lanciati/attivati da un giocatore IA o innescati da un qualsiasi giocatore nlAnte=Determina se l''incontro è giocato o meno con la posta. diff --git a/forge-gui/res/languages/ja-JP.properties b/forge-gui/res/languages/ja-JP.properties index 1709332021a..943836a7f70 100644 --- a/forge-gui/res/languages/ja-JP.properties +++ b/forge-gui/res/languages/ja-JP.properties @@ -112,7 +112,7 @@ cbpGameLogEntryType=ゲームログの詳細レベル cbpCloseAction=閉じる時の動作 cbpDefaultFontSize=デフォルトのフォントサイズ cbpCardArtFormat=カードのアートフォーマット -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=AI の性格 cbpStackAdditions=スタック効果通知 cbpDisplayCurrentCardColors=詳細なカードの色を表示 @@ -143,7 +143,7 @@ nlCompactMainMenu=サイドバーに同時に一つのメニューグループ nlUseSentry=有効にすると、バグレポートが開発者に自動的に送信されます。 GamePlay=ゲーム設定 nlpMulliganRule=マリガンルールを選択する。 -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=対戦相手 AI の性格を選択する。 nlpStackAdditions=スタックに追加された能力の視覚通知をいつ取得するかを選択します:(Never[しない]、Always[常時]、またはAIプレーヤーによってキャスト/起動された能力、または任意のプレーヤーによって誘発された能力に対してのみ nlAnte=ゲームでアンティ(賭け)ルールを適用するか選択する。 diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index bdb471160b7..675871a723a 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -112,7 +112,7 @@ cbpGameLogEntryType=游戏日志详细程度 cbpCloseAction=关闭动作 cbpDefaultFontSize=默认字体大小 cbpCardArtFormat=牌张插画格式 -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=AI强度 cbpStackAdditions=堆叠效应通知 cbpDisplayCurrentCardColors=显示卡牌颜色详情 @@ -143,7 +143,7 @@ nlCompactMainMenu=启用节省空间的侧边栏,一次只显示一个菜单 nlUseSentry=启用后,会自动向开发人员提交错误报告。 GamePlay=游戏 nlpMulliganRule=选择调度规则 -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=选择你的AI对手 nlpStackAdditions=选择何时因效应进入堆叠而提供视觉提醒:从不,总是,任何由AI释放或起动以及由任何玩家触发的效应。 nlAnte=确定游戏是否使用赌注 diff --git a/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java b/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java index 348c1e795c4..354458da64b 100644 --- a/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java +++ b/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java @@ -121,7 +121,7 @@ public class ForgePreferences extends PreferencesStore { UI_VOL_SOUNDS ("100"), UI_VOL_MUSIC ("100"), UI_ALT_SOUND_SYSTEM ("false"), - UI_CURRENT_SOUND_PROFILE ("Default"), + UI_CURRENT_SOUND_SET("Default"), UI_CURRENT_AI_PROFILE ("Default"), UI_CLONE_MODE_SOURCE ("false"), UI_MATCH_IMAGE_VISIBLE ("true"), diff --git a/forge-gui/src/main/java/forge/sound/SoundSystem.java b/forge-gui/src/main/java/forge/sound/SoundSystem.java index ba18121a3ab..f4988021435 100644 --- a/forge-gui/src/main/java/forge/sound/SoundSystem.java +++ b/forge-gui/src/main/java/forge/sound/SoundSystem.java @@ -245,9 +245,9 @@ public class SoundSystem { } } - public static String[] getAvailableSoundProfiles() + public static String[] getAvailableSoundSets() { - final List availableProfiles = new ArrayList<>(); + final List availableSets = new ArrayList<>(); final File dir = new File(ForgeConstants.CACHE_SOUND_DIR); if (dir != null && dir.exists()) { @@ -255,19 +255,24 @@ public class SoundSystem { for (String fileName : files) { String fullPath = ForgeConstants.CACHE_SOUND_DIR + fileName; if (!fileName.equals("Default") && new File(fullPath).isDirectory()) { - availableProfiles.add(fileName); + availableSets.add(fileName); } } } - Collections.sort(availableProfiles); - availableProfiles.add(0, "Default"); + Collections.sort(availableSets); + availableSets.add(0, "Default"); - return availableProfiles.toArray(new String[availableProfiles.size()]); + if (availableSets.size() == 1) { + // Default profile only - ensure that the preference is set accordingly + FModel.getPreferences().setPref(FPref.UI_CURRENT_SOUND_SET, "Default"); + } + + return availableSets.toArray(new String[availableSets.size()]); } public static String getSoundDirectory() { - String profileName = FModel.getPreferences().getPref(FPref.UI_CURRENT_SOUND_PROFILE); + String profileName = FModel.getPreferences().getPref(FPref.UI_CURRENT_SOUND_SET); if (profileName.equals("Default")) { return ForgeConstants.SOUND_DIR; } else { From a4c21c623f0a49bacbc1db15a17ed1e2502d4899 Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 09:39:46 +0300 Subject: [PATCH 5/6] - Fix imports. - Add the sound set announcement and a couple other announcements as well. --- forge-gui-desktop/src/main/java/forge/sound/AudioClip.java | 3 --- forge-gui/release-files/ANNOUNCEMENTS.txt | 6 +++--- forge-gui/src/main/java/forge/sound/EventVisualizer.java | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java b/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java index 7fe6ed340c1..110340b7f7b 100644 --- a/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java +++ b/forge-gui-desktop/src/main/java/forge/sound/AudioClip.java @@ -40,9 +40,6 @@ import javax.sound.sampled.UnsupportedAudioFileException; import com.google.common.io.Files; import com.sipgate.mp3wav.Converter; -import forge.localinstance.properties.ForgeConstants; - - /** * SoundSystem - a simple sound playback system for Forge. * Do not use directly. Instead, use the {@link forge.sound.SoundEffectType} enumeration. diff --git a/forge-gui/release-files/ANNOUNCEMENTS.txt b/forge-gui/release-files/ANNOUNCEMENTS.txt index 1c2ae20dfd8..5c3b0b31366 100644 --- a/forge-gui/release-files/ANNOUNCEMENTS.txt +++ b/forge-gui/release-files/ANNOUNCEMENTS.txt @@ -1,6 +1,6 @@ #Add one announcement per line Get in the discord if you aren't yet. https://discord.gg/3v9JCVr -The Throne of Eldraine quest world is the largest and most meticulously developed quest world to date, combining fascinating fairytales and interesting interactions. If you've never baked a pie into a pie, have you really played Magic? -Innistrad: Midnight Hunt (MID) and Innistrad: Midnight Hunt Commander (MIC) are 100% supported -Various improvements have been made to the desktop and mobile user interface to enhance the experience +Planar Conquest now features a new plane - Forgotten Realms, based on the AFR and AFC sets. +Forge now supports 100% of core and expansion set cards from Limited Edition Alpha to Innistrad: Midnight Hunt. This includes Equinox, Chaos Orb, and Falling Star. +Sound sets are now configurable - you can place your sound sets under "sound" in your Forge cache (as subfolders) and then select them with the "Sound set" option. *** Android 7 & 8 support is now deprecated. Support will be dropped in an upcoming release. *** diff --git a/forge-gui/src/main/java/forge/sound/EventVisualizer.java b/forge-gui/src/main/java/forge/sound/EventVisualizer.java index 3165ce06e7f..6d9730e1593 100644 --- a/forge-gui/src/main/java/forge/sound/EventVisualizer.java +++ b/forge-gui/src/main/java/forge/sound/EventVisualizer.java @@ -39,7 +39,6 @@ import forge.gui.events.IUiEventVisitor; import forge.gui.events.UiEventAttackerDeclared; import forge.gui.events.UiEventBlockerAssigned; import forge.gui.events.UiEventNextGameDecision; -import forge.localinstance.properties.ForgeConstants; import forge.util.TextUtil; import forge.util.maps.MapOfLists; From 778d714ccd54ba0564702fa0a3d7b5a9378582bb Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 12:27:44 +0300 Subject: [PATCH 6/6] - Don't require restart when changing sound sets. --- .../forge/screens/home/settings/CSubmenuPreferences.java | 8 ++++++++ .../src/forge/screens/settings/SettingsPage.java | 8 +++++++- forge-gui/res/languages/de-DE.properties | 2 +- forge-gui/res/languages/en-US.properties | 2 +- forge-gui/res/languages/es-ES.properties | 2 +- forge-gui/res/languages/it-IT.properties | 2 +- forge-gui/res/languages/ja-JP.properties | 2 +- forge-gui/res/languages/zh-CN.properties | 2 +- forge-gui/src/main/java/forge/sound/SoundSystem.java | 5 +++++ 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java index 326734bf455..893a093f37c 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java @@ -27,6 +27,8 @@ import org.apache.commons.lang3.tuple.Pair; import javax.swing.*; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.File; @@ -473,6 +475,12 @@ public enum CSubmenuPreferences implements ICDoc { final FComboBox comboBox = createComboBox(SoundSystem.getAvailableSoundSets(), userSetting); final String selectedItem = this.prefs.getPref(userSetting); panel.setComboBox(comboBox, selectedItem); + comboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + SoundSystem.invalidateSoundCache(); + } + }); } private void initializeCardArtPreference() { diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java index 0ee51464882..f7977786886 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java @@ -615,7 +615,13 @@ public class SettingsPage extends TabPage { lstSettings.addItem(new CustomSelectSetting(FPref.UI_CURRENT_SOUND_SET, localizer.getMessage("cbpSoundSets"), localizer.getMessage("nlpSoundSets"), - SoundSystem.getAvailableSoundSets()), + SoundSystem.getAvailableSoundSets()) { + @Override + public void valueChanged(String newValue) { + super.valueChanged(newValue); + SoundSystem.invalidateSoundCache(); + } + }, 7); lstSettings.addItem(new CustomSelectSetting(FPref.UI_VOL_SOUNDS, localizer.getMessage("cbAdjustSoundsVolume"), diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index 521024167ed..04e44b97f85 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -142,7 +142,7 @@ nlCompactMainMenu=Aktiviere, um im Seitenmenü platzsparend immer nur eine Menü nlUseSentry=Aktiviere, um automatische Fehlerberichte an die Entwickler zu senden. GamePlay=Spiel nlpMulliganRule=Wähle die Version der Mulligan Regel -nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Wähle die Spielweise deines KI-Gegners. nlpStackAdditions=Wähle, wann du über Änderungen am Stapel benachrichtigt werden möchtest: Niemals, immer oder nur für durch andere Spieler ausgelöste Effekte und Fähigkeiten nlAnte=Entscheidet, ob um einen Einsatz (Ante) gespielt wird. diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index e411e11e178..50d4eb03552 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=Enable for a space efficient sidebar that displays only one me nlUseSentry=When enabled, automatically submits bug reports to developers. GamePlay=Gameplay nlpMulliganRule=Choose the version of the Mulligan rule -nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Choose your AI opponent nlpStackAdditions=Choose when you want to get visual notifications for an effect added to the stack: Never, always, or only for the effects cast/activated by a AI player or triggered by any player nlAnte=Determines whether or not the game is played for ante. diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index 3219c9a111b..6660d6da765 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=Habilitar para una barra lateral eficiente en espacio que mues nlUseSentry=Cuando está habilitado, envía automáticamente informes de errores a los desarrolladores. GamePlay=Juego nlpMulliganRule=Elige versión de reglas de mulligan -nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Elige tu oponente de la IA nlpStackAdditions=Elige cuándo quieres recibir notificaciones visuales para un efecto añadido a la pila: Nunca, siempre o sólo para los efectos lanzados/activados por un jugador IA o activados por cualquier jugador nlAnte=Determina si el juego se juega con apuesta o no. diff --git a/forge-gui/res/languages/it-IT.properties b/forge-gui/res/languages/it-IT.properties index eb05fc1b8ff..b2361fa154d 100644 --- a/forge-gui/res/languages/it-IT.properties +++ b/forge-gui/res/languages/it-IT.properties @@ -142,7 +142,7 @@ nlCompactMainMenu=Abilitare per una barra laterale efficiente in termini di spaz nlUseSentry=Se abilitato, invia automaticamente segnalazioni di bug agli sviluppatori. GamePlay=Gameplay nlpMulliganRule=Scegli il tipo di Mulligan -nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=Scegli il tuo avversario (IA) nlpStackAdditions=Scegli quando vuoi ricevere una notifica visiva di un effetto aggiunto alla pila: Mai, sempre, o solo per gli effetti lanciati/attivati da un giocatore IA o innescati da un qualsiasi giocatore nlAnte=Determina se l''incontro è giocato o meno con la posta. diff --git a/forge-gui/res/languages/ja-JP.properties b/forge-gui/res/languages/ja-JP.properties index 943836a7f70..8cf6a18b242 100644 --- a/forge-gui/res/languages/ja-JP.properties +++ b/forge-gui/res/languages/ja-JP.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=サイドバーに同時に一つのメニューグループ nlUseSentry=有効にすると、バグレポートが開発者に自動的に送信されます。 GamePlay=ゲーム設定 nlpMulliganRule=マリガンルールを選択する。 -nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=対戦相手 AI の性格を選択する。 nlpStackAdditions=スタックに追加された能力の視覚通知をいつ取得するかを選択します:(Never[しない]、Always[常時]、またはAIプレーヤーによってキャスト/起動された能力、または任意のプレーヤーによって誘発された能力に対してのみ nlAnte=ゲームでアンティ(賭け)ルールを適用するか選択する。 diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index 675871a723a..304b7d07bd1 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -143,7 +143,7 @@ nlCompactMainMenu=启用节省空间的侧边栏,一次只显示一个菜单 nlUseSentry=启用后,会自动向开发人员提交错误报告。 GamePlay=游戏 nlpMulliganRule=选择调度规则 -nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory nlpAiProfiles=选择你的AI对手 nlpStackAdditions=选择何时因效应进入堆叠而提供视觉提醒:从不,总是,任何由AI释放或起动以及由任何玩家触发的效应。 nlAnte=确定游戏是否使用赌注 diff --git a/forge-gui/src/main/java/forge/sound/SoundSystem.java b/forge-gui/src/main/java/forge/sound/SoundSystem.java index f4988021435..63600ef363d 100644 --- a/forge-gui/src/main/java/forge/sound/SoundSystem.java +++ b/forge-gui/src/main/java/forge/sound/SoundSystem.java @@ -279,4 +279,9 @@ public class SoundSystem { return ForgeConstants.CACHE_SOUND_DIR + profileName + ForgeConstants.PATH_SEPARATOR; } } + + public static void invalidateSoundCache() { + loadedClips.clear(); + loadedScriptClips.clear(); + } }