Introduced a preference to turn the panel on/off.

This commit is contained in:
Alessandro Coli
2020-09-19 13:39:22 +02:00
parent 4975c6a0c3
commit 8d24a2a6ff
6 changed files with 64 additions and 33 deletions

View File

@@ -246,6 +246,7 @@ public enum CSubmenuPreferences implements ICDoc {
initializeMulliganRuleComboBox(); initializeMulliganRuleComboBox();
initializeAiProfilesComboBox(); initializeAiProfilesComboBox();
initializeStackAdditionsComboBox(); initializeStackAdditionsComboBox();
initializeLandPlayedComboBox();
initializeColorIdentityCombobox(); initializeColorIdentityCombobox();
initializeAutoYieldModeComboBox(); initializeAutoYieldModeComboBox();
initializeCounterDisplayTypeComboBox(); initializeCounterDisplayTypeComboBox();
@@ -448,6 +449,16 @@ public enum CSubmenuPreferences implements ICDoc {
panel.setComboBox(comboBox, selectedItem); panel.setComboBox(comboBox, selectedItem);
} }
private void initializeLandPlayedComboBox() {
final String[] elems = {ForgeConstants.LAND_PLAYED_NOTIFICATION_NEVER, ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS,
ForgeConstants.LAND_PLAYED_NOTIFICATION_AI};
final FPref userSetting = FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY;
final FComboBoxPanel<String> panel = this.view.getCbpLandPlayedComboBoxPanel();
final FComboBox<String> comboBox = createComboBox(elems, userSetting);
final String selectedItem = this.prefs.getPref(userSetting);
panel.setComboBox(comboBox, selectedItem);
}
private void initializeColorIdentityCombobox() { private void initializeColorIdentityCombobox() {
final String[] elems = {ForgeConstants.DISP_CURRENT_COLORS_NEVER, ForgeConstants.DISP_CURRENT_COLORS_CHANGED, final String[] elems = {ForgeConstants.DISP_CURRENT_COLORS_NEVER, ForgeConstants.DISP_CURRENT_COLORS_CHANGED,
ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR, ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED, ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR, ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED,

View File

@@ -120,6 +120,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final FComboBoxPanel<String> cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":"); private final FComboBoxPanel<String> cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":");
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":"); private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":");
private final FComboBoxPanel<String> cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":"); 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")+":"); private final FComboBoxPanel<String> cbpDisplayCurrentCardColors = new FComboBoxPanel<>(localizer.getMessage("cbpDisplayCurrentCardColors")+":");
private final FComboBoxPanel<String> cbpAutoYieldMode = new FComboBoxPanel<>(localizer.getMessage("cbpAutoYieldMode")+":"); private final FComboBoxPanel<String> cbpAutoYieldMode = new FComboBoxPanel<>(localizer.getMessage("cbpAutoYieldMode")+":");
private final FComboBoxPanel<String> cbpCounterDisplayType = new FComboBoxPanel<>(localizer.getMessage("cbpCounterDisplayType")+":"); private final FComboBoxPanel<String> cbpCounterDisplayType = new FComboBoxPanel<>(localizer.getMessage("cbpCounterDisplayType")+":");
@@ -206,6 +207,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbpStackAdditions, comboBoxConstraints); pnlPrefs.add(cbpStackAdditions, comboBoxConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpStackAdditions")), descriptionConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpStackAdditions")), descriptionConstraints);
pnlPrefs.add(cbpLandPlayed, comboBoxConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpLandPlayed")), descriptionConstraints);
pnlPrefs.add(cbEnforceDeckLegality, titleConstraints); pnlPrefs.add(cbEnforceDeckLegality, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnforceDeckLegality")), descriptionConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnforceDeckLegality")), descriptionConstraints);
@@ -685,6 +689,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbpStackAdditions; return cbpStackAdditions;
} }
public FComboBoxPanel<String> getCbpLandPlayedComboBoxPanel() {
return cbpLandPlayed;
}
public FComboBoxPanel<GameLogEntryType> getGameLogVerbosityComboBoxPanel() { public FComboBoxPanel<GameLogEntryType> getGameLogVerbosityComboBoxPanel() {
return cbpGameLogEntryType; return cbpGameLogEntryType;
} }

View File

@@ -1450,6 +1450,11 @@ public final class CMatchUI
} }
private void createLandPopupPanel(Card land, Zone zone) { private void createLandPopupPanel(Card land, Zone zone) {
String landPlayedNotificationPolicy = FModel.getPreferences().getPref(FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY);
Player cardController = land.getController();
boolean isAi = cardController.isAI();
if(ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS.equals(landPlayedNotificationPolicy) || (ForgeConstants.LAND_PLAYED_NOTIFICATION_AI.equals(landPlayedNotificationPolicy) && (isAi))) {
String title = "Forge"; String title = "Forge";
List<String> options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK")); List<String> options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK"));
@@ -1472,7 +1477,6 @@ public final class CMatchUI
mainPanel.add(imagePanel, "cell 0 0, spany 3"); mainPanel.add(imagePanel, "cell 0 0, spany 3");
Player cardController = land.getController();
String msg = cardController.toString() + " puts " + land.toString() + " into play into " + zone.toString() + "."; String msg = cardController.toString() + " puts " + land.toString() + " into play into " + zone.toString() + ".";
final FTextArea prompt1 = new FTextArea(msg); final FTextArea prompt1 = new FTextArea(msg);
@@ -1481,7 +1485,7 @@ public final class CMatchUI
prompt1.setMinimumSize(new Dimension(475,200)); prompt1.setMinimumSize(new Dimension(475,200));
mainPanel.add(prompt1, "cell 1 0, aligny top"); mainPanel.add(prompt1, "cell 1 0, aligny top");
FOptionPane.showOptionDialog(null, title, null, mainPanel, options); FOptionPane.showOptionDialog(null, title, null, mainPanel, options);
} }
}
} }

View File

@@ -2584,3 +2584,5 @@ lblEnterMessageToSend=Enter message to send
lblDetectedInvalidHostAddress=Invalid host address ({0}) was detected. lblDetectedInvalidHostAddress=Invalid host address ({0}) was detected.
#Player.java #Player.java
lblChooseACompanion=Choose a companion lblChooseACompanion=Choose a companion
cbpLandPlayed=Land entering battlefield notifications
nlpLandPlayed=Choose when you want to get visual notifications for a land entering the battlefield: Never, always, or only for the lands entering a battlefield because of an action of a AI player

View File

@@ -322,6 +322,11 @@ public final class ForgeConstants {
public static final String STACK_EFFECT_NOTIFICATION_ALWAYS = "Always"; public static final String STACK_EFFECT_NOTIFICATION_ALWAYS = "Always";
public static final String STACK_EFFECT_NOTIFICATION_AI_AND_TRIGGERED = "AI cast/activated, or triggered by any player"; public static final String STACK_EFFECT_NOTIFICATION_AI_AND_TRIGGERED = "AI cast/activated, or triggered by any player";
// Constants for LAnd played notification policy
public static final String LAND_PLAYED_NOTIFICATION_NEVER = "Never";
public static final String LAND_PLAYED_NOTIFICATION_ALWAYS = "Always";
public static final String LAND_PLAYED_NOTIFICATION_AI = "Lands entering a battlefield because of an action of a AI player";
// Set boolean constant for landscape mode for gdx port // Set boolean constant for landscape mode for gdx port
public static final boolean isGdxPortLandscape = FileUtil.doesFileExist(ASSETS_DIR + "switch_orientation.ini"); public static final boolean isGdxPortLandscape = FileUtil.doesFileExist(ASSETS_DIR + "switch_orientation.ini");

View File

@@ -121,6 +121,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_CLOSE_ACTION ("NONE"), UI_CLOSE_ACTION ("NONE"),
UI_MANA_LOST_PROMPT ("false"), // Prompt on losing mana when passing priority UI_MANA_LOST_PROMPT ("false"), // Prompt on losing mana when passing priority
UI_STACK_EFFECT_NOTIFICATION_POLICY ("Never"), UI_STACK_EFFECT_NOTIFICATION_POLICY ("Never"),
UI_LAND_PLAYED_NOTIFICATION_POLICY ("Never"),
UI_PAUSE_WHILE_MINIMIZED("false"), UI_PAUSE_WHILE_MINIMIZED("false"),
UI_TOKENS_IN_SEPARATE_ROW("false"), // Display tokens in their own battlefield row. UI_TOKENS_IN_SEPARATE_ROW("false"), // Display tokens in their own battlefield row.
UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER), UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER),