diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index 38898428ae..7a1adcec5b 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -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(); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java index 42b256f4c5..89161504c3 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java @@ -16,6 +16,7 @@ public interface ImageManager { Image getTriggeredAbilityImage(); Image getActivatedAbilityImage(); Image getCopyInformIconImage(); + Image getCounterImage(); Image getDlgAcceptButtonImage(); Image getDlgActiveAcceptButtonImage(); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java index d08a09f6cc..8dbf56490d 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java @@ -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; diff --git a/Mage.Client/src/main/resources/card/counter_green.png b/Mage.Client/src/main/resources/card/counter_green.png new file mode 100644 index 0000000000..84e32e0eb8 Binary files /dev/null and b/Mage.Client/src/main/resources/card/counter_green.png differ