- Added an option to display color identity of cards in the card detail panel (details in CHANGES.txt).

This commit is contained in:
Agetian
2015-06-01 20:04:38 +00:00
parent df213262ec
commit 21323a4f72
6 changed files with 64 additions and 0 deletions

View File

@@ -172,6 +172,7 @@ public enum CSubmenuPreferences implements ICDoc {
initializeGameLogVerbosityComboBox();
initializeCloseActionComboBox();
initializeAiProfilesComboBox();
initializeColorIdentityCombobox();
initializePlayerNameButton();
}
@@ -298,6 +299,15 @@ public enum CSubmenuPreferences implements ICDoc {
panel.setComboBox(comboBox, selectedItem);
}
private void initializeColorIdentityCombobox() {
final String[] elems = {"Never", "Only Multicolor", "Always"};
final FPref userSetting = FPref.UI_DISPLAY_COLOR_IDENTITY;
final FComboBoxPanel<String> panel = this.view.getDisplayColorIdentity();
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

@@ -89,6 +89,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final FComboBoxPanel<GameLogEntryType> cbpGameLogEntryType = new FComboBoxPanel<>("Game Log Verbosity:");
private final FComboBoxPanel<CloseAction> cbpCloseAction = new FComboBoxPanel<>("Close Action:");
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>("AI Personality:");
private final FComboBoxPanel<String> cbpDisplayColorIdentity = new FComboBoxPanel<>("Display Color Identity:");
/**
* Constructor.
@@ -224,6 +225,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
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);
// Sound options
pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints + ", gaptop 2%");
@@ -494,6 +498,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbpGameLogEntryType;
}
public FComboBoxPanel<String> getDisplayColorIdentity() {
return cbpDisplayColorIdentity;
}
public FComboBoxPanel<CloseAction> getCloseActionComboBoxPanel() {
return cbpCloseAction;
}

View File

@@ -162,6 +162,11 @@ public class SettingsPage extends TabPage<SettingsScreen> {
"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.",
new String[]{"Never", "Only Multicolor", "Always"}),
4);
//Card Overlays
lstSettings.addItem(new BooleanSetting(FPref.UI_SHOW_CARD_OVERLAYS,

View File

@@ -31,6 +31,17 @@ The interface has received several small changes.
The command zone panels have been removed.
- Display Color Identity -
There's a new option "Display Color Identity" in both desktop and mobile Forge
that allows you to display the current color identity of cards. It's disabled
by default (set to "Never") but can be toggled to "Always" (which displays color
identity for all cards, even mono-color) or to "Only Multicolor" (which only
displays color identity of cards that are currently of two or more colors). This
might help with effects such as Painter's Servant which add colors to cards and
which make all cards display with the gold border. The option is currently found
under "Graphic Options" for both versions of Forge.
- Display tokens on the same row as other cards / on their own row -
By default the game now displays tokens on the same row as non-token cards (and
to the right of them), which makes the game use the battlefield space more

View File

@@ -18,6 +18,8 @@ import forge.game.card.CounterType;
import forge.item.InventoryItemFromSet;
import forge.item.PreconDeck;
import forge.item.SealedProduct;
import forge.model.FModel;
import forge.properties.ForgePreferences;
import forge.util.Lang;
public class CardDetailUtil {
@@ -153,6 +155,19 @@ public class CardDetailUtil {
return borderColors;
}
public static String getColorIdentity(final CardStateView c) {
ColorSet identity = c.getColors();
String strIdentity = "";
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}"; }
return strIdentity;
}
public static DetailColors getRarityColor(final CardRarity rarity) {
switch (rarity) {
case Uncommon:
@@ -492,6 +507,20 @@ public class CardDetailUtil {
area.append("Must block " + mustBlockThese);
}
//show card color identity if enabled
String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY);
if (!colorIdentMode.equals("Never")) {
final String colorIdent = getColorIdentity(state);
final int numColors = state.getColors().countColors();
if (!colorIdentMode.equals("Only Multicolor") || numColors > 1) {
if (area.length() != 0) {
area.append("\n\n");
}
area.append("Color identity: ");
area.append(colorIdent.isEmpty() ? "colorless" : colorIdent);
}
}
//show current storm count for storm cards
if (state.hasStorm()) {
if (gameView != null) {

View File

@@ -78,6 +78,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
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_FOR_TOUCHSCREN("false"),