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 void callAutoDraw(Player watcher) { if (!_doNotCleanLine) { _global.clearLine(_source.context.players.IndexOf(_source.host), _position.Y); } _global.setPosition(_position); if (_isSelected) { _global.swapColor(ConsoleColor.Black); } string shortName = _source.Show(watcher); if (shortName == Card.InvisibleCardString) { Console.Write(shortName); return; } // color a rarity only in case of card has been revealed _global.swapFontColor(_rarityColor); if (_isUnit) { int firstSpace = shortName.IndexOf(' '); Console.Write("["); _global.swapFontColor(UtilsDrawing.colorsOfPower(_source as Unit)); Console.Write(shortName.Substring(1, firstSpace - 1)); _global.popColor(); Console.Write(shortName.Substring(firstSpace)); } else { Console.Write(shortName); } _global.popColor(); if (_isSelected) { _global.popColor(); } }
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 } }