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:
LevelX2 2013-06-17 17:00:17 +02:00
parent 5216eddb71
commit 95a12028e6
8 changed files with 69 additions and 3 deletions

View file

@ -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);

View file

@ -11,6 +11,8 @@ public interface ImageManager {
Image getSicknessImage();
Image getDayImage();
Image getNightImage();
Image getTokenIconImage();
Image getDlgAcceptButtonImage();
Image getDlgActiveAcceptButtonImage();

View file

@ -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;