示例#1
0
        protected override bool ProcessKeyPressed(AsciiKey key)
        {
            switch (key.Key)
            {
            case Keys.U:
                UseItem?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.E:
                EquipItem?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.Z:
                EquipHoldableItemLeft?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.X:
                EquipHoldableItemRight?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.T:
                TakeOffItem?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.D:
                DropItem?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.A:
                DropStack?.Invoke(this, EventArgs.Empty);
                return(true);

            case Keys.C:
                CheckScroll?.Invoke(this, EventArgs.Empty);
                return(true);
            }
            return(base.ProcessKeyPressed(key));
        }
示例#2
0
        private void InitializeControls()
        {
            checkScrollButton = new StandardButton(20)
            {
                Position = new Point(Width - 30, 40),
                Text     = "[C] Check Scroll"
            };
            checkScrollButton.Click += (sender, args) => CheckScroll?.Invoke(this, EventArgs.Empty);
            Add(checkScrollButton);

            useItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[U] Use"
            };
            useItemButton.Click += (sender, args) => UseItem?.Invoke(this, EventArgs.Empty);
            Add(useItemButton);

            equipItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[E] Equip"
            };
            equipItemButton.Click += (sender, args) => EquipItem?.Invoke(this, EventArgs.Empty);
            Add(equipItemButton);

            equipLeftHoldableButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[Z] Equip Left"
            };
            equipLeftHoldableButton.Click += (sender, args) => EquipHoldableItemLeft?.Invoke(this, EventArgs.Empty);
            Add(equipLeftHoldableButton);

            equipRightHoldableButton = new StandardButton(20)
            {
                Position = new Point(Width - 31, 40),
                Text     = "[X] Equip Right"
            };
            equipRightHoldableButton.Click += (sender, args) => EquipHoldableItemRight?.Invoke(this, EventArgs.Empty);
            Add(equipRightHoldableButton);

            takeOffItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[T] Take Off"
            };
            takeOffItemButton.Click += (sender, args) => TakeOffItem?.Invoke(this, EventArgs.Empty);
            Add(takeOffItemButton);

            dropItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 43),
                Text     = "[D] Drop"
            };
            dropItemButton.Click += (sender, args) => DropItem?.Invoke(this, EventArgs.Empty);
            Add(dropItemButton);

            dropAllItemsButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 46),
                Text     = "[A] Drop All"
            };
            dropAllItemsButton.Click += (sender, args) => DropStack?.Invoke(this, EventArgs.Empty);
            Add(dropAllItemsButton);
        }