mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
UI: added draft rating info in card viewer
This commit is contained in:
parent
8e74cc1d6a
commit
0c8fdfcaf2
2 changed files with 39 additions and 9 deletions
|
@ -18,6 +18,7 @@ import mage.components.ImagePanel;
|
||||||
import mage.components.ImagePanelStyle;
|
import mage.components.ImagePanelStyle;
|
||||||
import mage.game.command.Emblem;
|
import mage.game.command.Emblem;
|
||||||
import mage.game.command.Plane;
|
import mage.game.command.Plane;
|
||||||
|
import mage.game.draft.RateCard;
|
||||||
import mage.game.permanent.PermanentToken;
|
import mage.game.permanent.PermanentToken;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
|
@ -422,6 +423,20 @@ public class MageBook extends JComponent {
|
||||||
cardNumber.setFont(jLayeredPane.getFont().deriveFont(jLayeredPane.getFont().getStyle() | Font.BOLD));
|
cardNumber.setFont(jLayeredPane.getFont().deriveFont(jLayeredPane.getFont().getStyle() | Font.BOLD));
|
||||||
cardNumber.setText(card.getCardNumber());
|
cardNumber.setText(card.getCardNumber());
|
||||||
jLayeredPane.add(cardNumber);
|
jLayeredPane.add(cardNumber);
|
||||||
|
|
||||||
|
// draft rating label (
|
||||||
|
JLabel draftRating = new JLabel();
|
||||||
|
dy = -5 * 2 + cardNumber.getHeight(); // under card number
|
||||||
|
draftRating.setBounds(rectangle.x, rectangle.y + cardImg.getHeight() + dy, cardDimensions.frameWidth, 20);
|
||||||
|
draftRating.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
//draftRating.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 150), 3, true));
|
||||||
|
draftRating.setFont(jLayeredPane.getFont().deriveFont(jLayeredPane.getFont().getStyle() | Font.BOLD));
|
||||||
|
if (card.getOriginalCard() != null) {
|
||||||
|
draftRating.setText("draft rating: " + RateCard.rateCard(card.getOriginalCard(), null));
|
||||||
|
} else {
|
||||||
|
draftRating.setText("");
|
||||||
|
}
|
||||||
|
jLayeredPane.add(draftRating);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToken(Token token, BigCard bigCard, UUID gameId, Rectangle rectangle) {
|
private void addToken(Token token, BigCard bigCard, UUID gameId, Rectangle rectangle) {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Abilities;
|
import mage.abilities.Abilities;
|
||||||
|
@ -29,6 +27,9 @@ import mage.target.Target;
|
||||||
import mage.target.Targets;
|
import mage.target.Targets;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@ -110,6 +111,8 @@ public class CardView extends SimpleCardView {
|
||||||
protected boolean canAttack;
|
protected boolean canAttack;
|
||||||
protected boolean inViewerOnly;
|
protected boolean inViewerOnly;
|
||||||
|
|
||||||
|
protected Card originalCard = null;
|
||||||
|
|
||||||
public CardView(Card card) {
|
public CardView(Card card) {
|
||||||
this(card, null, false);
|
this(card, null, false);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +129,7 @@ public class CardView extends SimpleCardView {
|
||||||
|
|
||||||
public CardView(CardView cardView) {
|
public CardView(CardView cardView) {
|
||||||
super(cardView.id, cardView.expansionSetCode, cardView.cardNumber, cardView.usesVariousArt, cardView.tokenSetCode, cardView.gameObject, cardView.tokenDescriptor);
|
super(cardView.id, cardView.expansionSetCode, cardView.cardNumber, cardView.usesVariousArt, cardView.tokenSetCode, cardView.gameObject, cardView.tokenDescriptor);
|
||||||
|
this.originalCard = cardView.originalCard;
|
||||||
|
|
||||||
this.id = UUID.randomUUID();
|
this.id = UUID.randomUUID();
|
||||||
this.parentId = cardView.parentId;
|
this.parentId = cardView.parentId;
|
||||||
|
@ -199,6 +203,7 @@ public class CardView extends SimpleCardView {
|
||||||
this.selected = cardView.selected;
|
this.selected = cardView.selected;
|
||||||
this.canAttack = cardView.canAttack;
|
this.canAttack = cardView.canAttack;
|
||||||
this.inViewerOnly = cardView.inViewerOnly;
|
this.inViewerOnly = cardView.inViewerOnly;
|
||||||
|
this.originalCard = cardView.originalCard.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,6 +246,8 @@ public class CardView extends SimpleCardView {
|
||||||
*/
|
*/
|
||||||
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) {
|
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) {
|
||||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor());
|
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor());
|
||||||
|
this.originalCard = card;
|
||||||
|
|
||||||
// no information available for face down cards as long it's not a controlled face down morph card
|
// no information available for face down cards as long it's not a controlled face down morph card
|
||||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||||
boolean showFaceUp = true;
|
boolean showFaceUp = true;
|
||||||
|
@ -460,10 +467,14 @@ public class CardView extends SimpleCardView {
|
||||||
|
|
||||||
// Get starting loyalty
|
// Get starting loyalty
|
||||||
this.startingLoyalty = "" + card.getStartingLoyalty();
|
this.startingLoyalty = "" + card.getStartingLoyalty();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardView(MageObject object) {
|
public CardView(MageObject object) {
|
||||||
super(object.getId(), "", "0", false, "", true, "");
|
super(object.getId(), "", "0", false, "", true, "");
|
||||||
|
this.originalCard = null;
|
||||||
|
|
||||||
this.name = object.getName();
|
this.name = object.getName();
|
||||||
this.displayName = object.getName();
|
this.displayName = object.getName();
|
||||||
if (object instanceof Permanent) {
|
if (object instanceof Permanent) {
|
||||||
|
@ -1046,4 +1057,8 @@ public class CardView extends SimpleCardView {
|
||||||
public boolean inViewerOnly() {
|
public boolean inViewerOnly() {
|
||||||
return inViewerOnly;
|
return inViewerOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Card getOriginalCard() {
|
||||||
|
return this.originalCard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue