From 1c55a00304ab0e458cffb7b09d7b9d90769b5946 Mon Sep 17 00:00:00 2001 From: Agetian Date: Mon, 8 Jun 2015 11:30:41 +0000 Subject: [PATCH] - Renamed the "Display Color Identity" option to "Display Current Color Info" (to avoid confusion because color identity is actually not the same as the sum of current colors of the card, e.g. a Forest should has a green identity because it produces green mane but it's a colorless card nonetheless). Internal functions and variables related to this code is also renamed accordingly to avoid confusion. --- .../home/settings/CSubmenuPreferences.java | 8 +-- .../home/settings/VSubmenuPreferences.java | 8 +-- .../forge/screens/settings/SettingsPage.java | 12 ++-- .../main/java/forge/card/CardDetailUtil.java | 64 +++++++++---------- .../java/forge/properties/ForgeConstants.java | 10 +-- .../forge/properties/ForgePreferences.java | 2 +- 6 files changed, 52 insertions(+), 52 deletions(-) diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java index 05d154fd107..1716bb5177b 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java @@ -300,10 +300,10 @@ public enum CSubmenuPreferences implements ICDoc { } private void initializeColorIdentityCombobox() { - final String[] elems = {ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_CHANGED, - ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED, - ForgeConstants.DISP_COLOR_IDENT_ALWAYS}; - final FPref userSetting = FPref.UI_DISPLAY_COLOR_IDENTITY; + 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_ALWAYS}; + final FPref userSetting = FPref.UI_DISPLAY_CURRENT_COLORS; final FComboBoxPanel panel = this.view.getDisplayColorIdentity(); final FComboBox comboBox = createComboBox(elems, userSetting); final String selectedItem = this.prefs.getPref(userSetting); diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java index f88e1424215..ae413f159e4 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java @@ -89,7 +89,7 @@ public enum VSubmenuPreferences implements IVSubmenu { private final FComboBoxPanel cbpGameLogEntryType = new FComboBoxPanel<>("Game Log Verbosity:"); private final FComboBoxPanel cbpCloseAction = new FComboBoxPanel<>("Close Action:"); private final FComboBoxPanel cbpAiProfiles = new FComboBoxPanel<>("AI Personality:"); - private final FComboBoxPanel cbpDisplayColorIdentity = new FComboBoxPanel<>("Display Color Identity:"); + private final FComboBoxPanel cbpDisplayCurrentCardColors = new FComboBoxPanel<>("Display Card Color Info:"); /** * Constructor. @@ -225,8 +225,8 @@ public enum VSubmenuPreferences implements IVSubmenu { pnlPrefs.add(cbStackCreatures, regularConstraints); pnlPrefs.add(new NoteLabel("Stacks identical creatures on the battlefield like lands, artifacts, and enchantments."), regularConstraints); - pnlPrefs.add(cbpDisplayColorIdentity, "w 80%!, gap 10% 0 0 10px, span 2 1"); - pnlPrefs.add(new NoteLabel("Displays the color identity of cards in the card detail information panel."), regularConstraints); + pnlPrefs.add(cbpDisplayCurrentCardColors, "w 80%!, gap 10% 0 0 10px, span 2 1"); + pnlPrefs.add(new NoteLabel("Displays the current color of cards in the card detail information panel."), regularConstraints); // Sound options pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints + ", gaptop 2%"); @@ -499,7 +499,7 @@ public enum VSubmenuPreferences implements IVSubmenu { } public FComboBoxPanel getDisplayColorIdentity() { - return cbpDisplayColorIdentity; + return cbpDisplayCurrentCardColors; } public FComboBoxPanel getCloseActionComboBoxPanel() { diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java index 957ab39c479..1fd883e2785 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java @@ -163,13 +163,13 @@ public class SettingsPage extends TabPage { "Show Match Background", "Show match background image on battlefield, otherwise background texture shown instead."), 4); - lstSettings.addItem(new CustomSelectSetting(FPref.UI_DISPLAY_COLOR_IDENTITY, - "Display Color Identity", - "Displays the color identity of cards in the card detail information panel.", + lstSettings.addItem(new CustomSelectSetting(FPref.UI_DISPLAY_CURRENT_COLORS, + "Display Card Color Info", + "Displays the current color of cards in the card detail information panel.", new String[]{ - ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, - ForgeConstants.DISP_COLOR_IDENT_CHANGED, ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED, - ForgeConstants.DISP_COLOR_IDENT_ALWAYS}), + ForgeConstants.DISP_CURRENT_COLORS_NEVER, ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR, + ForgeConstants.DISP_CURRENT_COLORS_CHANGED, ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED, + ForgeConstants.DISP_CURRENT_COLORS_ALWAYS}), 4); //Card Overlays diff --git a/forge-gui/src/main/java/forge/card/CardDetailUtil.java b/forge-gui/src/main/java/forge/card/CardDetailUtil.java index 6448b58dd60..7d912617a78 100644 --- a/forge-gui/src/main/java/forge/card/CardDetailUtil.java +++ b/forge-gui/src/main/java/forge/card/CardDetailUtil.java @@ -158,21 +158,21 @@ public class CardDetailUtil { return borderColors; } - public static String getColorIdentity(final CardStateView c) { - ColorSet identity = c.getColors(); - String strIdentity = ""; + public static String getCurrentColors(final CardStateView c) { + ColorSet curColors = c.getColors(); + String strCurColors = ""; - if (identity.hasWhite()) { strIdentity += "{W}"; } - if (identity.hasBlue()) { strIdentity += "{U}"; } - if (identity.hasBlack()) { strIdentity += "{B}"; } - if (identity.hasRed()) { strIdentity += "{R}"; } - if (identity.hasGreen()) { strIdentity += "{G}"; } + if (curColors.hasWhite()) { strCurColors += "{W}"; } + if (curColors.hasBlue()) { strCurColors += "{U}"; } + if (curColors.hasBlack()) { strCurColors += "{B}"; } + if (curColors.hasRed()) { strCurColors += "{R}"; } + if (curColors.hasGreen()) { strCurColors += "{G}"; } - if (strIdentity.isEmpty()) { - strIdentity = "colorless"; + if (strCurColors.isEmpty()) { + strCurColors = "colorless"; } - return strIdentity; + return strCurColors; } public static DetailColors getRarityColor(final CardRarity rarity) { @@ -237,24 +237,24 @@ public class CardDetailUtil { return id.isEmpty() ? id : "[" + id + "]"; } - public static String formatCardColorIdentity(final CardStateView state) { - final String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY); - boolean showIdentity = false; - String colorIdent = ""; + public static String formatCurrentCardColors(final CardStateView state) { + final String showCurColorMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_CURRENT_COLORS); + boolean showCurColors = false; + String curColors = ""; - // do not show identity for temp effect cards, emblems and the like + // do not show current colors for temp effect cards, emblems and the like if (state.getType().hasSubtype("Effect")) { return ""; } - if (!colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_NEVER)) { + if (!showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_NEVER)) { final CardView card = state.getCard(); boolean isMulticolor = state.getColors().countColors() > 1; boolean isChanged = false; - colorIdent = getColorIdentity(state); + curColors = getCurrentColors(state); // do not waste CPU cycles on this if the mode does not involve checking for changed color identity - if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED) || colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED)) { + if (showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_CHANGED) || showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED)) { String origIdent = ""; PaperCard origPaperCard = null; Card origCard = null; @@ -271,22 +271,22 @@ public class CardDetailUtil { if (origPaperCard != null) { origCard = Card.getCardForUi(origPaperCard); // if null, probably a variant card } - origIdent = origCard != null ? getColorIdentity(CardView.get(origCard).getCurrentState()) : ""; + origIdent = origCard != null ? getCurrentColors(CardView.get(origCard).getCurrentState()) : ""; } catch(Exception ex) { System.err.println("Unexpected behavior: card " + card.getName() + "[" + card.getId() + "] tripped an exception when trying to process color identity."); } - isChanged = !colorIdent.equals(origIdent); + isChanged = !curColors.equals(origIdent); } - if ((colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR) && isMulticolor) || - (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED) && isChanged) || - (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED) && (isChanged || isMulticolor)) || - (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_ALWAYS))) { - showIdentity = true; + if ((showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR) && isMulticolor) || + (showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_CHANGED) && isChanged) || + (showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED) && (isChanged || isMulticolor)) || + (showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_ALWAYS))) { + showCurColors = true; } } - return showIdentity ? colorIdent : ""; + return showCurColors ? curColors : ""; } public static String composeCardText(final CardStateView state, final GameView gameView, final boolean canShow) { @@ -566,14 +566,14 @@ public class CardDetailUtil { area.append("Must block " + mustBlockThese); } - //show card color identity if enabled - String colorIdent = formatCardColorIdentity(state); - if (!colorIdent.isEmpty()) { + //show current card colors if enabled + String curCardColors = formatCurrentCardColors(state); + if (!curCardColors.isEmpty()) { if (area.length() != 0) { area.append("\n\n"); } - area.append("Color identity: "); - area.append(colorIdent); + area.append("Current Card Colors: "); + area.append(curCardColors); } //show current storm count for storm cards diff --git a/forge-gui/src/main/java/forge/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/properties/ForgeConstants.java index 08fb5b86b26..a31037822d0 100644 --- a/forge-gui/src/main/java/forge/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/properties/ForgeConstants.java @@ -179,10 +179,10 @@ public final class ForgeConstants { public static final String URL_PRICE_DOWNLOAD = "http://www.cardforge.org/MagicInfo/pricegen.php"; // Constants for Display Card Identity game setting - public static final String DISP_COLOR_IDENT_ALWAYS = "Always"; - public static final String DISP_COLOR_IDENT_CHANGED = "Changed"; - public static final String DISP_COLOR_IDENT_MULTICOLOR = "Multicolor"; - public static final String DISP_COLOR_IDENT_MULTI_OR_CHANGED = "Multi+Changed"; - public static final String DISP_COLOR_IDENT_NEVER = "Never"; + public static final String DISP_CURRENT_COLORS_ALWAYS = "Always"; + public static final String DISP_CURRENT_COLORS_CHANGED = "Changed"; + public static final String DISP_CURRENT_COLORS_MULTICOLOR = "Multicolor"; + public static final String DISP_CURRENT_COLORS_MULTI_OR_CHANGED = "Multi+Changed"; + public static final String DISP_CURRENT_COLORS_NEVER = "Never"; } diff --git a/forge-gui/src/main/java/forge/properties/ForgePreferences.java b/forge-gui/src/main/java/forge/properties/ForgePreferences.java index c742d6103ec..5451051b363 100644 --- a/forge-gui/src/main/java/forge/properties/ForgePreferences.java +++ b/forge-gui/src/main/java/forge/properties/ForgePreferences.java @@ -78,7 +78,7 @@ public class ForgePreferences extends PreferencesStore { UI_MANA_LOST_PROMPT ("false"), // Prompt on losing mana when passing priority UI_PAUSE_WHILE_MINIMIZED("false"), UI_TOKENS_IN_SEPARATE_ROW("false"), // Display tokens in their own battlefield row. - UI_DISPLAY_COLOR_IDENTITY("Never"), + UI_DISPLAY_CURRENT_COLORS("Never"), UI_FOR_TOUCHSCREN("false"),