From 5aa25f7ad0a53e85332b9c189f6dc5069f965dba Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 09:01:53 +0300 Subject: [PATCH] - 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()]); }