Exemplo n.º 1
0
        // 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++;
            }
        }
Exemplo n.º 2
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");
            }
        }