Displaying top revealed card in client. PlayWithTheTopCardRevealedEffect.

This commit is contained in:
magenoxx 2011-08-27 16:30:06 +04:00
parent 8b415e2296
commit 31d849ef46
9 changed files with 160 additions and 20 deletions

View file

@ -1,9 +1,11 @@
package mage.cards;
import java.awt.Image;
import java.util.UUID;
import javax.swing.JPanel;
import mage.cards.action.ActionCallback;
import mage.view.CardView;
public abstract class MageCard extends JPanel {
@ -18,9 +20,11 @@ public abstract class MageCard extends JPanel {
abstract public CardView getOriginal();
abstract public void setCardBounds(int x, int y, int width, int height);
abstract public void update(CardView card);
abstract public void updateImage();
abstract public Image getImage();
abstract public void setFoil(boolean foil);
abstract public boolean isFoil();
abstract public void setZone(String zone);
abstract public String getZone();
abstract public void updateCallback(ActionCallback callback, UUID gameId);
}

View file

@ -145,6 +145,14 @@ public class CardView extends SimpleCardView {
super(null, "", 0, false);
}
public CardView(boolean empty) {
super(null, "", 0, false);
if (!empty) {
throw new IllegalArgumentException("Not supported.");
}
fillEmpty();
}
private void fillEmpty() {
this.name = "Face Down";
this.rules = new ArrayList<String>();

View file

@ -57,6 +57,7 @@ public class PlayerView implements Serializable {
private ManaPoolView manaPool;
private SimpleCardsView graveyard = new SimpleCardsView();
private Map<UUID, PermanentView> battlefield = new HashMap<UUID, PermanentView>();
private CardView topCard;
public PlayerView(Player player, GameState state, Game game) {
this.playerId = player.getId();
@ -77,6 +78,8 @@ public class PlayerView implements Serializable {
battlefield.put(view.getId(), view);
}
}
this.topCard = player.isTopCardRevealed() && player.getLibrary().size() > 0 ?
new CardView(player.getLibrary().getFromTop(game)) : null;
}
private boolean showInBattlefield(Permanent permanent, GameState state) {
@ -136,4 +139,8 @@ public class PlayerView implements Serializable {
public boolean hasLeft() {
return this.hasLeft;
}
public CardView getTopCard() {
return this.topCard;
}
}