forked from External/mage
[refactoring][minor] Replaced all tabs with four spaces.
This commit is contained in:
parent
e646e4768d
commit
239a4fb100
2891 changed files with 79411 additions and 79411 deletions
|
|
@ -69,203 +69,203 @@ import static mage.constants.Constants.*;
|
|||
@SuppressWarnings("serial")
|
||||
public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener {
|
||||
|
||||
protected static Session session = MageFrame.getSession();
|
||||
protected static DefaultActionCallback callback = DefaultActionCallback.getInstance();
|
||||
|
||||
protected Point p;
|
||||
protected CardDimensions dimension;
|
||||
protected static Session session = MageFrame.getSession();
|
||||
protected static DefaultActionCallback callback = DefaultActionCallback.getInstance();
|
||||
|
||||
protected final UUID gameId;
|
||||
protected final BigCard bigCard;
|
||||
protected CardView card;
|
||||
protected Popup popup;
|
||||
protected boolean popupShowing;
|
||||
protected Point p;
|
||||
protected CardDimensions dimension;
|
||||
|
||||
protected TextPopup popupText = new TextPopup();
|
||||
protected BufferedImage background;
|
||||
protected BufferedImage image = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
|
||||
protected BufferedImage small;
|
||||
protected String backgroundName;
|
||||
protected final UUID gameId;
|
||||
protected final BigCard bigCard;
|
||||
protected CardView card;
|
||||
protected Popup popup;
|
||||
protected boolean popupShowing;
|
||||
|
||||
protected TextPopup popupText = new TextPopup();
|
||||
protected BufferedImage background;
|
||||
protected BufferedImage image = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
|
||||
protected BufferedImage small;
|
||||
protected String backgroundName;
|
||||
|
||||
/** Creates new form Card */
|
||||
public Card(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
this.dimension = dimension;
|
||||
this.dimension = dimension;
|
||||
initComponents();
|
||||
|
||||
this.gameId = gameId;
|
||||
this.card = card;
|
||||
this.bigCard = bigCard;
|
||||
small = new BufferedImage(Config.dimensions.frameWidth, Config.dimensions.frameHeight, BufferedImage.TYPE_INT_RGB);
|
||||
backgroundName = getBackgroundName();
|
||||
background = ImageHelper.getBackground(card, backgroundName);
|
||||
|
||||
StyledDocument doc = text.getStyledDocument();
|
||||
this.gameId = gameId;
|
||||
this.card = card;
|
||||
this.bigCard = bigCard;
|
||||
small = new BufferedImage(Config.dimensions.frameWidth, Config.dimensions.frameHeight, BufferedImage.TYPE_INT_RGB);
|
||||
backgroundName = getBackgroundName();
|
||||
background = ImageHelper.getBackground(card, backgroundName);
|
||||
|
||||
StyledDocument doc = text.getStyledDocument();
|
||||
Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
|
||||
Style regular = doc.addStyle("regular", def);
|
||||
StyleConstants.setFontFamily(def, "arial");
|
||||
Style s = doc.addStyle("small", regular);
|
||||
StyleConstants.setFontSize(s, 9);
|
||||
|
||||
//addMouseListener(this);
|
||||
//text.addMouseListener(this);
|
||||
//addFocusListener(this);
|
||||
//addMouseMotionListener(this);
|
||||
//text.addMouseMotionListener(this);
|
||||
//addComponentListener(this);
|
||||
//addMouseListener(this);
|
||||
//text.addMouseListener(this);
|
||||
//addFocusListener(this);
|
||||
//addMouseMotionListener(this);
|
||||
//text.addMouseMotionListener(this);
|
||||
//addComponentListener(this);
|
||||
}
|
||||
|
||||
public UUID getCardId() {
|
||||
return card.getId();
|
||||
}
|
||||
public UUID getCardId() {
|
||||
return card.getId();
|
||||
}
|
||||
|
||||
public void update(PermanentView permanent) {
|
||||
this.update((CardView)permanent);
|
||||
}
|
||||
|
||||
public void update(CardView card) {
|
||||
this.card = card;
|
||||
Graphics2D gImage = image.createGraphics();
|
||||
Graphics2D gSmall = small.createGraphics();
|
||||
String cardType = getType(card);
|
||||
String testBackgroundName = getBackgroundName();
|
||||
if (!testBackgroundName.equals(backgroundName)) {
|
||||
backgroundName = testBackgroundName;
|
||||
background = ImageHelper.getBackground(card, backgroundName);
|
||||
}
|
||||
public void update(PermanentView permanent) {
|
||||
this.update((CardView)permanent);
|
||||
}
|
||||
|
||||
popupText.setText(getText(cardType));
|
||||
public void update(CardView card) {
|
||||
this.card = card;
|
||||
Graphics2D gImage = image.createGraphics();
|
||||
Graphics2D gSmall = small.createGraphics();
|
||||
String cardType = getType(card);
|
||||
String testBackgroundName = getBackgroundName();
|
||||
if (!testBackgroundName.equals(backgroundName)) {
|
||||
backgroundName = testBackgroundName;
|
||||
background = ImageHelper.getBackground(card, backgroundName);
|
||||
}
|
||||
|
||||
gImage.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
gImage.setColor(Color.BLACK);
|
||||
gImage.drawImage(background, 0, 0, this);
|
||||
popupText.setText(getText(cardType));
|
||||
|
||||
if (card.getManaCost().size() > 0)
|
||||
ImageHelper.drawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this);
|
||||
gImage.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
gImage.setColor(Color.BLACK);
|
||||
gImage.drawImage(background, 0, 0, this);
|
||||
|
||||
gSmall.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
gSmall.setColor(Color.BLACK);
|
||||
gSmall.drawImage(ImageHelper.scaleImage(image, Config.dimensions.frameWidth, Config.dimensions.frameHeight), 0, 0, this);
|
||||
if (card.getManaCost().size() > 0)
|
||||
ImageHelper.drawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this);
|
||||
|
||||
gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
|
||||
gImage.drawString(card.getName(), CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
gSmall.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
gSmall.setColor(Color.BLACK);
|
||||
gSmall.drawImage(ImageHelper.scaleImage(image, Config.dimensions.frameWidth, Config.dimensions.frameHeight), 0, 0, this);
|
||||
|
||||
if (card.getCardTypes().size() > 0)
|
||||
gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET);
|
||||
gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
|
||||
gImage.drawString(card.getName(), CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
|
||||
gImage.dispose();
|
||||
if (card.getCardTypes().size() > 0)
|
||||
gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET);
|
||||
|
||||
gSmall.setFont(new Font("Arial", Font.PLAIN, Config.dimensions.nameFontSize));
|
||||
gSmall.drawString(card.getName(), Config.dimensions.contentXOffset, Config.dimensions.nameYOffset);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
gSmall.drawString(card.getPower() + "/" + card.getToughness(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
gImage.dispose();
|
||||
|
||||
if (card.getCardTypes().size() > 0)
|
||||
gSmall.drawString(cardType, Config.dimensions.contentXOffset, Config.dimensions.typeYOffset);
|
||||
drawText();
|
||||
gSmall.setFont(new Font("Arial", Font.PLAIN, Config.dimensions.nameFontSize));
|
||||
gSmall.drawString(card.getName(), Config.dimensions.contentXOffset, Config.dimensions.nameYOffset);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
gSmall.drawString(card.getPower() + "/" + card.getToughness(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
|
||||
gSmall.dispose();
|
||||
}
|
||||
if (card.getCardTypes().size() > 0)
|
||||
gSmall.drawString(cardType, Config.dimensions.contentXOffset, Config.dimensions.typeYOffset);
|
||||
drawText();
|
||||
|
||||
@Override
|
||||
public void updateImage() {
|
||||
}
|
||||
gSmall.dispose();
|
||||
}
|
||||
|
||||
protected String getText(String cardType) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
for (String rule: getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
sb.append("\n").append(card.getManaCost());
|
||||
}
|
||||
sb.append("\n").append(cardType);
|
||||
if (card.getColor().hasColor()) {
|
||||
sb.append("\n").append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
sb.append("\n").append(card.getPower()).append("/").append(card.getToughness());
|
||||
}
|
||||
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
sb.append("\n").append(card.getLoyalty());
|
||||
}
|
||||
for (String rule: getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
sb.append("\n").append(card.getCardNumber()).append(" - ");
|
||||
sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
}
|
||||
}
|
||||
// sb.append("\n").append(card.getId());
|
||||
return sb.toString();
|
||||
}
|
||||
@Override
|
||||
public void updateImage() {
|
||||
}
|
||||
|
||||
protected String getBackgroundName() {
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
return "effect";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (card.getCardTypes().contains(CardType.LAND)) {
|
||||
sb.append("land").append(card.getSuperTypes()).append(card.getSubTypes());
|
||||
}
|
||||
else if (card.getCardTypes() != null && (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER))) {
|
||||
sb.append("creature");
|
||||
}
|
||||
sb.append(card.getColor()).append(card.getRarity()).append(card.getExpansionSetCode());
|
||||
return sb.toString();
|
||||
}
|
||||
protected String getText(String cardType) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
for (String rule: getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
sb.append("\n").append(card.getManaCost());
|
||||
}
|
||||
sb.append("\n").append(cardType);
|
||||
if (card.getColor().hasColor()) {
|
||||
sb.append("\n").append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
sb.append("\n").append(card.getPower()).append("/").append(card.getToughness());
|
||||
}
|
||||
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
sb.append("\n").append(card.getLoyalty());
|
||||
}
|
||||
for (String rule: getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
sb.append("\n").append(card.getCardNumber()).append(" - ");
|
||||
sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
}
|
||||
}
|
||||
// sb.append("\n").append(card.getId());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected void drawText() {
|
||||
text.setText("");
|
||||
StyledDocument doc = text.getStyledDocument();
|
||||
protected String getBackgroundName() {
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
return "effect";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (card.getCardTypes().contains(CardType.LAND)) {
|
||||
sb.append("land").append(card.getSuperTypes()).append(card.getSubTypes());
|
||||
}
|
||||
else if (card.getCardTypes() != null && (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER))) {
|
||||
sb.append("creature");
|
||||
}
|
||||
sb.append(card.getColor()).append(card.getRarity()).append(card.getExpansionSetCode());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
try {
|
||||
for (String rule: getRules())
|
||||
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
|
||||
} catch (BadLocationException e) {}
|
||||
protected void drawText() {
|
||||
text.setText("");
|
||||
StyledDocument doc = text.getStyledDocument();
|
||||
|
||||
text.setCaretPosition(0);
|
||||
}
|
||||
try {
|
||||
for (String rule: getRules())
|
||||
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
|
||||
} catch (BadLocationException e) {}
|
||||
|
||||
protected List<String> getRules() {
|
||||
return card.getRules();
|
||||
}
|
||||
text.setCaretPosition(0);
|
||||
}
|
||||
|
||||
protected String getType(CardView card) {
|
||||
StringBuilder sbType = new StringBuilder();
|
||||
protected List<String> getRules() {
|
||||
return card.getRules();
|
||||
}
|
||||
|
||||
for (String superType: card.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
}
|
||||
protected String getType(CardView card) {
|
||||
StringBuilder sbType = new StringBuilder();
|
||||
|
||||
for (mage.Constants.CardType cardType: card.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
}
|
||||
for (String superType: card.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
}
|
||||
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType: card.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
}
|
||||
}
|
||||
for (mage.Constants.CardType cardType: card.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
}
|
||||
|
||||
return sbType.toString();
|
||||
}
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType: card.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return sbType.toString();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
|
|
@ -301,163 +301,163 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
jScrollPane1.setBounds(new Rectangle(dimension.contentXOffset, dimension.textYOffset, dimension.textWidth, dimension.textHeight));
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics graphics) {
|
||||
Graphics2D g2 = (Graphics2D) graphics;
|
||||
g2.drawImage(small, 0, 0, this);
|
||||
@Override
|
||||
public void paintComponent(Graphics graphics) {
|
||||
Graphics2D g2 = (Graphics2D) graphics;
|
||||
g2.drawImage(small, 0, 0, this);
|
||||
|
||||
//Add a border, red if card currently has focus
|
||||
if (isFocusOwner()) {
|
||||
g2.setColor(Color.RED);
|
||||
} else {
|
||||
g2.setColor(Color.BLACK);
|
||||
}
|
||||
g2.drawRect(0, 0, Config.dimensions.frameWidth - 1, Config.dimensions.frameHeight - 1);
|
||||
}
|
||||
//Add a border, red if card currently has focus
|
||||
if (isFocusOwner()) {
|
||||
g2.setColor(Color.RED);
|
||||
} else {
|
||||
g2.setColor(Color.BLACK);
|
||||
}
|
||||
g2.drawRect(0, 0, Config.dimensions.frameWidth - 1, Config.dimensions.frameHeight - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
}
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent arg0) {
|
||||
this.bigCard.showTextComponent();
|
||||
this.bigCard.setCard(card.getId(), image, getRules(), false);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent arg0) {
|
||||
this.bigCard.showTextComponent();
|
||||
this.bigCard.setCard(card.getId(), image, getRules(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
requestFocusInWindow();
|
||||
callback.mouseClicked(e, gameId, session, card);
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
requestFocusInWindow();
|
||||
callback.mouseClicked(e, gameId, session, card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
if (!popupShowing) {
|
||||
if (popup != null)
|
||||
popup.hide();
|
||||
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + Config.dimensions.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
|
||||
popup.show();
|
||||
//hack to get popup to resize to fit text
|
||||
popup.hide();
|
||||
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + Config.dimensions.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
|
||||
popup.show();
|
||||
popupShowing = true;
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
if (!popupShowing) {
|
||||
if (popup != null)
|
||||
popup.hide();
|
||||
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + Config.dimensions.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
|
||||
popup.show();
|
||||
//hack to get popup to resize to fit text
|
||||
popup.hide();
|
||||
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + Config.dimensions.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
|
||||
popup.show();
|
||||
popupShowing = true;
|
||||
|
||||
// Draw Arrows for targets
|
||||
List<UUID> targets = card.getTargets();
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
PlayAreaPanel p = MageFrame.getGame(gameId).getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red, ArrowBuilder.Type.TARGET);
|
||||
} else {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(gameId).getPlayers().values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() + 10, Color.red, ArrowBuilder.Type.TARGET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Draw Arrows for targets
|
||||
List<UUID> targets = card.getTargets();
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
PlayAreaPanel p = MageFrame.getGame(gameId).getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red, ArrowBuilder.Type.TARGET);
|
||||
} else {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(gameId).getPlayers().values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() + 10, Color.red, ArrowBuilder.Type.TARGET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
if(getMousePosition(true) != null) return;
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
popupShowing = false;
|
||||
//ArrowBuilder.removeAllArrows();
|
||||
@Override
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
if(getMousePosition(true) != null) return;
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
popupShowing = false;
|
||||
//ArrowBuilder.removeAllArrows();
|
||||
ArrowBuilder.removeArrowsByType(ArrowBuilder.Type.TARGET);
|
||||
ArrowBuilder.removeArrowsByType(ArrowBuilder.Type.PAIRED);
|
||||
ArrowBuilder.removeArrowsByType(ArrowBuilder.Type.SOURCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
this.repaint();
|
||||
}
|
||||
@Override
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
if (popup != null)
|
||||
popup.hide();
|
||||
this.repaint();
|
||||
}
|
||||
@Override
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
if (popup != null)
|
||||
popup.hide();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
protected JScrollPane getText() {
|
||||
return jScrollPane1;
|
||||
}
|
||||
protected JScrollPane getText() {
|
||||
return jScrollPane1;
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
protected javax.swing.JTextPane text;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) { }
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) { }
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) { }
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) { }
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) { }
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) { }
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
if (popup != null)
|
||||
popup.hide();
|
||||
}
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
if (popup != null)
|
||||
popup.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MagePermanent> getLinks() {return null;}
|
||||
@Override
|
||||
public List<MagePermanent> getLinks() {return null;}
|
||||
|
||||
@Override
|
||||
public boolean isTapped() {return false;}
|
||||
@Override
|
||||
public boolean isTapped() {return false;}
|
||||
|
||||
@Override
|
||||
public boolean isFlipped() {return false;}
|
||||
@Override
|
||||
public boolean isFlipped() {return false;}
|
||||
|
||||
@Override
|
||||
public void onBeginAnimation() {}
|
||||
@Override
|
||||
public void onBeginAnimation() {}
|
||||
|
||||
@Override
|
||||
public void onEndAnimation() {}
|
||||
@Override
|
||||
public void onEndAnimation() {}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float transparency) {}
|
||||
@Override
|
||||
public void setAlpha(float transparency) {}
|
||||
|
||||
@Override
|
||||
public CardView getOriginal() {
|
||||
return card;
|
||||
}
|
||||
@Override
|
||||
public CardView getOriginal() {
|
||||
return card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCardBounds(int x, int y, int width, int height) {
|
||||
// do nothing
|
||||
}
|
||||
@Override
|
||||
public void setCardBounds(int x, int y, int width, int height) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
@Override
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFoil(boolean foil) {
|
||||
|
|
@ -478,22 +478,22 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCallback(ActionCallback callback, UUID gameId) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
@Override
|
||||
public void updateCallback(ActionCallback callback, UUID gameId) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermanentView getOriginalPermanent() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public PermanentView getOriginalPermanent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAlpha() {return 0;}
|
||||
@Override
|
||||
public float getAlpha() {return 0;}
|
||||
|
||||
@Override
|
||||
public void toggleTransformed() {
|
||||
}
|
||||
@Override
|
||||
public void toggleTransformed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransformed() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue