mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
Added small icon for tokens on token permanents. Token copied from permanents (Giant Adephage) show now the image of the permanent.
This commit is contained in:
parent
5216eddb71
commit
95a12028e6
8 changed files with 69 additions and 3 deletions
|
@ -65,6 +65,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
public final ScaledImagePanel imagePanel;
|
||||
public ImagePanel overlayPanel;
|
||||
public JPanel buttonPanel;
|
||||
public JPanel iconPanel;
|
||||
|
||||
private GlowText titleText;
|
||||
private GlowText ptText;
|
||||
|
@ -94,6 +95,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
private boolean transformed;
|
||||
private boolean animationInProgress = false;
|
||||
private JButton dayNightButton;
|
||||
private JButton tokenButton;
|
||||
|
||||
private boolean displayTitleAnyway;
|
||||
|
||||
|
@ -142,6 +144,23 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
}
|
||||
});
|
||||
|
||||
// token icon
|
||||
iconPanel = new JPanel();
|
||||
iconPanel.setLayout(null);
|
||||
iconPanel.setOpaque(false);
|
||||
add(iconPanel);
|
||||
|
||||
tokenButton = new JButton("");
|
||||
tokenButton.setLocation(2, 2);
|
||||
tokenButton.setSize(25, 25);
|
||||
|
||||
iconPanel.setVisible(this.gameCard.isToken());
|
||||
|
||||
BufferedImage tokenIconImage = ImageManagerImpl.getInstance().getTokenIconImage();
|
||||
tokenButton.setIcon(new ImageIcon(tokenIconImage));
|
||||
|
||||
iconPanel.add(tokenButton);
|
||||
|
||||
setBackground(Color.black);
|
||||
setOpaque(false);
|
||||
|
||||
|
@ -411,6 +430,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
buttonPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
buttonPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
|
||||
|
||||
iconPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
iconPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
|
||||
|
||||
int fontHeight = Math.round(cardHeight * (27f / 680));
|
||||
boolean showText = (!isAnimationPanel && fontHeight < 12);
|
||||
titleText.setVisible(showText);
|
||||
|
|
|
@ -11,6 +11,8 @@ public interface ImageManager {
|
|||
Image getSicknessImage();
|
||||
Image getDayImage();
|
||||
Image getNightImage();
|
||||
|
||||
Image getTokenIconImage();
|
||||
|
||||
Image getDlgAcceptButtonImage();
|
||||
Image getDlgActiveAcceptButtonImage();
|
||||
|
|
|
@ -97,6 +97,15 @@ public class ImageManagerImpl implements ImageManager {
|
|||
return imageNight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage getTokenIconImage() {
|
||||
if (imageTokenIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/card/token.png", Color.WHITE, new Rectangle(20, 20));
|
||||
imageTokenIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return imageTokenIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getDlgCancelButtonImage() {
|
||||
if (imageDlgCancelButton == null) {
|
||||
|
@ -216,6 +225,8 @@ public class ImageManagerImpl implements ImageManager {
|
|||
private static BufferedImage imageDay;
|
||||
private static BufferedImage imageNight;
|
||||
|
||||
private static BufferedImage imageTokenIcon;
|
||||
|
||||
private static BufferedImage imageDlgAcceptButton;
|
||||
private static BufferedImage imageDlgActiveAcceptButton;
|
||||
private static BufferedImage imageDlgCancelButton;
|
||||
|
|
BIN
Mage.Client/src/main/resources/card/token.png
Normal file
BIN
Mage.Client/src/main/resources/card/token.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 753 B |
|
@ -153,11 +153,20 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
|
||||
if (card instanceof PermanentToken) {
|
||||
this.isToken = true;
|
||||
this.rarity = Rarity.COMMON;
|
||||
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
|
||||
if (((PermanentToken) card).getToken().getOriginalCardNumber() > 0) {
|
||||
// a token copied from permanent
|
||||
this.expansionSetCode = ((PermanentToken) card).getToken().getOriginalExpansionSetCode();
|
||||
this.cardNumber = ((PermanentToken) card).getToken().getOriginalCardNumber();
|
||||
} else {
|
||||
// a created token
|
||||
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
|
||||
}
|
||||
//
|
||||
// set code und card number for token copies to get the image
|
||||
this.rules = ((PermanentToken) card).getRules();
|
||||
this.type = ((PermanentToken)card).getToken().getTokenType();
|
||||
this.isToken = true;
|
||||
} else {
|
||||
this.rarity = card.getRarity();
|
||||
this.isToken = false;
|
||||
|
|
|
@ -75,6 +75,8 @@ public class AdventOfTheWurm extends CardImpl<AdventOfTheWurm> {
|
|||
subtype.add("Wurm");
|
||||
power = new MageInt(5);
|
||||
toughness = new MageInt(5);
|
||||
expansionSetCode = "RTR";
|
||||
|
||||
addAbility(TrampleAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ public class Token extends MageObjectImpl<Token> {
|
|||
protected String description;
|
||||
private UUID lastAddedTokenId;
|
||||
private int tokenType;
|
||||
private int originalCardNumber;
|
||||
private String originalExpansionSetCode;
|
||||
|
||||
public enum Type {
|
||||
FIRST(1),
|
||||
|
@ -146,4 +148,21 @@ public class Token extends MageObjectImpl<Token> {
|
|||
public void setTokenType(int tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
}
|
||||
|
||||
public int getOriginalCardNumber() {
|
||||
return originalCardNumber;
|
||||
}
|
||||
|
||||
public void setOriginalCardNumber(int originalCardNumber) {
|
||||
this.originalCardNumber = originalCardNumber;
|
||||
}
|
||||
|
||||
public String getOriginalExpansionSetCode() {
|
||||
return originalExpansionSetCode;
|
||||
}
|
||||
|
||||
public void setOriginalExpansionSetCode(String originalExpansionSetCode) {
|
||||
this.originalExpansionSetCode = originalExpansionSetCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,8 @@ public class CopyTokenFunction implements Function<Token, Card> {
|
|||
for (String type : sourceObj.getSupertype()) {
|
||||
target.getSupertype().add(type);
|
||||
}
|
||||
//target.setExpansionSetCode(source.getExpansionSetCode());
|
||||
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
|
||||
target.setOriginalCardNumber(source.getCardNumber());
|
||||
target.getAbilities().clear();
|
||||
|
||||
for (Ability ability0 : sourceObj.getAbilities()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue