mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
GUI: Improved rendering of Class cards (#11767)
This commit is contained in:
parent
506e94d519
commit
41dbec4dbd
4 changed files with 36 additions and 19 deletions
|
|
@ -430,6 +430,15 @@ public class TestCardRenderDialog extends MageDialog {
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "155")); // Case of the Locked Hothouse
|
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "155")); // Case of the Locked Hothouse
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
|
//* test case, class and saga cards in hands
|
||||||
|
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "113")); // Case of the Burning Masks
|
||||||
|
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "155")); // Case of the Locked Hothouse
|
||||||
|
cardViews.add(createHandCard(game, playerYou.getId(), "AFR", "6")); // Cleric Class
|
||||||
|
cardViews.add(createHandCard(game, playerYou.getId(), "AFR", "230")); // Rogue Class
|
||||||
|
cardViews.add(createHandCard(game, playerYou.getId(), "DOM", "90")); // The Eldest Reborn
|
||||||
|
cardViews.add(createHandCard(game, playerYou.getId(), "MH2", "259")); // Urza's Saga
|
||||||
|
//*/
|
||||||
|
|
||||||
/* test meld cards in hands and battlefield
|
/* test meld cards in hands and battlefield
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "EMN", "204")); // Hanweir Battlements
|
cardViews.add(createHandCard(game, playerYou.getId(), "EMN", "204")); // Hanweir Battlements
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "EMN", "130a")); // Hanweir Garrison
|
cardViews.add(createHandCard(game, playerYou.getId(), "EMN", "130a")); // Hanweir Garrison
|
||||||
|
|
|
||||||
|
|
@ -337,12 +337,11 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
rect = new Rectangle2D.Float(.079f, .11f, .84f, .84f);
|
rect = new Rectangle2D.Float(.079f, .11f, .84f, .84f);
|
||||||
} else if (isUnstableFullArtLand()) {
|
} else if (isUnstableFullArtLand()) {
|
||||||
rect = new Rectangle2D.Float(.0f, .0f, 1.0f, 1.0f);
|
rect = new Rectangle2D.Float(.0f, .0f, 1.0f, 1.0f);
|
||||||
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_LEFT ||
|
||||||
|
cardView.getArtRect() == ArtRect.FULL_LENGTH_RIGHT) {
|
||||||
|
rect = cardView.getArtRect().rect;
|
||||||
} else if (cardView.getFrameStyle().isFullArt() || (cardView.isToken())) {
|
} else if (cardView.getFrameStyle().isFullArt() || (cardView.isToken())) {
|
||||||
rect = new Rectangle2D.Float(.079f, .11f, .84f, .63f);
|
rect = new Rectangle2D.Float(.079f, .11f, .84f, .63f);
|
||||||
} else if (cardView.getSubTypes().contains(SubType.SAGA)) {
|
|
||||||
rect = ArtRect.SAGA.rect;
|
|
||||||
} else if (cardView.getSubTypes().contains(SubType.CASE)) {
|
|
||||||
rect = ArtRect.CASE.rect;
|
|
||||||
} else {
|
} else {
|
||||||
rect = ArtRect.NORMAL.rect;
|
rect = ArtRect.NORMAL.rect;
|
||||||
}
|
}
|
||||||
|
|
@ -354,8 +353,8 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
return TYPE_LINE_Y_FRAC_TOKEN;
|
return TYPE_LINE_Y_FRAC_TOKEN;
|
||||||
} else if (cardView.getFrameStyle().isFullArt()) {
|
} else if (cardView.getFrameStyle().isFullArt()) {
|
||||||
return TYPE_LINE_Y_FRAC_FULL_ART;
|
return TYPE_LINE_Y_FRAC_FULL_ART;
|
||||||
} else if (cardView.getSubTypes().contains(SubType.SAGA) ||
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_LEFT ||
|
||||||
cardView.getSubTypes().contains(SubType.CASE)) {
|
cardView.getArtRect() == ArtRect.FULL_LENGTH_RIGHT) {
|
||||||
return TYPE_LINE_Y_FRAC_BOTTOM;
|
return TYPE_LINE_Y_FRAC_BOTTOM;
|
||||||
} else {
|
} else {
|
||||||
return TYPE_LINE_Y_FRAC;
|
return TYPE_LINE_Y_FRAC;
|
||||||
|
|
@ -429,12 +428,12 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
contentWidth - 2, typeLineY - totalContentInset - boxHeight,
|
contentWidth - 2, typeLineY - totalContentInset - boxHeight,
|
||||||
alternate_height,
|
alternate_height,
|
||||||
sourceRect, shouldPreserveAspect);
|
sourceRect, shouldPreserveAspect);
|
||||||
} else if (cardView.getSubTypes().contains(SubType.SAGA)) {
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_RIGHT) {
|
||||||
drawArtIntoRect(g,
|
drawArtIntoRect(g,
|
||||||
contentWidth / 2 + totalContentInset + 1, totalContentInset + boxHeight,
|
contentWidth / 2 + totalContentInset + 1, totalContentInset + boxHeight,
|
||||||
contentWidth / 2 - 1, typeLineY - totalContentInset - boxHeight,
|
contentWidth / 2 - 1, typeLineY - totalContentInset - boxHeight,
|
||||||
sourceRect, false);
|
sourceRect, false);
|
||||||
} else if (cardView.getSubTypes().contains(SubType.CASE)) {
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_LEFT) {
|
||||||
drawArtIntoRect(g,
|
drawArtIntoRect(g,
|
||||||
totalContentInset + 1, totalContentInset + boxHeight,
|
totalContentInset + 1, totalContentInset + boxHeight,
|
||||||
contentWidth / 2 - 1, typeLineY - totalContentInset - boxHeight,
|
contentWidth / 2 - 1, typeLineY - totalContentInset - boxHeight,
|
||||||
|
|
@ -489,10 +488,10 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
g.setPaint(textboxPaint);
|
g.setPaint(textboxPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cardView.getSubTypes().contains(SubType.SAGA)) {
|
if (cardView.getArtRect() == ArtRect.FULL_LENGTH_RIGHT) {
|
||||||
g.fillRect(totalContentInset + 2, totalContentInset + boxHeight,
|
g.fillRect(totalContentInset + 2, totalContentInset + boxHeight,
|
||||||
contentWidth / 2 - 2, typeLineY - totalContentInset - boxHeight + 2);
|
contentWidth / 2 - 2, typeLineY - totalContentInset - boxHeight + 2);
|
||||||
} else if (cardView.getSubTypes().contains(SubType.CASE)) {
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_LEFT) {
|
||||||
g.fillRect(contentWidth / 2 + totalContentInset + 1, totalContentInset + boxHeight,
|
g.fillRect(contentWidth / 2 + totalContentInset + 1, totalContentInset + boxHeight,
|
||||||
contentWidth / 2 - 2, typeLineY - totalContentInset - boxHeight + 2);
|
contentWidth / 2 - 2, typeLineY - totalContentInset - boxHeight + 2);
|
||||||
} else if (!isZenUst) {
|
} else if (!isZenUst) {
|
||||||
|
|
@ -690,11 +689,11 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
drawUSTCurves(g, image, x, y, w, h,
|
drawUSTCurves(g, image, x, y, w, h,
|
||||||
0, 0,
|
0, 0,
|
||||||
additionalBoxColor, borderPaint);
|
additionalBoxColor, borderPaint);
|
||||||
} else if (cardView.getSubTypes().contains(SubType.SAGA)) {
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_RIGHT) {
|
||||||
drawRulesText(g, textboxKeywords, textboxRules,
|
drawRulesText(g, textboxKeywords, textboxRules,
|
||||||
totalContentInset + 4, totalContentInset + boxHeight + 2,
|
totalContentInset + 4, totalContentInset + boxHeight + 2,
|
||||||
contentWidth / 2 - 8, typeLineY - totalContentInset - boxHeight - 6, false);
|
contentWidth / 2 - 8, typeLineY - totalContentInset - boxHeight - 6, false);
|
||||||
} else if (cardView.getSubTypes().contains(SubType.CASE)) {
|
} else if (cardView.getArtRect() == ArtRect.FULL_LENGTH_LEFT) {
|
||||||
drawRulesText(g, textboxKeywords, textboxRules,
|
drawRulesText(g, textboxKeywords, textboxRules,
|
||||||
contentWidth / 2 + totalContentInset + 4, totalContentInset + boxHeight + 2,
|
contentWidth / 2 + totalContentInset + 4, totalContentInset + boxHeight + 2,
|
||||||
contentWidth / 2 - 8, typeLineY - totalContentInset - boxHeight - 6, false);
|
contentWidth / 2 - 8, typeLineY - totalContentInset - boxHeight - 6, false);
|
||||||
|
|
|
||||||
|
|
@ -536,7 +536,6 @@ public class CardView extends SimpleCardView {
|
||||||
// Determine what part of the art to slice out for spells on the stack which originate
|
// Determine what part of the art to slice out for spells on the stack which originate
|
||||||
// from a split, fuse, or aftermath split card.
|
// from a split, fuse, or aftermath split card.
|
||||||
// Modal double faces cards draws as normal cards
|
// Modal double faces cards draws as normal cards
|
||||||
// Sagas and cases have completely different layouts
|
|
||||||
SpellAbilityType ty = spell.getSpellAbility().getSpellAbilityType();
|
SpellAbilityType ty = spell.getSpellAbility().getSpellAbilityType();
|
||||||
if (ty == SpellAbilityType.SPLIT_RIGHT || ty == SpellAbilityType.SPLIT_LEFT || ty == SpellAbilityType.SPLIT_FUSED) {
|
if (ty == SpellAbilityType.SPLIT_RIGHT || ty == SpellAbilityType.SPLIT_LEFT || ty == SpellAbilityType.SPLIT_FUSED) {
|
||||||
// Needs a special art rect
|
// Needs a special art rect
|
||||||
|
|
@ -557,10 +556,6 @@ public class CardView extends SimpleCardView {
|
||||||
artRect = ArtRect.SPLIT_LEFT;
|
artRect = ArtRect.SPLIT_LEFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (spell.getSubtype().contains(SubType.SAGA)) {
|
|
||||||
artRect = ArtRect.SAGA;
|
|
||||||
} else if (spell.getSubtype().contains(SubType.CASE)) {
|
|
||||||
artRect = ArtRect.CASE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// show for modal spell, which mode was chosen
|
// show for modal spell, which mode was chosen
|
||||||
|
|
@ -589,6 +584,14 @@ public class CardView extends SimpleCardView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cases, classes and sagas have portrait art
|
||||||
|
if (card.getSubtype().contains(SubType.CASE) ||
|
||||||
|
card.getSubtype().contains(SubType.CLASS)) {
|
||||||
|
artRect = ArtRect.FULL_LENGTH_LEFT;
|
||||||
|
} else if (card.getSubtype().contains(SubType.SAGA)) {
|
||||||
|
artRect = ArtRect.FULL_LENGTH_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
// Frame color
|
// Frame color
|
||||||
this.frameColor = card.getFrameColor(game).copy();
|
this.frameColor = card.getFrameColor(game).copy();
|
||||||
|
|
||||||
|
|
@ -801,6 +804,12 @@ public class CardView extends SimpleCardView {
|
||||||
this.rules = new ArrayList<>();
|
this.rules = new ArrayList<>();
|
||||||
this.rules.add(stackAbility.getRule());
|
this.rules.add(stackAbility.getRule());
|
||||||
}
|
}
|
||||||
|
if (object.getSubtype().contains(SubType.CASE) ||
|
||||||
|
object.getSubtype().contains(SubType.CLASS)) {
|
||||||
|
artRect = ArtRect.FULL_LENGTH_LEFT;
|
||||||
|
} else if (object.getSubtype().contains(SubType.SAGA)) {
|
||||||
|
artRect = ArtRect.FULL_LENGTH_RIGHT;
|
||||||
|
}
|
||||||
// Frame color
|
// Frame color
|
||||||
this.frameColor = object.getFrameColor(game).copy();
|
this.frameColor = object.getFrameColor(game).copy();
|
||||||
// Frame style
|
// Frame style
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ public enum ArtRect {
|
||||||
SPLIT_LEFT(new Rectangle2D.Double(0.152, 0.539, 0.386, 0.400)),
|
SPLIT_LEFT(new Rectangle2D.Double(0.152, 0.539, 0.386, 0.400)),
|
||||||
SPLIT_RIGHT(new Rectangle2D.Double(0.152, 0.058, 0.386, 0.400)),
|
SPLIT_RIGHT(new Rectangle2D.Double(0.152, 0.058, 0.386, 0.400)),
|
||||||
SPLIT_FUSED(null),
|
SPLIT_FUSED(null),
|
||||||
SAGA(new Rectangle2D.Double(0.497, 0.11, 0.426, 0.727)),
|
FULL_LENGTH_LEFT(new Rectangle2D.Double(0.069, 0.11, 0.426, 0.727)),
|
||||||
CASE(new Rectangle2D.Double(0.069, 0.11, 0.426, 0.727));
|
FULL_LENGTH_RIGHT(new Rectangle2D.Double(0.497, 0.11, 0.426, 0.727));
|
||||||
|
|
||||||
public final Rectangle2D rect;
|
public final Rectangle2D rect;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue