- Added a new color identity display mode: "Changed" (displays color identity only for cards that had their identity altered).

- Improved the use of related string constants.
This commit is contained in:
Agetian
2015-06-02 05:07:10 +00:00
parent 136b133f76
commit 6bc4848857
5 changed files with 47 additions and 11 deletions

View File

@@ -300,7 +300,8 @@ public enum CSubmenuPreferences implements ICDoc {
}
private void initializeColorIdentityCombobox() {
final String[] elems = {ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, ForgeConstants.DISP_COLOR_IDENT_ALWAYS};
final String[] elems = {ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_CHANGED,
ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, ForgeConstants.DISP_COLOR_IDENT_ALWAYS};
final FPref userSetting = FPref.UI_DISPLAY_COLOR_IDENTITY;
final FComboBoxPanel<String> panel = this.view.getDisplayColorIdentity();
final FComboBox<String> comboBox = createComboBox(elems, userSetting);

View File

@@ -166,7 +166,9 @@ public class SettingsPage extends TabPage<SettingsScreen> {
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[]{ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, ForgeConstants.DISP_COLOR_IDENT_ALWAYS}),
new String[]{
ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR,
ForgeConstants.DISP_COLOR_IDENT_CHANGED, ForgeConstants.DISP_COLOR_IDENT_ALWAYS}),
4);
//Card Overlays

View File

@@ -35,11 +35,13 @@ The interface has received several small changes.
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.
identity for all cards, even mono-color), to "Changed" (which displays color
identity of all cards whose color identity has been altered compared to its
"pristine" state) or "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 -

View File

@@ -11,14 +11,17 @@ import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Sets;
import forge.game.GameView;
import forge.game.card.Card;
import forge.game.card.CardUtil;
import forge.game.card.CardView;
import forge.game.card.CardView.CardStateView;
import forge.game.card.CounterType;
import forge.item.InventoryItemFromSet;
import forge.item.PaperCard;
import forge.item.PreconDeck;
import forge.item.SealedProduct;
import forge.model.FModel;
import forge.properties.ForgeConstants;
import forge.properties.ForgePreferences;
import forge.util.Lang;
@@ -509,10 +512,37 @@ public class CardDetailUtil {
//show card color identity if enabled
String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY);
if (!colorIdentMode.equals("Never")) {
if (!colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_NEVER)) {
final String colorIdent = getColorIdentity(state);
final int numColors = state.getColors().countColors();
if (!colorIdentMode.equals("Only Multicolor") || numColors > 1) {
boolean showIdentity = false;
if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED)) {
String origIdent = "";
PaperCard origPaperCard = null;
Card origCard = null;
try {
if (!card.getName().isEmpty()) {
origPaperCard = FModel.getMagicDb().getCommonCards().getCard(card.getName());
} else {
// probably a morph, try to get its identity from the alternate state
origPaperCard = FModel.getMagicDb().getCommonCards().getCard(card.getAlternateState().getName());
}
if (origPaperCard != null) {
origCard = Card.getCardForUi(origPaperCard); // if null, probably a variant card
}
origIdent = origCard != null ? getColorIdentity(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.");
}
showIdentity = !colorIdent.equals(origIdent);
} else if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR)) {
final int numColors = state.getColors().countColors();
showIdentity = numColors > 1;
} else if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_ALWAYS)) {
showIdentity = true;
}
if (showIdentity) {
if (area.length() != 0) {
area.append("\n\n");
}

View File

@@ -180,7 +180,8 @@ public final class ForgeConstants {
// Constants for Display Card Identity game setting
public static final String DISP_COLOR_IDENT_ALWAYS = "Always";
public static final String DISP_COLOR_IDENT_MULTICOLOR = "Only Multicolor";
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_NEVER = "Never";
}