public static void Draw(LayerInfo layer) { // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '┌', TopChar = '─', // 196 LeftChar = '│' // 179 }); const char hpSymbol = '*'; int drawY = 0; foreach (Actor.Actor actor in Game.MapHandler.Units.Values) { if (Game.MapHandler.Field[actor.Pos].IsVisible && !(actor is Pillar)) { Terminal.Color(actor.Color); layer.Put(0, drawY, actor.Symbol); Terminal.Color(Swatch.DbBlood); for (int n = 0; n < actor.Health; n++) { layer.Put(2 + n, drawY, hpSymbol); } Terminal.Color(Swatch.DbMetal); for (int n = actor.Health; n < actor.MaxHealth; n++) { layer.Put(2 + n, drawY, hpSymbol); } drawY++; } } }
public static void Draw(LayerInfo layer) { // draw borders, right border will be fixed at the end Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '├', BottomLeftChar = '┴', TopChar = '─', BottomChar = '─', LeftChar = '│' }); const int boxWidth = 7; int casting = -1; Game.StateHandler.Peek().MatchSome(state => { if (state is TargettingState targetting) { casting = targetting.CurrentSpell; } }); for (int x = 0; x < Constants.MAX_SPELLS; x++) { int startX = boxWidth * x; int endX = boxWidth * (x + 1) - 1; if (x < Game.Player.SpellList.Count) { ISpell spell = Game.Player.SpellList[x]; (int minMainCost, int maxMainCost) = spell.Cost.MainCost; int minAltCost = spell.Cost.AltCost.Item1; Terminal.Color(casting == x ? Colors.HighlightColor : Colors.Text); string firstLine = $"{(char)(x + '1')} {spell.Abbrev}"; firstLine += spell.Abbrev.Length == 1 ? " " : " "; firstLine += spell.Charges > 0 ? spell.Charges.ToString() : "-"; layer.Print( new Rectangle(startX, 0, boxWidth - 1, 1), firstLine, ContentAlignment.TopLeft); DisplayManaCost(layer, startX, 1, spell.Cost.MainElem.Color(), spell.Cost.MainCost, spell.Cost.MainManaUsed()); DisplayManaCost(layer, startX, 2, spell.Cost.AltElem.Color(), spell.Cost.AltCost, spell.Cost.AltManaUsed()); } else { Terminal.Color(Colors.Text); Terminal.Font("text"); layer.Put(startX, 0, x + '1'); Terminal.Font(""); } Terminal.Color(Colors.BorderColor); for (int y = 0; y < layer.Height; y++) { layer.Put(endX, y, '║'); } layer.Put(endX, -1, '╥'); layer.Put(endX, layer.Height, '╨'); } // fix right border for (int y = 0; y < layer.Height; y++) { layer.Put(layer.Width, y, '│'); } layer.Put(layer.Width, -1, '┤'); layer.Put(layer.Width, layer.Height, '┘'); }