Exemplo n.º 1
0
        public override void Input(InputStates input)
        {
            if (input.IsNewButtonPress(Buttons.A) || input.IsNewKeyPress(Keys.Space))
            {
                MenuItem selected = mainMenu.GetSelectedItem();
                if (selected != null)
                {
                    if ((string)selected.value == "new")
                    {
                        manager.PopState();
                        manager.PushState(new PlayState(manager));
                    }
                    else if ((string)selected.value == "continue")
                    {
                        // TODO: Implement loading a game to continue
                    }
                    else if ((string)selected.value == "quit")
                    {
                        manager.Quit(0);
                    }
                }
            }

            if (input.IsNewButtonPress(Buttons.DPadRight) || input.IsNewKeyPress(Keys.Down))
            {
                mainMenu.Select(mainMenu.GetSelectedIndex() + 1);
            }

            if (input.IsNewButtonPress(Buttons.DPadLeft) || input.IsNewKeyPress(Keys.Up))
            {
                mainMenu.Select(mainMenu.GetSelectedIndex() - 1);
            }
        }
Exemplo n.º 2
0
        public override void Input(InputStates input)
        {
            if (input.IsNewButtonPress(Buttons.A) || input.IsNewKeyPress(Keys.Space))
            {
                MenuItem selected = mainMenu.GetSelectedItem();
                if (selected != null)
                {
                    if ((string)selected.value == "resume")
                    {
                        manager.PopState();
                    }
                    else if ((string)selected.value == "quit")
                    {
                        manager.Quit(0);
                    }
                }
            }

            if (input.IsNewButtonPress(Buttons.DPadRight) || input.IsNewKeyPress(Keys.Down))
            {
                mainMenu.Select(mainMenu.GetSelectedIndex() + 1);
            }

            if (input.IsNewButtonPress(Buttons.DPadLeft) || input.IsNewKeyPress(Keys.Up))
            {
                mainMenu.Select(mainMenu.GetSelectedIndex() - 1);
            }
        }
Exemplo n.º 3
0
 public GameManager(ContentManager ContentManager)
 {
     gamestates = new Stack<GameState>();
     contentManager = ContentManager;
     textures = new Hashtable();
     rnd = new Random();
     input_States = new InputStates();
 }
Exemplo n.º 4
0
        public override void Input(InputStates input)
        {
            if (input.IsNewButtonPress(Buttons.A) || input.IsNewKeyPress(Keys.Space))
            {
                if (!onSecondaryList)
                {
                    MenuItem selected = mnu_actions.GetSelectedItem();
                    if (selected != null)
                    {
                        if ((string)selected.value == "inventory")
                        {
                            onSecondaryList = true;
                            MakeInventoryList("all");
                            secondaryTitle = "Your Items";
                        }
                        else if ((string)selected.value == "equip")
                        {
                            onSecondaryList = true;
                            MakeInventoryList("equippable");
                            secondaryTitle = "Equip Which?";
                        }
                        else if ((string)selected.value == "use")
                        {
                            onSecondaryList = true;
                            MakeInventoryList("useable");
                            secondaryTitle = "Use Which?";
                        }
                        else if ((string)selected.value == "drop")
                        {
                            onSecondaryList = true;
                            MakeInventoryList("all");
                            secondaryTitle = "Drop Which?";
                        }
                        else if ((string)selected.value == "read")
                        {
                            onSecondaryList = true;
                            MakeInventoryList("readable");
                            secondaryTitle = "Read Which?";
                        }
                    }
                }
                else
                {
                    string action = (string)mnu_actions.GetSelectedItem().value;
                    MenuItem selected = mnu_inv.GetSelectedItem();

                    if (action == "use")
                        Use(((Item)selected.value));
                    else if (action == "drop")
                        Drop(((Item)selected.value));
                    else if (action == "read")
                        Read(((Item)selected.value));
                    else if (action == "equip")
                        Equip(((Item)selected.value));
                    else if (action == "inventory")
                        View(((Item)selected.value));
                }
            }

            if (input.IsNewButtonPress(Buttons.DPadRight) || input.IsNewKeyPress(Keys.Down))
            {
                if (onSecondaryList)
                {
                    mnu_inv.Select(mnu_inv.GetSelectedIndex() + 1);
                }
                else
                {
                    mnu_actions.Select(mnu_actions.GetSelectedIndex() + 1);
                }
            }

            if (input.IsNewButtonPress(Buttons.DPadLeft) || input.IsNewKeyPress(Keys.Up))
            {
                if (onSecondaryList)
                {
                    mnu_inv.Select(mnu_inv.GetSelectedIndex() - 1);
                }
                else
                {
                    mnu_actions.Select(mnu_actions.GetSelectedIndex() - 1);
                }
            }

            if (input.IsNewButtonPress(Buttons.B) || input.IsNewKeyPress(Keys.Enter)
                || input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape))
            {
                if (onSecondaryList) onSecondaryList = false;
                else
                {
                    manager.PopState();
                }
            }
        }
Exemplo n.º 5
0
 public virtual void Input(InputStates inputStates)
 {
 }
Exemplo n.º 6
0
        // Takes input for the state
        public override void Input(InputStates inputStates)
        {
            // Shows the pause screen
            if (inputStates.IsNewButtonPress(Buttons.Back) || inputStates.IsNewKeyPress(Keys.Escape))
            {
                manager.PushState(new PauseState(manager));
            }

            if (player.IsActionDone())
            {
                if (inputStates.IsButtonPressed(Buttons.DPadRight) || inputStates.IsKeyPressed(Keys.Down))
                {
                    player.TurnInput(PlayerInput.backward);
                }
                else if (inputStates.IsButtonPressed(Buttons.DPadLeft) || inputStates.IsKeyPressed(Keys.Up))
                {
                    player.TurnInput(PlayerInput.forward);
                }
                else if (inputStates.IsButtonPressed(Buttons.DPadUp) || inputStates.IsKeyPressed(Keys.Right))
                {
                    player.TurnInput(PlayerInput.right);
                }
                else if (inputStates.IsButtonPressed(Buttons.DPadDown) || inputStates.IsKeyPressed(Keys.Left))
                {
                    player.TurnInput(PlayerInput.left);
                }
                else if (inputStates.IsNewButtonPress(Buttons.A) || inputStates.IsNewKeyPress(Keys.Space))
                {
                    player.TurnInput(PlayerInput.button);
                }
                else if (inputStates.IsNewButtonPress(Buttons.B) || inputStates.IsNewKeyPress(Keys.Enter))
                {
                    manager.PushState(new InventoryState(player, manager));
                }
            }
        }