Exemplo n.º 1
0
 private void CheckGeneralInput(GameTime gt)
 {
     if (InputManager.IsPressed(InputCommand.ToggleMenu))
     {
     }
     else if (InputManager.IsPressed(InputCommand.ToggleInventory))
     {
         if (_guiPlayerInventoryDialog == null)
         {
             _allowMovementInput = false;
             Alex.Instance.GuiManager.ShowDialog(_guiPlayerInventoryDialog = new GuiPlayerInventoryDialog(Player, Player.Inventory));
         }
         else
         {
             _allowMovementInput = true;
             Alex.Instance.GuiManager.HideDialog(_guiPlayerInventoryDialog);
             _guiPlayerInventoryDialog = null;
         }
     }
 }
Exemplo n.º 2
0
        private void CheckGeneralInput(GameTime gt)
        {
            _allowMovementInput = Alex.Instance.GuiManager.ActiveDialog == null;

            if (_allowMovementInput)
            {
                if (InputManager.IsPressed(InputCommand.HotBarSelectPrevious) ||
                    MouseInputListener.IsButtonDown(MouseButton.ScrollUp))
                {
                    Player.Inventory.SelectedSlot--;
                }
                else if (InputManager.IsPressed(InputCommand.HotBarSelectNext) ||
                         MouseInputListener.IsButtonDown(MouseButton.ScrollDown))
                {
                    Player.Inventory.SelectedSlot++;
                }

                if (InputManager.IsPressed(InputCommand.HotBarSelect1))
                {
                    Player.Inventory.SelectedSlot = 0;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect2))
                {
                    Player.Inventory.SelectedSlot = 1;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect3))
                {
                    Player.Inventory.SelectedSlot = 2;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect4))
                {
                    Player.Inventory.SelectedSlot = 3;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect5))
                {
                    Player.Inventory.SelectedSlot = 4;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect6))
                {
                    Player.Inventory.SelectedSlot = 5;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect7))
                {
                    Player.Inventory.SelectedSlot = 6;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect8))
                {
                    Player.Inventory.SelectedSlot = 7;
                }
                if (InputManager.IsPressed(InputCommand.HotBarSelect9))
                {
                    Player.Inventory.SelectedSlot = 8;
                }

                if (InputManager.IsPressed(InputCommand.ToggleCamera))
                {
                    World.Camera.ToggleMode();
                }
            }

            if (InputManager.IsPressed(InputCommand.Exit))
            {
                var activeDialog = Alex.Instance.GuiManager.ActiveDialog;

                if (activeDialog != null)
                {
                    CenterCursor();
                    Alex.Instance.GuiManager.HideDialog(activeDialog);
                }

                if (activeDialog is GuiPlayerInventoryDialog)
                {
                    _guiPlayerInventoryDialog = null;
                }
            }
            else if (InputManager.IsPressed(InputCommand.ToggleInventory))
            {
                if (!(Alex.Instance.GuiManager.FocusManager.FocusedElement is GuiTextInput))
                {
                    if (_guiPlayerInventoryDialog == null)
                    {
                        //_allowMovementInput = false;
                        Alex.Instance.GuiManager.ShowDialog(
                            _guiPlayerInventoryDialog = new GuiPlayerInventoryDialog(Player, Player.Inventory));
                    }
                    else
                    {
                        CenterCursor();
                        //_allowMovementInput = true;
                        Alex.Instance.GuiManager.HideDialog(_guiPlayerInventoryDialog);
                        _guiPlayerInventoryDialog = null;
                    }
                }
            }

            _allowMovementInput = Alex.Instance.GuiManager.ActiveDialog == null;
        }