Fix handling of effect card

This commit is contained in:
drdev
2014-06-27 02:04:16 +00:00
parent 269be19ef8
commit 0fd838a2e9
3 changed files with 13 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ public class CardRenderer {
return FSkinColor.fromRGB(detailColor.r, detailColor.g, detailColor.b); return FSkinColor.fromRGB(detailColor.r, detailColor.g, detailColor.b);
} }
public static void drawZoom(Graphics g, Card card, float width, float height) { public static boolean drawZoom(Graphics g, Card card, float width, float height) {
float w = width - 2 * FDialog.INSETS; float w = width - 2 * FDialog.INSETS;
float h = height - 2 * FDialog.INSETS; float h = height - 2 * FDialog.INSETS;
@@ -64,6 +64,8 @@ public class CardRenderer {
key = ImageKeys.TOKEN_PREFIX + ImageKeys.MORPH_IMAGE; key = ImageKeys.TOKEN_PREFIX + ImageKeys.MORPH_IMAGE;
} }
Texture image = ImageCache.getImage(key, true); Texture image = ImageCache.getImage(key, true);
if (image == null || image == ImageCache.defaultImage) { return false; } //don't support drawing zoom for null or default textures
float imageWidth = image.getWidth(); float imageWidth = image.getWidth();
float imageHeight = image.getHeight(); float imageHeight = image.getHeight();
@@ -92,6 +94,7 @@ public class CardRenderer {
} }
g.drawImage(image, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight); g.drawImage(image, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight);
return true;
} }
public static void drawDetails(Graphics g, Card card, float width, float height) { public static void drawDetails(Graphics g, Card card, float width, float height) {
@@ -449,7 +452,12 @@ public class CardRenderer {
public static void drawCardWithOverlays(Graphics g, Card card, float x, float y, float w, float h) { public static void drawCardWithOverlays(Graphics g, Card card, float x, float y, float w, float h) {
Texture image = ImageCache.getImage(card); Texture image = ImageCache.getImage(card);
g.drawImage(image, x, y, w, h); if (image != null) {
g.drawImage(image, x, y, w, h);
}
else { //draw cards without textures as just a black rectangle
g.fillRect(Color.BLACK, x, y, w, h);
}
boolean canShow = FControl.mayShowCard(card); boolean canShow = FControl.mayShowCard(card);
if (canShow) { if (canShow) {

View File

@@ -67,7 +67,9 @@ public class CardZoom extends FOverlay {
//draw zoom/details options //draw zoom/details options
FSkinColor foreColor; FSkinColor foreColor;
if (zoomMode) { if (zoomMode) {
CardRenderer.drawZoom(g, card, w, y); if (!CardRenderer.drawZoom(g, card, w, y)) {
CardRenderer.drawDetails(g, card, w, y); //draw details if can't draw zoom
}
g.fillRect(FList.PRESSED_COLOR, 0, y, x, h); g.fillRect(FList.PRESSED_COLOR, 0, y, x, h);
foreColor = FList.FORE_COLOR; foreColor = FList.FORE_COLOR;
} }

View File

@@ -572,7 +572,6 @@ public class ConstructedScreen extends LaunchScreen {
//disable team combo boxes for now //disable team combo boxes for now
cbTeam.setEnabled(false); cbTeam.setEnabled(false);
cbArchenemyTeam.setEnabled(false);
} }
@Override @Override