- Implemented a toggleable option to auto-yield either per ability or per card ("Auto-Yield Mode" under Gameplay).

- Restored the historical Forge default of auto-yielding per ability.
This commit is contained in:
Agetian
2017-02-01 17:32:02 +00:00
parent 10736e1e24
commit 10f76eae82
7 changed files with 44 additions and 6 deletions

View File

@@ -117,7 +117,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbManaLostPrompt(), FPref.UI_MANA_LOST_PROMPT));
lstControls.add(Pair.of(view.getCbEscapeEndsTurn(), FPref.UI_ALLOW_ESC_TO_END_TURN));
lstControls.add(Pair.of(view.getCbDetailedPaymentDesc(), FPref.UI_DETAILED_SPELLDESC_IN_PROMPT));
lstControls.add(Pair.of(view.getcbPreselectPrevAbOrder(), FPref.UI_PRESELECT_PREVIOUS_ABILITY_ORDER));
lstControls.add(Pair.of(view.getCbPreselectPrevAbOrder(), FPref.UI_PRESELECT_PREVIOUS_ABILITY_ORDER));
lstControls.add(Pair.of(view.getCbFilterLandsByColorId(), FPref.UI_FILTER_LANDS_BY_COLOR_IDENTITY));
@@ -181,6 +181,7 @@ public enum CSubmenuPreferences implements ICDoc {
initializeCloseActionComboBox();
initializeAiProfilesComboBox();
initializeColorIdentityCombobox();
initializeAutoYieldModeComboBox();
initializePlayerNameButton();
}
@@ -318,6 +319,14 @@ public enum CSubmenuPreferences implements ICDoc {
panel.setComboBox(comboBox, selectedItem);
}
private void initializeAutoYieldModeComboBox() {
final String[] elems = {ForgeConstants.AUTO_YIELD_PER_ABILITY, ForgeConstants.AUTO_YIELD_PER_CARD};
final FPref userSetting = FPref.UI_AUTO_YIELD_MODE;
final FComboBoxPanel<String> panel = this.view.getAutoYieldModeComboBoxPanel();
final FComboBox<String> comboBox = createComboBox(elems, userSetting);
final String selectedItem = this.prefs.getPref(userSetting);
panel.setComboBox(comboBox, selectedItem);
}
private <E> FComboBox<E> createComboBox(final E[] items, final ForgePreferences.FPref setting) {
final FComboBox<E> comboBox = new FComboBox<>(items);
addComboBoxListener(comboBox, setting);

View File

@@ -97,6 +97,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final FComboBoxPanel<CloseAction> cbpCloseAction = new FComboBoxPanel<>("Close Action:");
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>("AI Personality:");
private final FComboBoxPanel<String> cbpDisplayCurrentCardColors = new FComboBoxPanel<>("Show Detailed Card Color:");
private final FComboBoxPanel<String> cbpAutoYieldMode = new FComboBoxPanel<>("Auto-Yield Mode:");
/**
* Constructor.
@@ -175,6 +176,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbPreselectPrevAbOrder, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, preselects the last defined simultaneous ability order in the ordering dialog."), regularConstraints);
pnlPrefs.add(cbpAutoYieldMode, regularConstraints);
pnlPrefs.add(new NoteLabel("Defines the granularity level of auto-yields (yield to each unique ability or to each unique card)."), regularConstraints);
// Deck building options
pnlPrefs.add(new SectionLabel("Random Deck Generation"), sectionConstraints);
@@ -552,6 +556,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbpCloseAction;
}
public FComboBoxPanel<String> getAutoYieldModeComboBoxPanel() {
return cbpAutoYieldMode;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbEnforceDeckLegality() {
return cbEnforceDeckLegality;
@@ -627,7 +635,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbDetailedPaymentDesc;
}
public final JCheckBox getcbPreselectPrevAbOrder() {
public final JCheckBox getCbPreselectPrevAbOrder() {
return cbPreselectPrevAbOrder;
}