public void Draw(LayerInfo layer) { // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '├', // 195 TopRightChar = '┤', // 180 BottomLeftChar = '╧', // 207 BottomRightChar = '╧', TopChar = '─', // 196 BottomChar = '═', // 205 LeftChar = '│', // 179 RightChar = '│' }); layer.Print(-1, $"{Constants.HEADER_LEFT}[color=white]SYSTEM LOG[/color]{Constants.HEADER_RIGHT}", System.Drawing.ContentAlignment.TopCenter); Terminal.Color(Colors.Text); // draw messages int maxCount = Math.Min(_messages.Count, layer.Height - 1); int yPos = layer.Height - 1; for (int i = 0; i < maxCount; i++) { layer.Print(yPos, _messages[_messages.Count - i - 1]); yPos--; } }
public void Draw(LayerInfo layer) { Game.ShowEquip = false; // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopRightChar = '╗', // 187 BottomRightChar = '╝', // 188 TopChar = '═', // 205 BottomChar = '═', RightChar = '║' // 186 }); layer.Print(-1, $"{Constants.HEADER_LEFT}[color=white]INVENTORY{Constants.HEADER_SEP}" + $"[/color]EQUIPMENT{Constants.HEADER_RIGHT}"); // draw items int line = 1; char letter = 'a'; Terminal.Color(Colors.Text); foreach (ItemGroup itemStack in _inventory) { layer.Print(line, $"{letter} - {itemStack}"); line++; letter++; } }
// redraw inventory with opened item stack internal void DrawStackSelected(LayerInfo layer, char key, Func <Item, bool> selected) { System.Diagnostics.Debug.Assert(IsStacked(key)); int line = 1; char letter = 'a'; char subletter = 'a'; Terminal.Color(Colors.DimText); layer.Clear(); foreach (ItemGroup itemStack in _inventory) { layer.Print(line++, $"{letter} - {itemStack}"); if (letter == key) { foreach (Item item in _inventory[key - 'a']) { Terminal.Color(selected(item) ? Colors.HighlightColor : Colors.DimText); layer.Print(line++, $" {subletter} - {item}"); subletter++; } Terminal.Color(Colors.DimText); } letter++; } }
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 }); Terminal.Color(Colors.Text); layer.Print(0, "Objective"); layer.Print(1, "─────────"); if (Game.NextMission.MissionType == MissionType.Elim) { layer.Print(2, $" {Game.MapHandler.Units.Count - 1} enemy remain"); } else { layer.Print(2, " none"); } }
public void Draw(LayerInfo layer) { Game.ShowEquip = true; // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopRightChar = '╗', // 187 BottomRightChar = '╝', // 188 TopChar = '═', // 205 BottomChar = '═', RightChar = '║' // 186 }); layer.Print(-1, $"{Constants.HEADER_LEFT}INVENTORY" + $"[color=white]{Constants.HEADER_SEP}EQUIPMENT{Constants.HEADER_RIGHT}"); Terminal.Color(Colors.Text); layer.Print(2, "a) Primary: " + (PrimaryWeapon?.Name ?? "none")); layer.Print(3, "b) Offhand: " + (OffhandWeapon?.Name ?? "none")); layer.Print(4, "c) Armor: " + (Armor[ArmorType.Armor]?.Name ?? "none")); layer.Print(5, "d) Helmet: " + (Armor[ArmorType.Helmet]?.Name ?? "none")); layer.Print(6, "e) Gloves: " + (Armor[ArmorType.Gloves]?.Name ?? "none")); layer.Print(7, "f) Boots: " + (Armor[ArmorType.Boots]?.Name ?? "none")); layer.Print(8, "g) Left ring: " + (Armor[ArmorType.RingLeft]?.Name ?? "none")); layer.Print(9, "h) Right ring: " + (Armor[ArmorType.RingRight]?.Name ?? "none")); }
public void Draw(LayerInfo layer) { // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '├', TopRightChar = '┤', TopChar = '─', LeftChar = '│', RightChar = '│', BottomChar = '─', }); Terminal.Color(Colors.Text); Terminal.Font("message"); // draw messages int maxCount = Math.Min(_messages.Count, layer.Height); int yPos = layer.Height - 1; for (int i = 0; i < maxCount; i++) { layer.Print(yPos, _messages[_messages.Count - i - 1]); yPos--; } Terminal.Font(""); }
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); }
private void RecursivePrint(LayerInfo layer, ActionNode action, int depth, int line) { if (action == null) { return; } string text; if (action == Current.Left) { text = "z-"; } else if (action == Current.Right) { text = "x-"; } else { text = depth > 0 ? "+-" : " "; } Terminal.Color(action == Current ? Swatch.DbBlood : Colors.Text); layer.Print(2 * depth - 2, line, text + action.Name); RecursivePrint(layer, action.Left, depth + 1, line + 1); RecursivePrint(layer, action.Right, depth + 1, line + 1); }
public void Draw(LayerInfo layer) { Terminal.Clear(); var message = new StringBuilder($@" Farewell great sage You made it to level {Game.MapHandler.Level + 1} You knew {Game.Player.SpellsKnown} spells You killed:"); message.Append("\n"); int typeCount = 0; foreach ((Type type, int count) in Game.Player.KillCount) { if (count > 0) { message.Append($"\t{count} {Game.ActorData[type].Name}\n"); typeCount++; } } if (typeCount == 0) { message.Append($"\tNothing!\n"); } message.Append("\nPress any key to continue"); int startY = 2; layer.Print(new Rectangle(0, startY, layer.Width, layer.Height - startY), message.ToString()); }
public void Draw(LayerInfo layer) { Terminal.Clear(); layer.Print(2, "GeomanceRL"); string message = @" Several days ago, you sensed a disturbance somewhere in the distance. With your trusty staff and spellbook in hand, you set out to investigate. Controls: Vi-keys, arrow keys, or number pad to move 1-6 to cast known spells While casting, press [[Enter]] to confirm or [[Esc]] to cancer [[Esc]] to quit to this menu Press [[Enter]] to start"; int startY = 4; layer.Print(new Rectangle(0, startY, layer.Width, layer.Height - startY), message, ContentAlignment.TopLeft); }
// redraw selected items internal void DrawSelected(LayerInfo layer, Func <Item, bool> selected) { int line = 1; char letter = 'a'; foreach (ItemGroup group in _inventory) { Terminal.Color(group.Any(selected) ? Colors.HighlightColor : Colors.DimText); layer.Print(line, $"{letter} - {group}"); line++; letter++; } }
public override void Draw(LayerInfo layer) { base.Draw(layer); if (_fromSubinv) { Game.Player.Inventory.DrawStackSelected(layer, _subinvKey, Selected); } LayerInfo itemMenu = new LayerInfo("Item menu", layer.Z + 1, layer.X + 0, layer.Y + Line + 2, 9, 4); itemMenu.Clear(); Terminal.Color(Colors.HighlightColor); itemMenu.DrawBorders(new BorderInfo { TopLeftChar = '╠', // 204 TopRightChar = '╗', // 187 BottomLeftChar = '╠', BottomRightChar = '╝', // 188 TopChar = '═', // 205 BottomChar = '═', LeftChar = '║', // 186 RightChar = '║' }); if (_usable) { Terminal.Color(Colors.HighlightColor); itemMenu.Print(0, 0, "(a)[color=white]pply"); } else { Terminal.Color(Colors.DimText); itemMenu.Print(0, 0, "(a)pply"); } // TODO: check edibility Terminal.Color(Colors.DimText); itemMenu.Print(0, 1, "(c)onsume"); Terminal.Color(Colors.HighlightColor); itemMenu.Print(0, 2, "(t)[color=white]hrow"); if (_equippable) { Terminal.Color(Colors.HighlightColor); itemMenu.Print(0, 3, "(w)[color=white]ear"); } else { Terminal.Color(Colors.DimText); itemMenu.Print(0, 3, "(w)ear"); } }
private static int DrawPart(LayerInfo layer, int yStart, Part p) { p.Get <StabilityComponent>().Match( some: comp => { int percentage = (int)(comp.Stability / comp.MaxStability * 100); layer.Print(1, yStart, $"Stab:{percentage}%"); }, none: () => { layer.Print(1, yStart, $"Stab:-"); }); p.Get <ActivateComponent>().Match( some: comp => { if (comp.CurrentCooldown >= 0) { layer.Print(1, yStart + 1, $"Rchg:{comp.CurrentCooldown}"); } else { layer.Print(1, yStart + 1, $"Rchg:RELOAD"); } }, none: () => { layer.Print(1, yStart + 1, $"Rchg:-"); }); p.Get <AmmoComponent>().Match( some: comp => { layer.Print(1, yStart + 2, $"Ammo:{comp.Loaded}/{comp.Capacity}"); }, none: () => { layer.Print(1, yStart + 2, $"Ammo:-"); }); TileMap img = p.Art ?? placeholder; DrawTileMap(layer, layer.Width - img.Width, yStart, img); yStart += img.Height; return(yStart); }
public static void Draw(LayerInfo layer) { Game.ShowInfo = true; // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '╔', // 201 BottomLeftChar = '╚', // 200 TopChar = '═', // 205 BottomChar = '═', LeftChar = '║' // 186 }); layer.Print(-1, $"{Constants.HEADER_LEFT}SCAN" + $"[color=white]{Constants.HEADER_SEP}DATA{Constants.HEADER_RIGHT}", System.Drawing.ContentAlignment.TopRight); // draw info Terminal.Color(Colors.Text); }
public void Draw(LayerInfo layer) { int x = 2; Terminal.Clear(); layer.Print(x, 2, "MechRL"); int y = 4; y++; layer.Print(x, y++, "Controls:"); layer.Print(x, y++, "Arrow keys, or number pad to move"); layer.Print(x, y++, "Shift-left or Shift-right to turn"); layer.Print(x, y++, "Z to use coolant"); layer.Print(x, y++, "1-6 to fire weapons"); layer.Print(x, y++, "While casting, press [[Enter]] to confirm or [[Esc]] to cancel"); _bStart.Draw(layer); _bQuit.Draw(layer); }
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; } }
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 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) { Game.ShowInfo = false; // draw borders Terminal.Color(Colors.BorderColor); layer.DrawBorders(new BorderInfo { TopLeftChar = '╔', // 201 BottomLeftChar = '╚', // 200 TopChar = '═', // 205 BottomChar = '═', LeftChar = '║' // 186 }); layer.Print(-1, $"{Constants.HEADER_LEFT}[color=white]SCAN{Constants.HEADER_SEP}" + $"[/color]DATA{Constants.HEADER_RIGHT}", System.Drawing.ContentAlignment.TopRight); // draw info Terminal.Color(Colors.Text); if (_showItemInfo) { layer.Print(1, _displayItem.Name); } if (_showActorInfo) { layer.Print(1, _displayActor.Name); layer.Print(2, $"HP: {_displayActor.Hp} / {_displayActor.Parameters.MaxHp}"); layer.Print(3, $"SP: {_displayActor.Sp} / {_displayActor.Parameters.MaxSp}"); layer.Print(4, $"Energy: {_displayActor.Energy}"); layer.Print(5, $"State: {_displayActor.State}"); } if (_showTile) { // console.Print(1, 8, $"Move cost: {_displayTile.MoveCost.ToString()}"); layer.Print(8, $"Occupied: {_displayTile.IsOccupied}"); layer.Print(9, $"Walkable: {_displayTile.IsWalkable}"); layer.Print(10, $"Wall: {_displayTile.IsWall}"); layer.Print(11, $"Position: ({_displayTile.X}, {_displayTile.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 override void Draw(LayerInfo layer) { base.Draw(layer); layer.Print(-1, $"{Constants.HEADER_LEFT}[color=grass]INVENTORY[/color]" + $"[color=white]{Constants.HEADER_SEP}EQUIPMENT[/color]{Constants.HEADER_RIGHT}"); }