From a5683d4f12472d5b12a952639e3f035f3e230cc1 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 14 Mar 2020 03:02:15 +0800 Subject: [PATCH 1/3] Adjust Card Name & Ability Icons Ordering --- .../src/forge/assets/ImageCache.java | 9 +- .../src/forge/card/CardRenderer.java | 155 +++++------------- forge-gui-mobile/src/forge/card/CardZoom.java | 2 +- 3 files changed, 49 insertions(+), 117 deletions(-) diff --git a/forge-gui-mobile/src/forge/assets/ImageCache.java b/forge-gui-mobile/src/forge/assets/ImageCache.java index 74f904e34ac..70919ec452b 100644 --- a/forge-gui-mobile/src/forge/assets/ImageCache.java +++ b/forge-gui-mobile/src/forge/assets/ImageCache.java @@ -164,7 +164,7 @@ public class ImageCache { } return image; } - public static void preloadCache(Iterable keys) { + public static void preloadCache(Iterable keys) { cache.getAll(keys); } public static TextureRegion croppedBorderImage(Texture image, boolean fullborder) { @@ -173,10 +173,9 @@ public class ImageCache { float rscale = 0.96f; int rw = Math.round(image.getWidth()*rscale); int rh = Math.round(image.getHeight()*rscale); - int rx = Math.round((image.getWidth() - rw)/2); - int ry = Math.round((image.getHeight() - rh)/2)-2; - TextureRegion rimage = new TextureRegion(image, rx, ry, rw, rh); - return rimage; + int rx = Math.round((image.getWidth() - rw)/2f); + int ry = Math.round((image.getHeight() - rh)/2f)-2; + return new TextureRegion(image, rx, ry, rw, rh); } public static boolean isWhiteBordered(IPaperCard c) { if (c == null) diff --git a/forge-gui-mobile/src/forge/card/CardRenderer.java b/forge-gui-mobile/src/forge/card/CardRenderer.java index 6dcc0c48681..a93d95ab2ea 100644 --- a/forge-gui-mobile/src/forge/card/CardRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardRenderer.java @@ -555,31 +555,7 @@ public class CardRenderer { Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b); color = FSkinColor.tintColor(Color.WHITE, color, CardRenderer.PT_BOX_TINT); - //draw name and mana cost overlays if card is small or default card image being used - if (h <= NAME_COST_THRESHOLD && canShow) { - if (showCardNameOverlay(card)) { - g.drawOutlinedText(CardTranslation.getTranslatedName(details.getName()), FSkinFont.forHeight(h * 0.15f), Color.WHITE, Color.BLACK, x + padding -1f, y + padding, w - 2 * padding, h * 0.4f, true, Align.left, false); - } - if (showCardManaCostOverlay(card)) { - float manaSymbolSize = w / 4.5f; - if (card.isSplitCard() && card.hasAlternateState()) { - if (!card.isFaceDown()) { // no need to draw mana symbols on face down split cards (e.g. manifested) - float dy = manaSymbolSize / 2 + Utils.scale(5); - - PaperCard pc = StaticData.instance().getCommonCards().getCard(card.getName()); - if (Card.getCardForUi(pc).hasKeyword(Keyword.AFTERMATH)){ - dy *= -1; // flip card costs for Aftermath cards - } - - drawManaCost(g, card.getAlternateState().getManaCost(), x - padding, y - dy, w + 2 * padding, h, manaSymbolSize); - drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize); - } - } - else { - drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize); - } - } - } + //card name && manacost original position is here moved at the bottom... if (pos == CardStackPosition.BehindVert) { return; } //remaining rendering not needed if card is behind another card in a vertical stack boolean onTop = (pos == CardStackPosition.Top); @@ -656,6 +632,7 @@ public class CardRenderer { float abiSpace = cw / 5.7f; float abiCount = 0; + if (unselectable){ g.setAlphaComposite(0.6f); } if (onbattlefield && onTop && showAbilityIcons(card)) { if (card.isToken()){ CardFaceSymbols.drawSymbol("token", g, abiX, abiY, abiScale, abiScale); @@ -664,85 +641,63 @@ public class CardRenderer { } if (card.getCurrentState().hasFlying()) { CardFaceSymbols.drawSymbol("flying", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasHaste()) { CardFaceSymbols.drawSymbol("haste", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasDoubleStrike()) { CardFaceSymbols.drawSymbol("doublestrike", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().hasFirstStrike()) { CardFaceSymbols.drawSymbol("firststrike", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasDeathtouch()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("deathtouch", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasIndestructible()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("indestructible", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasMenace()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("menace", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasFear()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("fear", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasIntimidate()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("intimidate", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasShadow()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("shadow", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasHorsemanship()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("horsemanship", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } @@ -753,57 +708,41 @@ public class CardRenderer { List listHK = Arrays.asList(splitK); if (listHK.contains("generic")) { CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (listHK.contains("R")) { CardFaceSymbols.drawSymbol("hexproofR", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (listHK.contains("B")) { CardFaceSymbols.drawSymbol("hexproofB", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (listHK.contains("U")) { CardFaceSymbols.drawSymbol("hexproofU", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (listHK.contains("G")) { CardFaceSymbols.drawSymbol("hexproofG", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (listHK.contains("W")) { CardFaceSymbols.drawSymbol("hexproofW", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (listHK.contains("monocolored")) { CardFaceSymbols.drawSymbol("hexproofC", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } } else { CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } @@ -811,48 +750,36 @@ public class CardRenderer { else if (card.getCurrentState().hasShroud()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("shroud", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasVigilance()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("vigilance", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasTrample()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("trample", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasReach()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("reach", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasLifelink()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("lifelink", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } if (card.getCurrentState().hasDefender()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("defender", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } @@ -861,132 +788,138 @@ public class CardRenderer { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } if (card.getCurrentState().getProtectionKey().contains("everything") || card.getCurrentState().getProtectionKey().contains("allcolors")) { CardFaceSymbols.drawSymbol("protectAll", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().contains("coloredspells")) { CardFaceSymbols.drawSymbol("protectColoredSpells", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("R")) { CardFaceSymbols.drawSymbol("protectR", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("G")) { CardFaceSymbols.drawSymbol("protectG", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("B")) { CardFaceSymbols.drawSymbol("protectB", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("U")) { CardFaceSymbols.drawSymbol("protectU", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("W")) { CardFaceSymbols.drawSymbol("protectW", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("RG")||card.getCurrentState().getProtectionKey().equals("GR")) { CardFaceSymbols.drawSymbol("protectRG", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("RB")||card.getCurrentState().getProtectionKey().equals("BR")) { CardFaceSymbols.drawSymbol("protectRB", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("RU")||card.getCurrentState().getProtectionKey().equals("UR")) { CardFaceSymbols.drawSymbol("protectRU", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("RW")||card.getCurrentState().getProtectionKey().equals("WR")) { CardFaceSymbols.drawSymbol("protectRW", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("GB")||card.getCurrentState().getProtectionKey().equals("BG")) { CardFaceSymbols.drawSymbol("protectGB", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("GU")||card.getCurrentState().getProtectionKey().equals("UG")) { CardFaceSymbols.drawSymbol("protectGU", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("GW")||card.getCurrentState().getProtectionKey().equals("WG")) { CardFaceSymbols.drawSymbol("protectGW", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("BU")||card.getCurrentState().getProtectionKey().equals("UB")) { CardFaceSymbols.drawSymbol("protectBU", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("BW")||card.getCurrentState().getProtectionKey().equals("WB")) { CardFaceSymbols.drawSymbol("protectBW", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().equals("UW")||card.getCurrentState().getProtectionKey().equals("WU")) { CardFaceSymbols.drawSymbol("protectUW", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } else if (card.getCurrentState().getProtectionKey().contains("generic") || card.getCurrentState().getProtectionKey().length() > 2) { CardFaceSymbols.drawSymbol("protectGeneric", g, abiX, abiY, abiScale, abiScale); - if (unselectable){ - g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} abiY += abiSpace; abiCount += 1; } } } + //draw name and mana cost overlays if card is small or default card image being used + if (h <= NAME_COST_THRESHOLD && canShow) { + if (showCardNameOverlay(card)) { + float multiplier; + switch (Forge.extrawide) { + case "default": + multiplier = 0.145f; //good for tablets with 16:10 or similar + break; + case "wide": + multiplier = 0.150f; + break; + case "extrawide": + multiplier = 0.155f; //good for tall phones with 21:9 or similar + break; + default: + multiplier = 0.150f; + break; + } + g.drawOutlinedText(CardTranslation.getTranslatedName(details.getName()), FSkinFont.forHeight(h * multiplier), Color.WHITE, Color.BLACK, x + padding -1f, y + padding, w - 2 * padding, h * 0.4f, true, Align.left, false); + } + if (showCardManaCostOverlay(card)) { + float manaSymbolSize = w / 4.5f; + if (card.isSplitCard() && card.hasAlternateState()) { + if (!card.isFaceDown()) { // no need to draw mana symbols on face down split cards (e.g. manifested) + float dy = manaSymbolSize / 2 + Utils.scale(5); + + PaperCard pc = StaticData.instance().getCommonCards().getCard(card.getName()); + if (Card.getCardForUi(pc).hasKeyword(Keyword.AFTERMATH)){ + dy *= -1; // flip card costs for Aftermath cards + } + + drawManaCost(g, card.getAlternateState().getManaCost(), x - padding, y - dy, w + 2 * padding, h, manaSymbolSize); + drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize); + } + } + else { + drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize); + } + } + } + //reset alpha + g.setAlphaComposite(oldAlpha); } private static void drawCounterTabs(final CardView card, final Graphics g, final float x, final float y, final float w, final float h) { diff --git a/forge-gui-mobile/src/forge/card/CardZoom.java b/forge-gui-mobile/src/forge/card/CardZoom.java index 72d7d7c978f..2eea37d2ec6 100644 --- a/forge-gui-mobile/src/forge/card/CardZoom.java +++ b/forge-gui-mobile/src/forge/card/CardZoom.java @@ -219,7 +219,7 @@ public class CardZoom extends FOverlay { float w = getWidth(); float h = getHeight(); float messageHeight = FDialog.MSG_HEIGHT; - float AspectRatioMultiplier = 2; + float AspectRatioMultiplier; switch (Forge.extrawide) { case "default": AspectRatioMultiplier = 3; //good for tablets with 16:10 or similar From d7e38f7fd8fba03eb1cc87e95a3c51dce6e38020 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 14 Mar 2020 03:05:29 +0800 Subject: [PATCH 2/3] Format Stack Text (Should be cleaner) --- .../src/forge/screens/match/views/VStack.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/forge-gui-mobile/src/forge/screens/match/views/VStack.java b/forge-gui-mobile/src/forge/screens/match/views/VStack.java index 7d9c5639694..ac4fe11e692 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VStack.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VStack.java @@ -40,6 +40,7 @@ import forge.toolbox.FEvent; import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FLabel; import forge.util.Localizer; +import forge.util.TextUtil; import forge.util.collect.FCollectionView; import forge.util.Utils; @@ -372,12 +373,35 @@ public class VStack extends FDropDown { x += PADDING; y += PADDING; - CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top); + CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.BehindVert); x += CARD_WIDTH + PADDING; w -= x + PADDING - BORDER_THICKNESS; h -= y + PADDING - BORDER_THICKNESS; - textRenderer.drawText(g, text, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + + String name = stackInstance.getSourceCard().getName(); + int index = text.indexOf(name); + String newtext = ""; + String cId = "(" + stackInstance.getSourceCard().getId() + ")"; + + if (index == -1) { + newtext = TextUtil.fastReplace(TextUtil.fastReplace(text.trim(),"--","-"),"- -","-"); + textRenderer.drawText(g, name + " " + (name.length() > 1 ? cId : "") + "\n" + (newtext.length() > 1 ? newtext : ""), + FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + + } else { + String trimFirst = TextUtil.fastReplace("\n" + text.substring(0, index) + text.substring(index + name.length()), "- -", "-"); + String trimSecond = TextUtil.fastReplace(trimFirst, name+" "+cId, name); + newtext = TextUtil.fastReplace(trimSecond, " "+cId, name); + + if(newtext.equals("\n"+name)) + textRenderer.drawText(g, name + " " + cId, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + else { + newtext = TextUtil.fastReplace(TextUtil.fastReplace(newtext,name+" -","-"), "\n ", "\n"); + newtext = "\n"+ TextUtil.fastReplace(newtext.trim(),"--","-"); + textRenderer.drawText(g, name+" "+cId+newtext, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + } + } g.endClip(); From a1be9d02783211cd035700586589261af1a27427 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 14 Mar 2020 13:34:31 +0800 Subject: [PATCH 3/3] Fix Inventory View for Cards without Card Image --- forge-gui-mobile/src/forge/card/CardRenderer.java | 5 +++++ forge-gui-mobile/src/forge/screens/match/views/VStack.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/forge-gui-mobile/src/forge/card/CardRenderer.java b/forge-gui-mobile/src/forge/card/CardRenderer.java index a93d95ab2ea..d4a04841adc 100644 --- a/forge-gui-mobile/src/forge/card/CardRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardRenderer.java @@ -535,6 +535,9 @@ public class CardRenderer { } public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) { + drawCardWithOverlays(g, card, x, y, w, h, pos, false); + } + public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean stackview) { boolean canShow = MatchController.instance.mayView(card); float oldAlpha = g.getfloatAlphaComposite(); boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting(); @@ -557,6 +560,8 @@ public class CardRenderer { //card name && manacost original position is here moved at the bottom... + if (stackview) + return; //override if (pos == CardStackPosition.BehindVert) { return; } //remaining rendering not needed if card is behind another card in a vertical stack boolean onTop = (pos == CardStackPosition.Top); diff --git a/forge-gui-mobile/src/forge/screens/match/views/VStack.java b/forge-gui-mobile/src/forge/screens/match/views/VStack.java index ac4fe11e692..8f83fef3035 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VStack.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VStack.java @@ -373,7 +373,7 @@ public class VStack extends FDropDown { x += PADDING; y += PADDING; - CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.BehindVert); + CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top, true); x += CARD_WIDTH + PADDING; w -= x + PADDING - BORDER_THICKNESS;