mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Fix so card name reflects alternate state properly
This commit is contained in:
@@ -186,7 +186,7 @@ public class CardDetailPanel extends SkinnedPanel {
|
||||
final CardStateView state = card.getState(isInAltState);
|
||||
|
||||
if (state.getManaCost().isNoCost() || !canShow) {
|
||||
nameCostLabel.setText(CardDetailUtil.formatCardName(card, canShow));
|
||||
nameCostLabel.setText(CardDetailUtil.formatCardName(card, canShow, isInAltState));
|
||||
}
|
||||
else {
|
||||
final String manaCost;
|
||||
@@ -195,7 +195,7 @@ public class CardDetailPanel extends SkinnedPanel {
|
||||
} else {
|
||||
manaCost = state.getManaCost().toString();
|
||||
}
|
||||
nameCostLabel.setText(FSkin.encodeSymbols(CardDetailUtil.formatCardName(card, canShow) + " - " + manaCost, true));
|
||||
nameCostLabel.setText(FSkin.encodeSymbols(CardDetailUtil.formatCardName(card, canShow, isInAltState) + " - " + manaCost, true));
|
||||
}
|
||||
typeLabel.setText(CardDetailUtil.formatCardType(state, canShow));
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ public class CardRenderer {
|
||||
//draw name for card
|
||||
x += padding;
|
||||
w -= 2 * padding;
|
||||
g.drawText(CardDetailUtil.formatCardName(card, canShow), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true);
|
||||
g.drawText(CardDetailUtil.formatCardName(card, canShow, false), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true);
|
||||
|
||||
//draw type and set label for card
|
||||
y += h;
|
||||
|
||||
@@ -162,8 +162,8 @@ public class CardDetailUtil {
|
||||
return item.getName();
|
||||
}
|
||||
|
||||
public static String formatCardName(final CardView card, final boolean canShow) {
|
||||
final String name = card.getName();
|
||||
public static String formatCardName(final CardView card, final boolean canShow, final boolean forAltState) {
|
||||
final String name = forAltState ? card.getAlternateState().getName() : card.getName();
|
||||
return StringUtils.isEmpty(name) || !canShow ? "???" : name.trim();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user