update textbox tint

This commit is contained in:
Anthony Calosa
2021-08-21 14:20:47 +08:00
parent 2f78d910e1
commit b9205b4b1e
3 changed files with 58 additions and 2 deletions

View File

@@ -1360,6 +1360,21 @@ public class CardView extends GameEntityView {
public boolean isPlaneswalker() {
return getType().isPlaneswalker();
}
public boolean isMountain() {
return getType().hasSubtype("Mountain");
}
public boolean isPlains() {
return getType().hasSubtype("Plains");
}
public boolean isSwamp() {
return getType().hasSubtype("Swamp");
}
public boolean isForest() {
return getType().hasSubtype("Forest");
}
public boolean isIsland() {
return getType().hasSubtype("Island");
}
}
//special methods for updating card and player properties as needed and returning the new collection

View File

@@ -748,7 +748,29 @@ public class FCardImageRenderer {
private static void drawTextBox(Graphics2D g, CardStateView state, String text, Color[] colors,
int x, int y, int w, int h, int textBoxFlags) {
int yAdjust = (textBoxFlags >> 16);
fillColorBackground(g, colors, x, y + yAdjust, w, h - yAdjust);
if (state.isLand()) {
DetailColors modColors = DetailColors.WHITE;
if (state.isBasicLand()) {
if (state.isForest())
modColors = DetailColors.GREEN;
else if (state.isIsland())
modColors = DetailColors.BLUE;
else if (state.isMountain())
modColors = DetailColors.RED;
else if (state.isSwamp())
modColors = DetailColors.BLACK;
else if (state.isPlains())
modColors = DetailColors.LAND;
}
Color bgColor = fromDetailColor(modColors);
bgColor = tintColor(Color.WHITE, bgColor, NAME_BOX_TINT);
Paint oldPaint = g.getPaint();
g.setColor(bgColor);
g.fillRect(Math.round(x), Math.round(y), Math.round(w), Math.round(h));
g.setPaint(oldPaint);
} else {
fillColorBackground(g, colors, x, y + yAdjust, w, h - yAdjust);
}
g.setStroke(new BasicStroke(BOX_LINE_THICKNESS));
g.setColor(Color.BLACK);
g.drawRect(x, y, w, h);

View File

@@ -260,7 +260,26 @@ public class CardImageRenderer {
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
private static void drawTextBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean onTop) {
fillColorBackground(g, colors, x, y, w, h);
if (state.isLand()) {
DetailColors modColors = DetailColors.WHITE;
if (state.isBasicLand()) {
if (state.isForest())
modColors = DetailColors.GREEN;
else if (state.isIsland())
modColors = DetailColors.BLUE;
else if (state.isMountain())
modColors = DetailColors.RED;
else if (state.isSwamp())
modColors = DetailColors.BLACK;
else if (state.isPlains())
modColors = DetailColors.LAND;
}
Color bgColor = FSkinColor.fromRGB(modColors.r, modColors.g, modColors.b);
bgColor = FSkinColor.tintColor(Color.WHITE, bgColor, CardRenderer.NAME_BOX_TINT);
g.fillRect(bgColor, x, y, w, h);
} else {
fillColorBackground(g, colors, x, y, w, h);
}
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
if (!onTop) { return; } //remaining rendering only needed if card on top