mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
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
|
@ -155,7 +155,7 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
// order objects for display
|
||||
java.util.List<CardView> orderedList = new ArrayList<CardView>();
|
||||
java.util.List<CardView> orderedList = new ArrayList<>();
|
||||
for (CardView card: cardsView.values()) {
|
||||
orderedList.add(0, card);
|
||||
}
|
||||
|
@ -173,7 +173,10 @@ public class Cards extends javax.swing.JPanel {
|
|||
tmp.setIsAbility(true);
|
||||
tmp.overrideTargets(card.getTargets());
|
||||
tmp.overrideId(card.getId());
|
||||
tmp.setAbilityType(((StackAbilityView)card).getAbilityType());
|
||||
card = tmp;
|
||||
} else {
|
||||
card.setAbilityType(null);
|
||||
}
|
||||
if (!cards.containsKey(card.getId())) {
|
||||
addCard(card, bigCard, gameId);
|
||||
|
@ -302,7 +305,7 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void layoutCards() {
|
||||
java.util.List<CardPanel> cards = new ArrayList();
|
||||
java.util.List<CardPanel> cards = new ArrayList<>();
|
||||
|
||||
for (Component component : cardArea.getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
|
|
|
@ -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;
|
||||
|
|
BIN
Mage.Client/src/main/resources/card/activated_ability.png
Normal file
BIN
Mage.Client/src/main/resources/card/activated_ability.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 644 B |
BIN
Mage.Client/src/main/resources/card/triggered_ability.png
Normal file
BIN
Mage.Client/src/main/resources/card/triggered_ability.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 733 B |
|
@ -53,6 +53,7 @@ import mage.target.Targets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.AbilityType;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -78,6 +79,7 @@ public class CardView extends SimpleCardView {
|
|||
protected MageObjectType mageObjectType;
|
||||
|
||||
protected boolean isAbility;
|
||||
protected AbilityType abilityType;
|
||||
protected boolean isToken;
|
||||
|
||||
protected CardView ability;
|
||||
|
@ -452,6 +454,14 @@ public class CardView extends SimpleCardView {
|
|||
return isAbility;
|
||||
}
|
||||
|
||||
public AbilityType getAbilityType() {
|
||||
return abilityType;
|
||||
}
|
||||
|
||||
public void setAbilityType(AbilityType abilityType) {
|
||||
this.abilityType = abilityType;
|
||||
}
|
||||
|
||||
public String getPower() {
|
||||
return power;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.UUID;
|
|||
import mage.MageObject;
|
||||
import mage.abilities.Modes;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackAbility;
|
||||
|
@ -48,10 +49,12 @@ public class StackAbilityView extends CardView {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final CardView sourceCard;
|
||||
private final AbilityType abilityType;
|
||||
|
||||
public StackAbilityView(Game game, StackAbility ability, String sourceName, CardView sourceCard) {
|
||||
this.id = ability.getId();
|
||||
this.mageObjectType = MageObjectType.ABILITY_STACK;
|
||||
this.abilityType = ability.getStackAbility().getAbilityType();
|
||||
this.sourceCard = sourceCard;
|
||||
this.sourceCard.setMageObjectType(mageObjectType);
|
||||
this.name = "Ability";
|
||||
|
@ -113,4 +116,9 @@ public class StackAbilityView extends CardView {
|
|||
public CardView getSourceCard() {
|
||||
return this.sourceCard;
|
||||
}
|
||||
|
||||
public AbilityType getAbilityType() {
|
||||
return abilityType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue