public CardRedrawContainer(Card source) { _source = source; _rarityColor = UtilsDrawing.please.getClosestFore(UtilsDrawing.colorOfRarity(source.rarity)); _isUnit = _source as Unit != null; _position = new Point(0, 0); // provide a connection to source card source._show = this; }
public static void PreviewCard(Card card, ConsoleWindowText window) { window.ClearLogWindow(); if (card == null) { return; } var cardLines = (previewType == PreviewType.inGame ? card.ToFormat() : card.ToFormatCollection()).Split('\n'); var clanColor = UtilsDrawing.please.getClosest(UtilsDrawing.colorsOfClan(card.clan)); int wid = window.Width; string border = borderSymbols.Substring(0, wid), borderCap = borderSymbols.Substring(0, (wid - cardLines[0].Length) / 2 - 1); bool needOneExtra = (wid - cardLines[0].Length) % 2 == 1; ConsoleColor b = (ConsoleColor)clanColor._back, f = (ConsoleColor)clanColor._fore, fR = UtilsDrawing.please.getClosestFore(UtilsDrawing.colorOfRarity(card.rarity)); bool isDescrip = false; for (int i = -1; i < cardLines.Length; ++i) { if (i < 0 || i == 1) { window.AddLog(border, f, b); //borders } else if (i == 0) { window.AddLog(String.Format("{1} {0} {1}{2}", cardLines[i], borderCap, needOneExtra ? ("" + borderCap[0]) : ""), fR, b); //name } else { if (cardLines[i].Length > 0 && cardLines[i][0] == '_') { isDescrip = true; } window.AddLog(cardLines[i], isDescrip ? ConsoleColor.DarkRed : ConsoleColor.Gray); } //parameters } }