mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
AI Sideboarding Mode toggle as a Preferences option (#5136)
* - Initial commit for the AI sideboarding mode toggle. * - Tweak the parameter value to correspond to the enum. * - Consistency.
This commit is contained in:
@@ -21,7 +21,10 @@ import forge.screens.deckeditor.CDeckEditorUI;
|
||||
import forge.screens.deckeditor.controllers.CEditorTokenViewer;
|
||||
import forge.sound.MusicPlaylist;
|
||||
import forge.sound.SoundSystem;
|
||||
import forge.toolbox.*;
|
||||
import forge.toolbox.FComboBox;
|
||||
import forge.toolbox.FComboBoxPanel;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.util.Localizer;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -123,8 +126,6 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
lstControls.add(Pair.of(view.getCbRandomArtInPools(), FPref.UI_RANDOM_ART_IN_POOLS));
|
||||
lstControls.add(Pair.of(view.getCbEnforceDeckLegality(), FPref.ENFORCE_DECK_LEGALITY));
|
||||
lstControls.add(Pair.of(view.getCbPerformanceMode(), FPref.PERFORMANCE_MODE));
|
||||
lstControls.add(Pair.of(view.getCbSideboardForAI(), FPref.MATCH_SIDEBOARD_FOR_AI));
|
||||
lstControls.add(Pair.of(view.getCbExperimentalRestore(), FPref.MATCH_EXPERIMENTAL_RESTORE));
|
||||
lstControls.add(Pair.of(view.getCbFilteredHands(), FPref.FILTERED_HANDS));
|
||||
lstControls.add(Pair.of(view.getCbCloneImgSource(), FPref.UI_CLONE_MODE_SOURCE));
|
||||
lstControls.add(Pair.of(view.getCbRemoveSmall(), FPref.DECKGEN_NOSMALL));
|
||||
@@ -267,6 +268,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
initializeAutoUpdaterComboBox();
|
||||
initializeMulliganRuleComboBox();
|
||||
initializeAiProfilesComboBox();
|
||||
initializeAiSideboardingModeComboBox();
|
||||
initializeSoundSetsComboBox();
|
||||
initializeMusicSetsComboBox();
|
||||
initializeStackAdditionsComboBox();
|
||||
@@ -474,6 +476,21 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
panel.setComboBox(comboBox, selectedItem);
|
||||
}
|
||||
|
||||
private void initializeAiSideboardingModeComboBox() {
|
||||
final FPref userSetting = FPref.MATCH_AI_SIDEBOARDING_MODE;
|
||||
final FComboBoxPanel<String> panel = this.view.getAiSideboardingModeComboBoxPanel();
|
||||
final FComboBox<String> comboBox = createComboBox(new String[] {"Off", "AI", "Human For AI"}, userSetting);
|
||||
final String selectedItem = this.prefs.getPref(userSetting);
|
||||
panel.setComboBox(comboBox, selectedItem);
|
||||
comboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
AiProfileUtil.setAiSideboardingMode(AiProfileUtil.AISideboardingMode.normalizedValueOf(comboBox.getSelectedItem()));
|
||||
System.out.println(AiProfileUtil.getAISideboardingMode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initializeSoundSetsComboBox() {
|
||||
final FPref userSetting = FPref.UI_CURRENT_SOUND_SET;
|
||||
final FComboBoxPanel<String> panel = this.view.getSoundSetsComboBoxPanel();
|
||||
|
||||
@@ -75,7 +75,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbLoadArchivedFormats = new OptionsCheckBox(localizer.getMessage("cbLoadArchivedFormats"));
|
||||
private final JCheckBox cbWorkshopSyntax = new OptionsCheckBox(localizer.getMessage("cbWorkshopSyntax"));
|
||||
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox(localizer.getMessage("cbEnforceDeckLegality"));
|
||||
private final JCheckBox cbSideboardForAI = new OptionsCheckBox(localizer.getMessage("cbSideboardForAI"));
|
||||
private final JCheckBox cbExperimentalRestore = new OptionsCheckBox(localizer.getMessage("cbExperimentalRestore"));
|
||||
private final JCheckBox cbPerformanceMode = new OptionsCheckBox(localizer.getMessage("cbPerformanceMode"));
|
||||
private final JCheckBox cbSROptimize = new OptionsCheckBox(localizer.getMessage("cbSROptimize"));
|
||||
@@ -133,6 +132,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final FComboBoxPanel<String> cbpSoundSets = new FComboBoxPanel<>(localizer.getMessage("cbpSoundSets")+":");
|
||||
private final FComboBoxPanel<String> cbpMusicSets = new FComboBoxPanel<>(localizer.getMessage("cbpMusicSets")+":");
|
||||
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":");
|
||||
private final FComboBoxPanel<String> cbpAiSideboardingMode = new FComboBoxPanel<>(localizer.getMessage("cbpAiSideboardingMode")+":");
|
||||
private final FComboBoxPanel<String> cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":");
|
||||
private final FComboBoxPanel<String> cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":");
|
||||
private final FComboBoxPanel<String> cbpDisplayCurrentCardColors = new FComboBoxPanel<>(localizer.getMessage("cbpDisplayCurrentCardColors")+":");
|
||||
@@ -231,8 +231,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbPerformanceMode, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlPerformanceMode")), descriptionConstraints);
|
||||
|
||||
pnlPrefs.add(cbSideboardForAI, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlSideboardForAI")), descriptionConstraints);
|
||||
pnlPrefs.add(cbpAiSideboardingMode, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpAiSideboardingMode")), descriptionConstraints);
|
||||
|
||||
pnlPrefs.add(cbExperimentalRestore, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlExperimentalRestore")), descriptionConstraints);
|
||||
@@ -769,6 +769,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
return cbpAiProfiles;
|
||||
}
|
||||
|
||||
public FComboBoxPanel<String> getAiSideboardingModeComboBoxPanel() {
|
||||
return cbpAiSideboardingMode;
|
||||
}
|
||||
|
||||
public FComboBoxPanel<String> getCbpStackAdditionsComboBoxPanel() {
|
||||
return cbpStackAdditions;
|
||||
}
|
||||
@@ -841,10 +845,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
return cbPerformanceMode;
|
||||
}
|
||||
|
||||
public JCheckBox getCbSideboardForAI() {
|
||||
return cbSideboardForAI;
|
||||
}
|
||||
|
||||
public JCheckBox getCbExperimentalRestore() {
|
||||
return cbExperimentalRestore;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user