forked from External/mage
Added icon for triggered and activated abilities on the stack to better distinct it from casting a card.
This commit is contained in:
parent
bafcff82ec
commit
3a62115c3a
8 changed files with 77 additions and 21 deletions
|
|
@ -31,6 +31,8 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.MageObjectType;
|
||||
|
||||
/**
|
||||
* Main class for drawing Mage card object.
|
||||
|
|
@ -104,7 +106,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
private boolean animationInProgress = false;
|
||||
|
||||
private JButton dayNightButton;
|
||||
private JButton tokenButton;
|
||||
private JButton typeButton;
|
||||
private JButton showCopySourceButton;
|
||||
|
||||
private boolean displayTitleAnyway;
|
||||
|
|
@ -156,23 +158,16 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
});
|
||||
}
|
||||
|
||||
if (newGameCard.isAbility()) {
|
||||
if (AbilityType.TRIGGERED.equals(newGameCard.getAbilityType())) {
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getTriggeredAbilityImage(),"Triggered Ability");
|
||||
} else if (AbilityType.ACTIVATED.equals(newGameCard.getAbilityType())) {
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getActivatedAbilityImage(),"Activated Ability");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.gameCard.isToken()) {
|
||||
// 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);
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getTokenIconImage(),"Token Permanent");
|
||||
}
|
||||
|
||||
// icon to inform about permanent is copying something
|
||||
|
|
@ -276,6 +271,24 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
});
|
||||
}
|
||||
|
||||
private void setTypeIcon(BufferedImage bufferedImage, String toolTipText) {
|
||||
iconPanel = new JPanel();
|
||||
iconPanel.setLayout(null);
|
||||
iconPanel.setOpaque(false);
|
||||
add(iconPanel);
|
||||
|
||||
typeButton = new JButton("");
|
||||
typeButton.setLocation(2, 2);
|
||||
typeButton.setSize(25, 25);
|
||||
|
||||
iconPanel.setVisible(true);
|
||||
typeButton.setIcon(new ImageIcon(bufferedImage));
|
||||
if (toolTipText != null) {
|
||||
typeButton.setToolTipText(toolTipText);
|
||||
}
|
||||
iconPanel.add(typeButton);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
if (dayNightButton != null) {
|
||||
for(ActionListener al: dayNightButton.getActionListeners()) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ public interface ImageManager {
|
|||
Image getNightImage();
|
||||
|
||||
Image getTokenIconImage();
|
||||
Image getTriggeredAbilityImage();
|
||||
Image getActivatedAbilityImage();
|
||||
Image getCopyInformIconImage();
|
||||
|
||||
Image getDlgAcceptButtonImage();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.Map;
|
|||
|
||||
public class ImageManagerImpl implements ImageManager {
|
||||
|
||||
private static ImageManagerImpl fInstance = new ImageManagerImpl();
|
||||
private static final ImageManagerImpl fInstance = new ImageManagerImpl();
|
||||
|
||||
public static ImageManagerImpl getInstance() {
|
||||
return fInstance;
|
||||
|
|
@ -29,7 +29,7 @@ public class ImageManagerImpl implements ImageManager {
|
|||
String[] phases = {"Untap", "Upkeep", "Draw", "Main1",
|
||||
"Combat_Start", "Combat_Attack", "Combat_Block", "Combat_Damage", "Combat_End",
|
||||
"Main2", "Cleanup", "Next_Turn"};
|
||||
phasesImages = new HashMap<String, Image>();
|
||||
phasesImages = new HashMap<>();
|
||||
for (String name : phases) {
|
||||
Image image = getImageFromResource("/phases/phase_" + name.toLowerCase() + ".png", new Rectangle(36, 36));
|
||||
phasesImages.put(name, image);
|
||||
|
|
@ -106,6 +106,24 @@ public class ImageManagerImpl implements ImageManager {
|
|||
return imageTokenIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage getTriggeredAbilityImage() {
|
||||
if (triggeredAbilityIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/card/triggered_ability.png", Color.WHITE, new Rectangle(20, 20));
|
||||
triggeredAbilityIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return triggeredAbilityIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage getActivatedAbilityImage() {
|
||||
if (activatedAbilityIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/card/activated_ability.png", Color.WHITE, new Rectangle(20, 20));
|
||||
activatedAbilityIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return activatedAbilityIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage getCopyInformIconImage() {
|
||||
if (imageCopyIcon == null) {
|
||||
|
|
@ -235,6 +253,8 @@ public class ImageManagerImpl implements ImageManager {
|
|||
private static BufferedImage imageNight;
|
||||
|
||||
private static BufferedImage imageTokenIcon;
|
||||
private static BufferedImage triggeredAbilityIcon;
|
||||
private static BufferedImage activatedAbilityIcon;
|
||||
private static BufferedImage imageCopyIcon;
|
||||
|
||||
private static BufferedImage imageDlgAcceptButton;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue