mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Card render testing dialog improves:
* Added chooseable render testing (click by mouse on cards); * Added column style render testing (many cards mode); * Added tapped, face down and manifested render testing for permanents; * CardView: fixed missing copy data (NPE for transformed cards); * CardArea: added support to draw permanents; * CardArea: added support of offsets between cards/columns;
This commit is contained in:
parent
a072d8275f
commit
eaaa37db11
27 changed files with 306 additions and 138 deletions
|
|
@ -1,12 +1,12 @@
|
|||
package mage.cards;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.view.CardView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class MageCard extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 6089945326434301879L;
|
||||
|
|
@ -57,5 +57,4 @@ public abstract class MageCard extends JPanel {
|
|||
public abstract void setPopupMenu(JPopupMenu popupMenu);
|
||||
|
||||
public abstract JPopupMenu getPopupMenu();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ import java.util.UUID;
|
|||
*/
|
||||
public interface CardPlugin extends Plugin {
|
||||
|
||||
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage, int renderMode);
|
||||
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback,
|
||||
boolean canBeFoil, boolean loadImage, int renderMode, boolean needFullPermanentRender);
|
||||
|
||||
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage, int renderMode);
|
||||
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback,
|
||||
boolean canBeFoil, boolean loadImage, int renderMode, boolean needFullPermanentRender);
|
||||
|
||||
int sortPermanents(Map<String, JComponent> ui, Map<UUID, MagePermanent> cards, boolean nonPermanentsOwnRow, boolean topPanel);
|
||||
|
||||
|
|
|
|||
|
|
@ -137,83 +137,76 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
public CardView(CardView cardView) {
|
||||
super(cardView);
|
||||
this.originalCard = cardView.originalCard;
|
||||
|
||||
// generetate new ID
|
||||
// generetate new ID (TODO: why new ID?)
|
||||
this.id = UUID.randomUUID();
|
||||
|
||||
this.parentId = cardView.parentId;
|
||||
|
||||
this.name = cardView.name;
|
||||
this.displayName = cardView.displayName;
|
||||
this.displayFullName = cardView.displayFullName;
|
||||
this.rules = cardView.rules;
|
||||
this.rules = new ArrayList<>(cardView.rules);
|
||||
|
||||
this.power = cardView.power;
|
||||
this.toughness = cardView.toughness;
|
||||
this.loyalty = cardView.loyalty;
|
||||
this.startingLoyalty = cardView.startingLoyalty;
|
||||
this.cardTypes = cardView.cardTypes;
|
||||
this.subTypes = cardView.subTypes;
|
||||
this.cardTypes = new HashSet<>(cardView.cardTypes);
|
||||
this.subTypes = new SubTypeList(cardView.subTypes);
|
||||
this.superTypes = cardView.superTypes;
|
||||
|
||||
this.color = cardView.color;
|
||||
this.frameColor = cardView.frameColor;
|
||||
this.frameStyle = cardView.frameStyle;
|
||||
this.manaCostLeft = cardView.manaCostLeft;
|
||||
this.manaCostRight = cardView.manaCostRight;
|
||||
this.manaCostLeft = new ArrayList<>(cardView.manaCostLeft);
|
||||
this.manaCostRight = new ArrayList<>(cardView.manaCostRight);
|
||||
this.convertedManaCost = cardView.convertedManaCost;
|
||||
this.rarity = cardView.rarity;
|
||||
|
||||
this.mageObjectType = cardView.mageObjectType;
|
||||
|
||||
this.isAbility = cardView.isAbility;
|
||||
this.abilityType = cardView.abilityType;
|
||||
this.isToken = cardView.isToken;
|
||||
|
||||
this.ability = null;
|
||||
this.ability = cardView.ability; // reference, not copy
|
||||
this.type = cardView.type;
|
||||
|
||||
this.transformable = cardView.transformable;
|
||||
if (cardView.secondCardFace != null) {
|
||||
this.secondCardFace = new CardView(cardView.secondCardFace);
|
||||
} else {
|
||||
this.secondCardFace = null;
|
||||
}
|
||||
this.secondCardFace = cardView.secondCardFace == null ? null : new CardView(cardView.secondCardFace);
|
||||
this.transformed = cardView.transformed;
|
||||
|
||||
this.flipCard = cardView.flipCard;
|
||||
this.faceDown = cardView.faceDown;
|
||||
|
||||
this.alternateName = cardView.alternateName;
|
||||
this.originalName = cardView.originalName;
|
||||
this.artRect = cardView.artRect;
|
||||
|
||||
this.isSplitCard = cardView.isSplitCard;
|
||||
this.leftSplitName = cardView.leftSplitName;
|
||||
this.leftSplitCosts = cardView.leftSplitCosts;
|
||||
this.leftSplitRules = null;
|
||||
this.leftSplitCosts = cardView.leftSplitCosts == null ? null : cardView.leftSplitCosts.copy();
|
||||
this.leftSplitRules = cardView.leftSplitRules == null ? null : new ArrayList<>(cardView.leftSplitRules);
|
||||
this.leftSplitTypeLine = cardView.leftSplitTypeLine;
|
||||
this.rightSplitName = cardView.rightSplitName;
|
||||
this.rightSplitCosts = cardView.rightSplitCosts;
|
||||
this.rightSplitRules = null;
|
||||
this.rightSplitCosts = cardView.rightSplitCosts == null ? null : cardView.rightSplitCosts.copy();
|
||||
this.rightSplitRules = cardView.rightSplitRules == null ? null : new ArrayList<>(cardView.rightSplitRules);
|
||||
this.rightSplitTypeLine = cardView.rightSplitTypeLine;
|
||||
|
||||
this.targets = null;
|
||||
|
||||
this.artRect = cardView.artRect;
|
||||
this.targets = cardView.targets == null ? null : new ArrayList<>(cardView.targets);
|
||||
this.pairedCard = cardView.pairedCard;
|
||||
this.bandedCards = null;
|
||||
this.bandedCards = cardView.bandedCards == null ? null : new ArrayList<>(cardView.bandedCards);
|
||||
this.paid = cardView.paid;
|
||||
this.counters = null;
|
||||
if (cardView.counters != null) {
|
||||
this.counters = new ArrayList<>();
|
||||
cardView.counters.forEach(c -> this.counters.add(new CounterView(c)));
|
||||
}
|
||||
|
||||
this.controlledByOwner = cardView.controlledByOwner;
|
||||
|
||||
this.zone = cardView.zone;
|
||||
|
||||
this.rotate = cardView.rotate;
|
||||
this.hideInfo = cardView.hideInfo;
|
||||
|
||||
this.canAttack = cardView.canAttack;
|
||||
this.canBlock = cardView.canBlock;
|
||||
this.inViewerOnly = cardView.inViewerOnly;
|
||||
this.originalCard = cardView.originalCard.copy();
|
||||
this.originalCard = cardView.originalCard == null ? null : cardView.originalCard.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package mage.view;
|
||||
|
||||
import java.util.*;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -15,6 +14,8 @@ import mage.game.permanent.PermanentToken;
|
|||
import mage.target.targetpointer.TargetPointer;
|
||||
import mage.util.GameLog;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -23,6 +24,17 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
public CardsView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses for card render tests
|
||||
*
|
||||
* @param cardViews
|
||||
*/
|
||||
public CardsView(List<CardView> cardViews) {
|
||||
for (CardView view : cardViews) {
|
||||
this.put(view.getId(), view);
|
||||
}
|
||||
}
|
||||
|
||||
public CardsView(Collection<? extends Card> cards) {
|
||||
for (Card card : cards) {
|
||||
this.put(card.getId(), new CardView(card));
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
|
||||
|
||||
package mage.view;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.counters.Counter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CounterView implements Serializable {
|
||||
|
|
@ -20,6 +18,11 @@ public class CounterView implements Serializable {
|
|||
this.count = counter.getCount();
|
||||
}
|
||||
|
||||
public CounterView(final CounterView view) {
|
||||
this.name = view.name;
|
||||
this.count = view.count;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
@ -27,7 +30,7 @@ public class CounterView implements Serializable {
|
|||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) {
|
||||
|
|
@ -39,9 +42,9 @@ public class CounterView implements Serializable {
|
|||
if (!(other instanceof CounterView)) {
|
||||
return false;
|
||||
}
|
||||
CounterView oth = (CounterView)other;
|
||||
CounterView oth = (CounterView) other;
|
||||
return
|
||||
(count == oth.count) &&
|
||||
(name.equals(oth.name));
|
||||
(name.equals(oth.name));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue