public override void HandleInput(InputHelper inputHelper)
    {
        titleMenuState.HandleInput(inputHelper);
        settings.HandleInput(inputHelper);

        if (apply.Pressed)
        {
            GameSettings.ApplySettings();
        }
    }
Exemple #2
0
        public void HandleInput(InputHelper inputHelper)
        {
            newCamera.HandleInput(inputHelper);
            gameObjects.HandleInput(inputHelper);

            if (inputHelper.KeyPressed(Keys.Space))
            {
                Server.Send(new EndTurnEvent(Player));
            }
        }
Exemple #3
0
    public override void HandleInput(InputHelper ih)
    {
        base.HandleInput(ih);
        items.HandleInput(ih);

        if (ih.MouseInBox(this.BoundingBox) || (menuItems[1].Visible && ih.MouseInBox(new Rectangle((int)this.Position.X, (int)this.Position.Y, this.Width, ((options.Length + 1) * this.Height)))))
        {
            for (int i = 0; i < options.Length; i++)
            {
                menuItems[i].Visible = true;
            }

            for (int i = 1; i < options.Length; i++)
            {
                options[i].Visible = true;
            }

            for (int i = 1; i < options.Length; i++)
            {
                if (ih.MouseInBox(new Rectangle((int)this.Position.X, ((int)this.Position.Y + (i * sprite.Height)), sprite.Width, (sprite.Height))))
                {
                    options[i].Color = Color.White;
                }
                else
                {
                    options[i].Color = Color.Black;
                }
            }


            if (ih.LeftButtonPressed())
            {
                for (int i = 1; i < options.Length; i++)
                {
                    if (ih.MouseInBox(new Rectangle(((int)this.Position.X), ((int)this.PositionY + (sprite.Height * i)), sprite.Width, sprite.Height)))
                    {
                        options[0].Text = options[i].Text;
                    }
                }
            }
        }
        else
        {
            for (int i = 1; i < options.Length; i++)
            {
                menuItems[i].Visible = false;
            }

            for (int i = 1; i < options.Length; i++)
            {
                options[i].Visible = false;
            }
        }
    }
Exemple #4
0
 public override void HandleInput(InputHelper ih)
 {
     base.HandleInput(ih);
     if (buttons.Objects.Count > 0)
     {
         buttons.HandleInput(ih);
         for (int i = 0; i < buttons.Objects.Count; i++)
         {
             GameObject obj = buttons.Objects[i];
             if (obj is Button && i != selector)
             {
                 Button button = obj as Button;
                 if (button.Selected)
                 {
                     selector = -1;
                 }
             }
         }
         if (ih.KeyPressed(Keys.Up, Keys.W))
         {
             Button b;
             if (selector != -1)
             {
                 b          = buttons.Objects[selector] as Button;
                 b.Selected = false;
             }
             selector--;
             if (selector < 0)
             {
                 selector = buttons.Objects.Count - 1;
             }
             b          = buttons.Objects[selector] as Button;
             b.Selected = true;
         }
         else if (ih.KeyPressed(Keys.Down, Keys.S))
         {
             Button b;
             if (selector != -1)
             {
                 b          = buttons.Objects[selector] as Button;
                 b.Selected = false;
             }
             selector++;
             if (selector >= buttons.Objects.Count)
             {
                 selector = 0;
             }
             b          = buttons.Objects[selector] as Button;
             b.Selected = true;
         }
     }
 }
    protected void HandleInput()
    {
        inputHelper.Update();

        // quit the game when the player presses ESC
        if (inputHelper.KeyPressed(Keys.Escape))
        {
            Exit();
        }

        // toggle full-screen mode when the player presses F5
        if (inputHelper.KeyPressed(Keys.F5))
        {
            FullScreen = !FullScreen;
        }

        gameWorld.HandleInput(inputHelper);
    }
Exemple #6
0
        public override void HandleInput(InputHelper inputHelper)
        {
            onTile.HandleInput(inputHelper);

            showNormalReach = false;
            showSKillReach  = false;

            if (inputHelper.IsKeyDown(Keys.Q))
            {
                showNormalReach = true;
            }
            if (inputHelper.IsKeyDown(Keys.E))
            {
                showSKillReach = true;
            }

            if (TileType == TileType.Floor)
            {
                Action onLeftClick = () =>
                {
                    Player          player = GameWorld.Find(Player.LocalPlayerName) as Player;
                    PlayerMoveEvent pme    = new PlayerMoveEvent(player, this);
                    Server.Send(pme);
                };

                Action onRightClick = () =>
                {
                    Player     player = GameWorld.Find(Player.LocalPlayerName) as Player;
                    SkillEvent SkE    = new SkillEvent(player, this);
                    Server.Send(SkE);
                };

                inputHelper.IfMouseLeftButtonPressedOn(this, onLeftClick);
            }

            base.HandleInput(inputHelper);
        }
Exemple #7
0
 public override void HandleInput(InputHelper inputHelper)
 {
     root.HandleInput(inputHelper);
 }
Exemple #8
0
 public void HandleInput(InputHelper inputHelper)
 {
     playingState.HandleInput(inputHelper);
     hud.HandleInput(inputHelper);
 }
Exemple #9
0
 /// <summary>
 /// Calls HandleInout for all objects in this GameState.
 /// </summary>
 /// <param name="inputHelper">An object required for handling player input.</param>
 public virtual void HandleInput(InputHelper inputHelper)
 {
     gameObjects.HandleInput(inputHelper);
 }