Added image for displaying counter.

This commit is contained in:
LevelX2 2014-08-21 17:06:38 +02:00
parent b094df2a52
commit 05f1a88157
4 changed files with 41 additions and 2 deletions

View file

@ -32,6 +32,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.view.CounterView;
/**
* Main class for drawing Mage card object.
@ -72,8 +73,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
public ImagePanel overlayPanel;
public JPanel buttonPanel;
public JPanel iconPanel;
public JPanel copyIconPanel;
public JPanel copyIconPanel;
public JLabel counterLabel;
private GlowText titleText;
private GlowText ptText;
private boolean displayEnabled = true;
@ -306,6 +308,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
// this holds reference to ActionCallback forever so set it to null to prevent
this.callback = null;
this.data = null;
this.counterLabel = null;
}
private void setText(CardView card) {
@ -736,6 +739,31 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
dayNightButton.setIcon(new ImageIcon(transformIcon));
}
}
// if (card.getCounters() != null && !card.getCounters().isEmpty()) {
// ImageIcon image = new ImageIcon(ImageManagerImpl.getInstance().getCounterImage());
// String amount = "";
// String name = "";
// for (CounterView counterView:card.getCounters()) {
// amount = Integer.toString(counterView.getCount());
// name = counterView.getName();
// break;
// }
// if (counterLabel == null) {
// counterLabel = new JLabel(amount, image, JLabel.CENTER);
// }
// counterLabel.setToolTipText(name);
// counterLabel.setLocation(50,50);
//
// this.add(counterLabel);
// counterLabel.setVisible(true);
// } else {
// if (counterLabel != null) {
// this.remove(counterLabel);
// counterLabel = null;
// }
// }
repaint();
}

View file

@ -16,6 +16,7 @@ public interface ImageManager {
Image getTriggeredAbilityImage();
Image getActivatedAbilityImage();
Image getCopyInformIconImage();
Image getCounterImage();
Image getDlgAcceptButtonImage();
Image getDlgActiveAcceptButtonImage();

View file

@ -133,6 +133,15 @@ public class ImageManagerImpl implements ImageManager {
return imageCopyIcon;
}
@Override
public BufferedImage getCounterImage() {
if (imageCounter == null) {
Image image = getImageFromResourceTransparent("/card/counter_green.png", Color.WHITE, new Rectangle(32, 32));
imageCounter = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
}
return imageCounter;
}
@Override
public Image getDlgCancelButtonImage() {
if (imageDlgCancelButton == null) {
@ -256,6 +265,7 @@ public class ImageManagerImpl implements ImageManager {
private static BufferedImage triggeredAbilityIcon;
private static BufferedImage activatedAbilityIcon;
private static BufferedImage imageCopyIcon;
private static BufferedImage imageCounter;
private static BufferedImage imageDlgAcceptButton;
private static BufferedImage imageDlgActiveAcceptButton;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB