public void Draw(LayerInfo layer) { _map.Draw(layer); Terminal.Layer(layer.Z - 1); foreach (Loc point in _inRange) { Terminal.Color(Colors.TargetBackground); layer.Put(point.X - Camera.X, point.Y - Camera.Y, '█'); } foreach (Loc point in _targetted) { Terminal.Color(Colors.Target); layer.Put(point.X - Camera.X, point.Y - Camera.Y, '█'); } foreach (Loc point in _path) { Terminal.Color(Colors.Path); layer.Put(point.X - Camera.X, point.Y - Camera.Y, '█'); } Terminal.Color(Colors.Cursor); layer.Put(_cursor.X - Camera.X, _cursor.Y - Camera.Y, '█'); Terminal.Layer(layer.Z); }
public virtual void Draw(LayerInfo layer) { // highlight draw borders Terminal.Color(Colors.HighlightColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '╔', // 201 TopRightChar = '╗', // 187 BottomLeftChar = '╚', // 200 BottomRightChar = '╝', // 188 TopChar = '═', // 205 BottomChar = '═', LeftChar = '║', // 186 RightChar = '║' }); layer.Print(-1, $"{Constants.HEADER_LEFT}[color=white]INVENTORY{Constants.HEADER_SEP}" + $"[color=grass]EQUIPMENT[/color]{Constants.HEADER_RIGHT}"); Terminal.Color(Colors.RowHighlight); Terminal.Layer(layer.Z - 1); for (int x = 0; x < layer.Width; x++) { layer.Put(x, Line, '█'); } Terminal.Layer(layer.Z); Game.Player.Inventory.DrawSelected(layer, Selected); }
protected void DrawTile(LayerInfo layer, Color foreground, Color?background, bool visible, int x, int y) { int destX = x - Camera.X; int destY = y - Camera.Y; // don't draw out of bounds if (destX < 0 || destY < 0 || destX > layer.Width || destY > layer.Height) { return; } Terminal.Composition(true); if (background.HasValue) { Terminal.Color(background.Value); layer.Put(destX, destY, '█'); } if (visible) { Terminal.Color(foreground); layer.Put(destX, destY, Symbol); _rememberX = x; _rememberY = y; } else if (_remember) { Terminal.Color(foreground); layer.Put(_rememberX - Camera.X, _rememberY - Camera.Y, Symbol); } else { Terminal.Color(Colors.FloorBackground); layer.Put(destX, destY, '.'); } Terminal.Composition(false); }
public void Draw(LayerInfo layer) { int ticksRemaining = EventScheduler._schedule[this]; double fracProgress = (double)ticksRemaining / _delay; var color = Swatch.Compliment.Blend(Swatch.ComplimentLightest, fracProgress); Terminal.Color(color); Terminal.Composition(true); foreach (Loc loc in _attack.Targets) { layer.Put(loc.X - Camera.X, loc.Y - Camera.Y, '▓'); } Terminal.Composition(false); }
private static void DrawTileMap(LayerInfo layer, int x, int y, TileMap tileMap) { for (int ax = 0; ax < tileMap.Width; ax++) { for (int ay = 0; ay < tileMap.Height; ay++) { Tile tile = tileMap.Layers[0].Tiles[ay, ax]; var color = Color.FromArgb(tile.ForegroundRed, tile.ForegroundGreen, tile.ForegroundBlue); Terminal.Layer(1); Terminal.Color(color); layer.Put(x + ax, ay + y, CharUtils.ToUnicode(tile.CharacterCode)); } } }
public void Draw(LayerInfo layer) { Terminal.Color(Colors.Text); Terminal.Composition(true); for (int i = 0; i < layer.Width; i++) { for (int j = 0; j < layer.Height; j++) { int viewX = i + Camera.X; int viewY = j + Camera.Y; if (IsSet[viewX, viewY]) { Terminal.Color(TileColor[viewX, viewY]); layer.Put(i, j, '█'); } } } Terminal.Composition(false); }
public static void Draw(LayerInfo layer) { // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '┬', TopRightChar = '┐', BottomLeftChar = '├', BottomRightChar = '┘', TopChar = '─', // 196 BottomChar = '─', RightChar = '│' // 179 }); var map = Game.MapHandler; Loc midPos = Game.Player.Pos; const int scale = 5; int radius = layer.Width / 2 + 1; for (int rx = -radius; rx <= radius; rx++) { for (int ry = -radius; ry <= radius; ry++) { if (rx * rx + ry * ry >= radius * radius) { continue; } int topLeftX = midPos.X + rx * scale; int topLeftY = midPos.Y + ry * scale; char symbol = '#'; var color = Colors.Text; for (int i = 0; i < scale * scale; i++) { int subX = i % scale; int subY = i / scale; var pos = new Loc(topLeftX + subX, topLeftY + subY); if (!map.Field.IsValid(pos)) { continue; } if (map.Units.TryGetValue(map.ToIndex(pos), out BaseActor? actor)) { if (actor == Game.Player) { color = Colors.Player; symbol = '@'; break; } else { color = System.Drawing.Color.Red; symbol = actor.Symbol; break; } } // if there is at least one valid position, the symbol will be . instead of # symbol = '.'; } Terminal.Color(color); layer.Put(rx + radius - 1, ry + radius - 1, symbol); } } int y = layer.Width; Terminal.Color(Colors.BorderColor); layer.Print(y, "─────────────────"); }
public void Draw(LayerInfo layer) { // overworld map Terminal.Layer(2); layer.Print(1, 1, $"Overworld map"); Terminal.Layer(1); for (int i = 0; i < 95; i++) { for (int j = 0; j < 67; j++) { if (_perlinMap[i, j] < 0.37) { Terminal.Color(Color.Blue); } else { Terminal.Color(Color.Green); } char c; if (_perlinMap2[i, j] < 0.35) { c = ' '; } else if (_perlinMap2[i, j] < 0.4) { c = '░'; } else if (_perlinMap2[i, j] < 0.47) { c = '▒'; } else if (_perlinMap2[i, j] < 0.55) { c = '▓'; } else { c = '█'; } Terminal.Put(2 + i, 2 + j, c); } } // mission briefing int buttonBorderY = layer.Height - _bHeight - 5; int briefingBorderX = layer.Width - 40; Terminal.Color(Colors.Text); layer.Print(briefingBorderX + 1, 1, "Mission summary"); layer.Print(briefingBorderX + 1, 2, "───────────────"); string briefingString; if (Game.Difficulty >= 5) { briefingString = "The region is peaceful. Congratulations, you have won."; } else { briefingString = "Hostile forces have been detected in the region"; } layer.Print(new Rectangle(briefingBorderX + 2, 3, 39, 28), briefingString, ContentAlignment.TopLeft); layer.Print(briefingBorderX + 1, 30, "Objectives"); layer.Print(briefingBorderX + 1, 31, "──────────"); string objectiveString = "None"; switch (Game.NextMission.MissionType) { case MissionType.Elim: objectiveString = "Eliminate all enemies"; break; } ; if (Game.Difficulty >= 5) { objectiveString = "None"; } layer.Print(briefingBorderX + 2, 32, objectiveString); layer.Print(briefingBorderX + 1, 60, "Reward"); layer.Print(briefingBorderX + 1, 61, "──────"); if (Game.Difficulty >= 5) { layer.Print(briefingBorderX + 2, 62, $"None"); } else { int y = 62; if (Game.NextMission.RewardPart != null) { layer.Print(briefingBorderX + 2, y++, $"{Game.NextMission.RewardPart.Name}"); } if (Game.NextMission.RewardScrap > 0) { layer.Print(briefingBorderX + 2, y++, $"{Game.NextMission.RewardScrap} scrap"); } } // borders and buttons Terminal.Color(Colors.BorderColor); for (int dx = 1; dx < layer.Width - 1; dx++) { layer.Put(dx, buttonBorderY, '═'); } for (int dy = 1; dy < buttonBorderY; dy++) { layer.Put(briefingBorderX, dy, '║'); } layer.Put(briefingBorderX, buttonBorderY, '╩'); }
public static void Draw(LayerInfo layer) { // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '┌', BottomLeftChar = '└', BottomRightChar = '┴', TopChar = '─', // 196 BottomChar = '─', LeftChar = '│' // 179 }); var player = (Mech)Game.Player; int y = 1; Terminal.Color(Colors.Text); layer.Print(y, "The Pilot"); y += 2; Terminal.Color(golden); Terminal.Layer(1); DrawBar(layer, 0, y, layer.Width, 0, '░'); Terminal.Layer(2); layer.Print(y, "Energy"); y++; var ph = player.PartHandler; int coolBarLength = (int)(layer.Width * ph.Coolant / ph.GetMaxCoolant()); Terminal.Color(Color.LightSkyBlue); Terminal.Layer(1); DrawBar(layer, 0, y, coolBarLength, 0, '░'); Terminal.Layer(2); layer.Print(y, $"Coolant"); y++; Terminal.Color(Color.DarkOrange); Terminal.Layer(4); layer.Print(y, "Heat"); DrawHeatBar(layer, 4, y, player); y += 2; Terminal.Color(Colors.Text); foreach (Part p in player.PartHandler) { // Ignore weapons for now - we draw them with their weapon groups if (p.Has <ActivateComponent>()) { continue; } Terminal.Color(Colors.Text); Terminal.Layer(1); DrawBar(layer, 1, y, layer.Width - 1, 0, '░'); Terminal.Layer(2); layer.Print(1, y++, p.Name); y++; y = DrawPart(layer, y, p); y++; } y++; WeaponGroup wg = player.PartHandler.WeaponGroup; for (int i = 0; i < wg.Groups.Length; i++) { List <Part> group = wg.Groups[i]; if (group.Count == 0) { continue; } Terminal.Color(golden); layer.Print(y++, $"Weapon Group {i + 1}"); layer.Print(y++, $"────────────────────"); int currWeaponIndex = wg.NextIndex(i); for (int j = 0; j < group.Count; j++) { // TODO: it's possible to run out of space, in which case we would need scrolling // we just truncate and not worry about it for now if (y + 6 > layer.Height) { break; } Part p = group[j]; p.Get <ActivateComponent>().MatchSome(w => { double cooldown = layer.Width - layer.Width * w.CurrentCooldown / w.Cooldown; if (cooldown < 0) { cooldown = 0; } if (w.CurrentCooldown == 0) { Terminal.Color(brightGreen); } else { Terminal.Color(Color.LightGreen.Blend(Color.LightSalmon, 1 - cooldown / layer.Width)); } if (currWeaponIndex == j) { layer.Put(0, y, 0xE011); } Terminal.Layer(1); DrawBar(layer, 1, y, cooldown - 1, 0, '░'); Terminal.Layer(2); layer.Print(1, y++, p.Name); Terminal.Layer(1); y++; y = DrawPart(layer, y, p); y++; }); } } }
public static void Draw(LayerInfo layer) { // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '╤', // 209 TopRightChar = '╤', TopChar = '═', // 205 LeftChar = '│', // 179 RightChar = '│' }); Actor player = Game.Player; const int stepSize = 5; const int yPos = 0; string name = player.Name.ToUpper(); layer.Print(-1, $"{Constants.HEADER_LEFT}[color=white]{name}[/color]{Constants.HEADER_RIGHT}", System.Drawing.ContentAlignment.TopCenter); Terminal.Color(Colors.Text); Terminal.Composition(true); // HP bar int hpWidth = player.Parameters.MaxHp / stepSize; int hpFilled = hpWidth * player.Hp / player.Parameters.MaxHp; string health = $" {player.Hp}/{player.Parameters.MaxHp}"; Terminal.Color(Swatch.Compliment); for (int i = 0; i <= hpFilled; i++) { layer.Put(i, yPos, '█'); } Terminal.Color(Swatch.ComplimentDarkest); for (int i = hpFilled + 1; i <= hpWidth; i++) { layer.Put(i, yPos, '█'); } Terminal.Color(Colors.Text); layer.Print(yPos, health); // Armor int armorWidth = player.Armor / stepSize; Terminal.Color(Swatch.DbMetal); for (int i = 0; i <= armorWidth; i++) { layer.Put(i + hpWidth + 2, yPos, '█'); } // SP bar int spWidth = player.Parameters.MaxSp / stepSize; int spFilled = spWidth * player.Sp / player.Parameters.MaxSp; string stamina = $"{player.Sp}/{player.Parameters.MaxSp} "; Terminal.Color(Swatch.Secondary); for (int i = 0; i <= spFilled; i++) { layer.Put(layer.Width - i - 1, yPos, '█'); } Terminal.Color(Swatch.SecondaryDarkest); for (int i = spFilled + 1; i <= spWidth; i++) { layer.Put(layer.Width - i - 1, yPos, '█'); } Terminal.Color(Colors.Text); layer.Print(yPos, stamina, System.Drawing.ContentAlignment.TopRight); Terminal.Composition(false); // Statuses int xPos = 0; if (player.StatusHandler.TryGetStatus(StatusType.Phasing, out _)) { Terminal.Color(Swatch.DbMetal); layer.Print(xPos, yPos + 1, "Phasing"); xPos += 8; } if (player.StatusHandler.TryGetStatus(StatusType.Burning, out _)) { Terminal.Color(Colors.Fire); layer.Print(xPos, yPos + 1, "Burning"); xPos += 8; } if (player.StatusHandler.TryGetStatus(StatusType.Frozen, out _)) { Terminal.Color(Colors.Water); layer.Print(xPos, yPos + 1, "Frozen"); xPos += 7; } }