示例#1
0
        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");
            }
        }
示例#2
0
        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++;
            }
        }
示例#3
0
        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--;
            }
        }
示例#4
0
        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("");
        }
示例#5
0
        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);
        }
示例#6
0
        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"));
        }
示例#7
0
        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");
            }
        }
示例#8
0
        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);
        }
示例#9
0
        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})");
            }
        }
示例#10
0
        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, "─────────────────");
        }
示例#11
0
        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++;
                    });
                }
            }
        }
示例#12
0
        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;
            }
        }