private static void DrawCosts( PdfFont boldFont, DominionCard card, Rectangle rectangle, PdfCanvas canvas, Cursor topCursor) { const float firstCostImageHeightOffset = 3f; topCursor.AdvanceCursor(-firstCostImageHeightOffset); const float costPadding = 1f; var hasAnyCoinCost = !string.IsNullOrWhiteSpace(card.Cost); var hasZeroCoinCost = card.Cost == "0"; var hasPotionCost = card.Potcost == 1; var hasDebtCost = card.Debtcost.HasValue; var hasAnyCost = hasAnyCoinCost || hasPotionCost || hasDebtCost; var hasOnlyZeroCoinCost = hasZeroCoinCost && !hasPotionCost && !hasDebtCost; if (hasAnyCoinCost && (!hasZeroCoinCost || hasOnlyZeroCoinCost)) { DrawCost(boldFont, rectangle, canvas, topCursor, card.Cost, costPadding); } if (hasPotionCost) { DrawPotionCost(rectangle, canvas, topCursor, costPadding); } if (hasDebtCost) { DrawDebtCost(boldFont, rectangle, canvas, topCursor, card.Debtcost, costPadding); } if (!hasAnyCost) { topCursor.AdvanceCursor(-4f); } }
private static DominionCard CreateDominionCard( CardSet cardSet, IList <CardSuperType> cardSuperTypes, DominionCard baseCard, IDictionary <string, DominionCard> englishCards) { var superType = cardSuperTypes.First(cardSuperType => cardSuperType.Card_type.OrderBy(i => i).SequenceEqual(baseCard.Types.OrderBy(i => i))); var hasGroupTag = !string.IsNullOrWhiteSpace(baseCard.Group_tag); var cost = !hasGroupTag || baseCard.Group_top ? baseCard.Cost : ""; return(new DominionCard { Group_tag = baseCard.Group_tag, Types = baseCard.Types, Name = FormatName(englishCards[baseCard.Card_tag].Name), Card_tag = baseCard.Card_tag, Cardset_tags = baseCard.Cardset_tags, GroupName = !hasGroupTag ? null : FormatName(englishCards[baseCard.Group_tag].Name), Group_top = baseCard.Group_top, Cost = cost, Debtcost = baseCard.Debtcost, Potcost = baseCard.Potcost, Set = cardSet, SuperType = superType }); }
private static void DrawCosts(BaseFont boldBaseFont, DominionCard card, Rectangle rectangle, PdfContentByte canvas, Cursor topCursor) { const float firstCostImageHeightOffset = 3f; topCursor.AdvanceCursor(-firstCostImageHeightOffset); const float costPadding = 1f; if (!string.IsNullOrWhiteSpace(card.Cost) && (card.Cost != "0" || (card.Cost == "0" && card.Potcost != 1 && !card.Debtcost.HasValue))) { DrawCost(boldBaseFont, rectangle, canvas, topCursor, card.Cost, costPadding); } if (card.Potcost == 1) { DrawPotionCost(rectangle, canvas, topCursor, costPadding); } if (card.Debtcost.HasValue) { DrawDebtCost(boldBaseFont, rectangle, canvas, topCursor, card.Debtcost, costPadding); } }