mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Initial implementation of sound profiles, part 1.
This commit is contained in:
@@ -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<String> panel = this.view.getSoundProfilesComboBoxPanel();
|
||||
final FComboBox<String> 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");
|
||||
|
||||
@@ -128,6 +128,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final FComboBoxPanel<String> cbpCardArtFormat = new FComboBoxPanel<>(localizer.getMessage("cbpCardArtFormat")+":");
|
||||
private final FComboBoxPanel<String> cbpCardArtPreference = new FComboBoxPanel<>(localizer.getMessage("lblPreferredArt")+":");
|
||||
private final FComboBoxPanel<String> cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":");
|
||||
private final FComboBoxPanel<String> cbpSoundProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpSoundProfiles")+":");
|
||||
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":");
|
||||
private final FComboBoxPanel<String> cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":");
|
||||
private final FComboBoxPanel<String> cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":");
|
||||
@@ -414,6 +415,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
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<CSubmenuPreferences> {
|
||||
return cbpMulliganRule;
|
||||
}
|
||||
|
||||
public FComboBoxPanel<String> getSoundProfilesComboBoxPanel() {
|
||||
return cbpSoundProfiles;
|
||||
}
|
||||
|
||||
public FComboBoxPanel<String> getAiProfilesComboBoxPanel() {
|
||||
return cbpAiProfiles;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -112,6 +112,7 @@ cbpGameLogEntryType=ゲームログの詳細レベル
|
||||
cbpCloseAction=閉じる時の動作
|
||||
cbpDefaultFontSize=デフォルトのフォントサイズ
|
||||
cbpCardArtFormat=カードのアートフォーマット
|
||||
cbpSoundProfiles=Sound Profile
|
||||
cbpAiProfiles=AI の性格
|
||||
cbpStackAdditions=スタック効果通知
|
||||
cbpDisplayCurrentCardColors=詳細なカードの色を表示
|
||||
|
||||
@@ -112,6 +112,7 @@ cbpGameLogEntryType=游戏日志详细程度
|
||||
cbpCloseAction=关闭动作
|
||||
cbpDefaultFontSize=默认字体大小
|
||||
cbpCardArtFormat=牌张插画格式
|
||||
cbpSoundProfiles=Sound Profile
|
||||
cbpAiProfiles=AI强度
|
||||
cbpStackAdditions=堆叠效应通知
|
||||
cbpDisplayCurrentCardColors=显示卡牌颜色详情
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -121,6 +121,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
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"),
|
||||
|
||||
@@ -331,7 +331,7 @@ public class EventVisualizer extends IGameEventVisitor.Base<SoundEffectType> imp
|
||||
}
|
||||
|
||||
// Only proceed if the file actually exists
|
||||
return new File(ForgeConstants.SOUND_DIR, effect).exists();
|
||||
return new File(SoundSystem.getSoundDirectory(), effect).exists();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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<String> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user