* Added Morph ability.

This commit is contained in:
LevelX2 2014-06-09 17:53:55 +02:00
parent b1de70a3bf
commit d244551e3b
45 changed files with 929 additions and 191 deletions

View file

@ -6,6 +6,7 @@ import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import mage.client.cards.Permanent;
import mage.constants.CardType;
import mage.constants.MageObjectType;
@ -221,7 +222,11 @@ public class GuiDisplayUtil {
buffer.append(pt).append("</b></td>");
buffer.append("<td align='right'>");
if (!card.isControlledByOwner()) {
buffer.append("[only controlled] ");
if (card instanceof PermanentView) {
buffer.append("[").append(((PermanentView) card).getNameOwner()).append("] ");
} else {
buffer.append("[only controlled] ");
}
}
buffer.append(card.getMageObjectType().toString()).append("</td>");
buffer.append("</tr></table>");

View file

@ -703,7 +703,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
setText(card);
boolean updateImage = !gameCard.getName().equals(card.getName()); // update after e.g. turning a night/day card
boolean updateImage = !gameCard.getName().equals(card.getName()) || gameCard.isFaceDown() != card.isFaceDown(); // update after e.g. turning a night/day card
this.gameCard = card;
String cardType = getType(card);
@ -776,7 +776,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
@Override
public void mouseEntered(MouseEvent e) {
if (gameCard.isFaceDown()) {
if (gameCard.hideInfo()) {
return;
}
if (!popupShowing) {
@ -798,7 +798,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
@Override
public void mouseMoved(MouseEvent e) {
if (gameCard.isFaceDown()) {
if (gameCard.hideInfo()) {
return;
}
data.component = this;
@ -807,7 +807,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
@Override
public void mouseExited(MouseEvent e) {
if (gameCard.isFaceDown()) {
if (gameCard.hideInfo()) {
return;
}
if (getMousePosition(true) != null) {
@ -974,10 +974,11 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (gameCard.isFaceDown()) {
if (gameCard.hideInfo()) {
return;
}
data.component = this;
callback.mouseWheelMoved(e, data);
}
}

View file

@ -83,7 +83,7 @@ public class ImageCache {
info.setToken(true);
path = CardImageUtils.generateTokenImagePath(info);
if (path == null) {
path = DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.tokenFrameFilename;
path = DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename;
}
} else {
path = CardImageUtils.generateImagePath(info);
@ -180,21 +180,21 @@ public class ImageCache {
return getImage(key);
}
/**
* Returns the Image corresponding to the Path
*/
private static BufferedImage getImageByPath(String path) {
if (path == null) {
return null;
}
TFile file = new TFile(path);
if (!file.exists()) {
log.warn("File does not exist: " + file.toString());
return null;
}
return getWizardsCard(loadImage(file));
}
// /**
// * Returns the Image corresponding to the Path
// */
// private static BufferedImage getImageByPath(String path) {
// if (path == null) {
// return null;
// }
// TFile file = new TFile(path);
// if (!file.exists()) {
// log.warn("File does not exist: " + file.toString());
// return null;
// }
// return getWizardsCard(loadImage(file));
//
// }
/**
* Returns the Image corresponding to the key

View file

@ -9,11 +9,12 @@ import org.mage.plugins.card.properties.SettingsManager;
public class CardImageUtils {
private static HashMap<CardDownloadData, String> pathCache = new HashMap<CardDownloadData, String>();
private static final HashMap<CardDownloadData, String> pathCache = new HashMap<>();
/**
*
* @param card
* @return String if image exists, else null
*/
public static String generateTokenImagePath(CardDownloadData card) {