Some minor GUI fixes, amongst which fixes for Morph display and Ponder effects.

This commit is contained in:
elcnesh
2014-09-15 19:29:48 +00:00
parent 89f5100ba8
commit 0c896f4110
9 changed files with 36 additions and 39 deletions

View File

@@ -33,7 +33,6 @@ import org.apache.commons.lang3.StringUtils;
import forge.card.CardDetailUtil; import forge.card.CardDetailUtil;
import forge.card.CardDetailUtil.DetailColors; import forge.card.CardDetailUtil.DetailColors;
import forge.card.CardEdition; import forge.card.CardEdition;
import forge.game.zone.ZoneType;
import forge.item.IPaperCard; import forge.item.IPaperCard;
import forge.item.InventoryItemFromSet; import forge.item.InventoryItemFromSet;
import forge.model.FModel; import forge.model.FModel;
@@ -246,12 +245,6 @@ public class CardDetailPanel extends SkinnedPanel {
// fill the card text // fill the card text
this.cdArea.setText(FSkin.encodeSymbols(CardDetailUtil.composeCardText(state), true)); this.cdArea.setText(FSkin.encodeSymbols(CardDetailUtil.composeCardText(state), true));
if (card.isFaceDown() && card.getZone() == ZoneType.Battlefield) {
this.nameCostLabel.setText("???");
this.typeLabel.setText("Creature");
this.cdArea.setText(FSkin.encodeSymbols("(You may look at this card.)", true));
}
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@@ -30,6 +30,7 @@ import forge.toolbox.FList;
import forge.toolbox.FPanel; import forge.toolbox.FPanel;
import forge.toolbox.FScrollPane; import forge.toolbox.FScrollPane;
import forge.view.CardView; import forge.view.CardView;
import forge.view.CardView.CardStateView;
import forge.view.FDialog; import forge.view.FDialog;
import forge.view.SpellAbilityView; import forge.view.SpellAbilityView;
import forge.view.ViewUtil; import forge.view.ViewUtil;
@@ -328,6 +329,8 @@ public class DualListBox<T> extends FDialog {
CardView card = null; CardView card = null;
if (obj instanceof CardView) { if (obj instanceof CardView) {
card = (CardView) obj; card = (CardView) obj;
} else if (obj instanceof CardStateView) {
card = ((CardStateView) obj).getCard();
} else if (obj instanceof SpellAbilityView) { } else if (obj instanceof SpellAbilityView) {
card = ((SpellAbilityView) obj).getHostCard(); card = ((SpellAbilityView) obj).getHostCard();
} else if (obj instanceof PaperCard) { } else if (obj instanceof PaperCard) {

View File

@@ -25,7 +25,7 @@ import java.util.Map.Entry;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import com.beust.jcommander.internal.Lists; import com.google.common.collect.Lists;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell; import forge.gui.framework.DragCell;

View File

@@ -326,7 +326,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
g2d.fillRoundRect(this.cardXOffset - n, (this.cardYOffset - n) + offset, this.cardWidth + (n * 2), this.cardHeight + (n * 2), cornerSize + n , cornerSize + n); g2d.fillRoundRect(this.cardXOffset - n, (this.cardYOffset - n) + offset, this.cardWidth + (n * 2), this.cardHeight + (n * 2), cornerSize + n , cornerSize + n);
// White border if card is known to have it. // White border if card is known to have it.
if (this.getCard() != null && !this.getCard().isFaceDown()) { if (this.getCard() != null) {
CardEdition ed = FModel.getMagicDb().getEditions().get(this.getCard().getSetCode()); CardEdition ed = FModel.getMagicDb().getEditions().get(this.getCard().getSetCode());
if (ed != null && ed.isWhiteBorder() && this.getCard().getFoilIndex() == 0) { if (ed != null && ed.isWhiteBorder() && this.getCard().getFoilIndex() == 0) {
g2d.setColor(Color.white); g2d.setColor(Color.white);
@@ -797,8 +797,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
private boolean showCardManaCostOverlay() { private boolean showCardManaCostOverlay() {
return isShowingOverlays() && return isShowingOverlays() &&
isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST);
!this.getCard().isFaceDown();
} }
private boolean showCardIdOverlay() { private boolean showCardIdOverlay() {

View File

@@ -710,8 +710,7 @@ public class CardRenderer {
private static boolean showCardManaCostOverlay(CardView card) { private static boolean showCardManaCostOverlay(CardView card) {
return isShowingOverlays(card) && return isShowingOverlays(card) &&
isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST);
!card.isFaceDown();
} }
private static boolean showCardIdOverlay(CardView card) { private static boolean showCardIdOverlay(CardView card) {

View File

@@ -573,25 +573,35 @@ public class PlayerControllerHuman extends PlayerController {
@Override @Override
public List<Card> orderMoveToZoneList(List<Card> cards, ZoneType destinationZone) { public List<Card> orderMoveToZoneList(List<Card> cards, ZoneType destinationZone) {
List<CardView> choices;
mayLookAt.addAll(cards);
switch (destinationZone) { switch (destinationZone) {
case Library: case Library:
return SGuiChoose.order(getGui(), "Choose order of cards to put into the library", "Closest to top", cards, null); choices = SGuiChoose.order(getGui(), "Choose order of cards to put into the library", "Closest to top", getCardViews(cards), null);
break;
case Battlefield: case Battlefield:
return SGuiChoose.order(getGui(), "Choose order of cards to put onto the battlefield", "Put first", cards, null); choices = SGuiChoose.order(getGui(), "Choose order of cards to put onto the battlefield", "Put first", getCardViews(cards), null);
break;
case Graveyard: case Graveyard:
return SGuiChoose.order(getGui(), "Choose order of cards to put into the graveyard", "Closest to bottom", cards, null); choices = SGuiChoose.order(getGui(), "Choose order of cards to put into the graveyard", "Closest to bottom", getCardViews(cards), null);
break;
case PlanarDeck: case PlanarDeck:
return SGuiChoose.order(getGui(), "Choose order of cards to put into the planar deck", "Closest to top", cards, null); choices = SGuiChoose.order(getGui(), "Choose order of cards to put into the planar deck", "Closest to top", getCardViews(cards), null);
break;
case SchemeDeck: case SchemeDeck:
return SGuiChoose.order(getGui(), "Choose order of cards to put into the scheme deck", "Closest to top", cards, null); choices = SGuiChoose.order(getGui(), "Choose order of cards to put into the scheme deck", "Closest to top", getCardViews(cards), null);
break;
case Stack: case Stack:
return SGuiChoose.order(getGui(), "Choose order of copies to cast", "Put first", cards, null); choices = SGuiChoose.order(getGui(), "Choose order of copies to cast", "Put first", getCardViews(cards), null);
break;
default: default:
System.out.println("ZoneType " + destinationZone + " - Not Ordered"); System.out.println("ZoneType " + destinationZone + " - Not Ordered");
break; mayLookAt.clear();
}
return cards; return cards;
} }
mayLookAt.clear();
return getCards(choices);
}
@Override @Override
public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> valid, int min, int max) { public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> valid, int min, int max) {

View File

@@ -38,7 +38,6 @@ public class CardView extends GameEntityView {
private boolean isCloned, isFaceDown, isFlipCard, isFlipped, isSplitCard, isTransformed; private boolean isCloned, isFaceDown, isFlipCard, isFlipped, isSplitCard, isTransformed;
private String setCode; private String setCode;
private CardRarity rarity; private CardRarity rarity;
private long timestamp;
private boolean isAttacking, isBlocking, isPhasedOut, isSick, isTapped, isToken; private boolean isAttacking, isBlocking, isPhasedOut, isSick, isTapped, isToken;
private Map<CounterType, Integer> counters; private Map<CounterType, Integer> counters;
private int damage, assignedDamage, regenerationShields, preventNextDamage; private int damage, assignedDamage, regenerationShields, preventNextDamage;
@@ -80,7 +79,6 @@ public class CardView extends GameEntityView {
this.isTransformed = false; this.isTransformed = false;
this.setCode = StringUtils.EMPTY; this.setCode = StringUtils.EMPTY;
this.rarity = CardRarity.Unknown; this.rarity = CardRarity.Unknown;
this.timestamp = 0L;
this.isAttacking = this.isBlocking = this.isPhasedOut = this.isSick = this.isTapped = false; this.isAttacking = this.isBlocking = this.isPhasedOut = this.isSick = this.isTapped = false;
this.counters = ImmutableMap.of(); this.counters = ImmutableMap.of();
this.damage = this.assignedDamage = this.regenerationShields = this.preventNextDamage = 0; this.damage = this.assignedDamage = this.regenerationShields = this.preventNextDamage = 0;
@@ -318,20 +316,6 @@ public class CardView extends GameEntityView {
this.rarity = rarity; this.rarity = rarity;
} }
/**
* @return the timestamp
*/
public long getTimestamp() {
return timestamp;
}
/**
* @param timestamp the timestamp to set
*/
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
/** /**
* @return the isAttacking * @return the isAttacking
*/ */

View File

@@ -40,7 +40,6 @@ public final class ViewUtil {
view.setTransformed(c.getCurState().equals(CardCharacteristicName.Transformed)); view.setTransformed(c.getCurState().equals(CardCharacteristicName.Transformed));
view.setSetCode(c.getCurSetCode()); view.setSetCode(c.getCurSetCode());
view.setRarity(c.getRarity()); view.setRarity(c.getRarity());
view.setTimestamp(c.getTimestamp());
view.setPhasedOut(c.isPhasedOut()); view.setPhasedOut(c.isPhasedOut());
view.setSick(c.isInPlay() && c.isSick()); view.setSick(c.isInPlay() && c.isSick());
view.setTapped(c.isTapped()); view.setTapped(c.isTapped());

View File

@@ -16,9 +16,13 @@ import forge.util.ITriggerEvent;
public class WatchLocalGame extends LocalGameView { public class WatchLocalGame extends LocalGameView {
private final InputQueue inputQueue; private final InputQueue inputQueue;
/** /**
* @param game * @param game
* the @{link Game} to attach to.
* @param inputQueue * @param inputQueue
* the {@link InputQueue} of the game to enable playback
* controls, or {@code null} to disallow them.
*/ */
public WatchLocalGame(final Game game, final InputQueue inputQueue) { public WatchLocalGame(final Game game, final InputQueue inputQueue) {
super(game); super(game);
@@ -40,6 +44,9 @@ public class WatchLocalGame extends LocalGameView {
@Override @Override
public void selectButtonOk() { public void selectButtonOk() {
if (this.inputQueue == null) {
return;
}
final Input i = inputQueue.getInput(); final Input i = inputQueue.getInput();
if (i instanceof InputPlaybackControl) { if (i instanceof InputPlaybackControl) {
i.selectButtonOK(); i.selectButtonOK();
@@ -48,6 +55,9 @@ public class WatchLocalGame extends LocalGameView {
@Override @Override
public void selectButtonCancel() { public void selectButtonCancel() {
if (this.inputQueue == null) {
return;
}
final Input i = inputQueue.getInput(); final Input i = inputQueue.getInput();
if (i instanceof InputPlaybackControl) { if (i instanceof InputPlaybackControl) {
i.selectButtonCancel(); i.selectButtonCancel();