コード例 #1
0
        public override void HandleInput(InputState input, GameTime gameTime)
        {
            // Move to the previous menu entry?
            if (input.IsKeyUp())
            {
                selectedEntry--;
                screenManager.MenuItemSound.Play(0.5f, 0.0f, 0.0f);

                if (selectedEntry < 0)
                    selectedEntry = menuEntries.Count - 1;
            }

            // Move to the next menu entry?
            if (input.IsKeyDown())
            {
                selectedEntry++;
                screenManager.MenuItemSound.Play(0.5f, 0.0f, 0.0f);

                if (selectedEntry >= menuEntries.Count)
                    selectedEntry = 0;
            }

            // Handle selecting menu entries to proceed to next screen, or exiting from this screen.
            if (input.IsMenuSelect())
            {
                OnSelectEntry(selectedEntry);
            }
            else if (input.IsMenuCancel())
            {
                OnCancel();
            }
        }
コード例 #2
0
 public void HandleInput(InputState input, GameTime gameTime)
 {
     for (int i = 0; i < 4; i++)
         movement[i] = false;
     if (input.IsHoldDown())
     {
         position.Y += posDelta;
         movement[0] = true;
     }
     if (input.IsHoldUp())
     {
         position.Y -= posDelta;
         movement[1] = true;
     }
     if (input.IsHoldLeft())
     {
         position.X -= posDelta;
         movement[2] = true;
     }
     if (input.IsHoldRight())
     {
         position.X += posDelta;
         movement[3] = true;
     }
     boundingBox.X = (int)Position.X;
     boundingBox.Y = (int)Position.Y;
     if (input.IsUseButtonPressed())
         ((PlayableMainGameScreen)OwnerScreen).PlayerInteraction(gameTime);
 }
コード例 #3
0
 public void HandleInput(InputState input)
 {
     if (selectingTarget)
     {
         HandleTargetSelection(input);
     }
     else
     {
         HandleActionMenuInput(input);
     }
 }
コード例 #4
0
 public override void HandleInput(InputState input, GameTime gameTime)
 {
     base.HandleInput(input, gameTime);
     if (input.IsPauseButtonPressed())
     {
         screenManager.AddScreen(new PauseScreen());
     }
     if (input.IsInGameMenuButtonPressed())
     { screenManager.AddScreen(new InGameMenuScreen()); }
     if (input.IsInGameEscapeButtonPressed())
     { LoadingScreen.Load(ScreenManager, new MainMenuScreen()); }
     player.HandleInput(input, gameTime);
     CheckForCollision();
     HandleScrolling();
 }
コード例 #5
0
        public override void HandleInput(InputState input, GameTime gameTime)
        {
            // Move to the previous menu entry?
            if (input.IsKeyUp() || input.IsKeyRight())
            {
                selectedMajorMenuEntry--;
                screenManager.MenuItemSound.Play(0.5f, 0.0f, 0.0f);
                if (selectedMajorMenuEntry < 0) { selectedMajorMenuEntry++; }
                else if (selectedMajorMenuEntry < topDisplayedEntryIndex) { topDisplayedEntryIndex--; botDisplayedEntryIndex--; }
            }

            // Move to the next menu entry?
            if (input.IsKeyDown() || input.IsKeyLeft())
            {
                selectedMajorMenuEntry++;
                screenManager.MenuItemSound.Play(0.5f, 0.0f, 0.0f);
                if (selectedMajorMenuEntry > MenuEntries.Count - 1) { selectedMajorMenuEntry--; }
                else if (selectedMajorMenuEntry > botDisplayedEntryIndex) { topDisplayedEntryIndex++; botDisplayedEntryIndex++; }
            }

            // Handle selecting menu entries to proceed to next screen, or exiting from this screen.
            if (input.IsMenuSelect())
            {
            }
            else if (input.IsMenuCancel())
            {
                ExitScreen();
            }
        }
コード例 #6
0
 // Handles user input; only called when screen is active.
 public virtual void HandleInput(InputState input)
 {
 }
コード例 #7
0
 protected void HandleTargetSelection(InputState input)
 {
     if (input.IsKeyUp())
     {
         selectedTarget--;
         if (selectedTarget < 0)
             selectedTarget = OwnerScreen.BattleMembers.Count - 1;
     }
     if (input.IsKeyDown())
     {
         selectedTarget++;
         if (selectedTarget >= OwnerScreen.BattleMembers.Count())
             selectedTarget = 0;
     }
     if (input.IsMenuSelect())
     {
         // Logic to do with performing an action...
         CurrentCombatAction.PerformAction(this, OwnerScreen.BattleMembers[selectedTarget], CurrentCombatAction);
         // Reset shit so it doesn't stick on any menu.
         selectingTarget = false;
         // Go go go.
         OwnerScreen.AdvanceTurn();
     }
 }
コード例 #8
0
        protected void HandleActionMenuInput(InputState input)
        {
            // Move to the previous menu entry?
            if (input.IsKeyUp())
            {
                selectedAction--;
                //screenManager.MenuItemSound.Play(0.5f, 0.0f, 0.0f);

                if (selectedAction < 0)
                    selectedAction = CombatActions.Count() - 1;
            }

            // Move to the next menu entry?
            if (input.IsKeyDown())
            {
                selectedAction++;
                //screenManager.MenuItemSound.Play(0.5f, 0.0f, 0.0f);

                if (selectedAction >= CombatActions.Count())
                    selectedAction = 0;
            }

            // Handle selecting menu entries to proceed to next screen, or exiting from this screen.
            if (input.IsMenuSelect())
            {
                OnSelectAction(selectedAction);
            }

            //else if (input.IsMenuCancel())
            //{
            //    OnCancel();
            //}
        }
コード例 #9
0
 public override void HandleInput(InputState input, GameTime gameTime)
 {
     switch (currentBattleState)
     {
         case BattleState.Starting:
             break;
         case BattleState.PlayerTurn:
             player.HandleInput(input);
             break;
         case BattleState.EnemyTurn:
             break;
         case BattleState.AITurn:
             break;
         case BattleState.Victory:
             break;
         case BattleState.Defeat:
             break;
     }
 }
コード例 #10
0
 public override void HandleInput(InputState input, GameTime gameTime)
 {
     if (input.IsMenuCancel()) LoadingScreen.Load(screenManager, new MainMenuScreen());
 }
コード例 #11
0
        protected void HandleMajorMenuEntryInput(InputState input)
        {
            // Move to the previous menu entry?
            if (input.IsKeyUp() || input.IsKeyLeft())
            {
                selectedMajorMenuEntry--;
                AudioManager.PlaySound("beep");

                if (selectedMajorMenuEntry < 0)
                    selectedMajorMenuEntry = menuEntries.Count - 1;
            }

            // Move to the next menu entry?
            if (input.IsKeyDown() || input.IsKeyRight())
            {
                selectedMajorMenuEntry++;
                AudioManager.PlaySound("beep");

                if (selectedMajorMenuEntry >= menuEntries.Count)
                    selectedMajorMenuEntry = 0;
            }

            // Handle selecting menu entries to proceed to next screen, or exiting from this screen.
            if (input.IsMenuSelect())
            {
                OnSelectMajorMenuEntry(selectedMajorMenuEntry);
            }
            else if (input.IsMenuCancel())
            {
                OnCancel();
            }
        }
コード例 #12
0
 // Handle input.
 public override void HandleInput(InputState input, GameTime gameTime)
 {
     HandleMajorMenuEntryInput(input);
 }
コード例 #13
0
        public override void HandleInput(InputState input, GameTime gameTime)
        {
            // Move to the previous menu entry?
            if (input.IsKeyUp() || input.IsKeyRight())
            {
                selectedMajorMenuEntry--;
                AudioManager.PlaySound("beep");

                if (selectedMajorMenuEntry < 0)
                    selectedMajorMenuEntry = MenuEntries.Count - 1;
            }

            // Move to the next menu entry?
            if (input.IsKeyDown() || input.IsKeyLeft())
            {
                selectedMajorMenuEntry++;
                AudioManager.PlaySound("beep");

                if (selectedMajorMenuEntry >= MenuEntries.Count)
                    selectedMajorMenuEntry = 0;
            }

            // Handle selecting menu entries to proceed to next screen, or exiting from this screen.
            if (input.IsMenuSelect())
            {
            }
            else if (input.IsMenuCancel())
            {
                ExitScreen();
            }
        }
コード例 #14
0
 // Handles user input; only called when screen is active.
 public virtual void HandleInput(InputState input, GameTime gameTime)
 {
 }
コード例 #15
0
 public override void HandleInput(InputState input, GameTime gameTime)
 {
     base.HandleInput(input, gameTime);
     if (input.IsPauseButtonPressed()) { ExitScreen(); }
 }