示例#1
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            // Look up inputs for the active player profile.
            int playerIndex = (int)ControllingPlayer.Value;

            MouseState mouseState = input.CurrentMouseState;

            if (firstTimeHandleInput)
            {
                wasMousePressedWhenVictory = mouseState.LeftButton == ButtonState.Pressed;
                firstTimeHandleInput = false;
            }
            else
            {
                if (mouseState.LeftButton == ButtonState.Released)
                    wasMousePressedWhenVictory = false;

                PlayerIndex index;

                if (input.IsNewKeyPress(Keys.Tab, null, out index))
                {
                    AddGraphScreen();
                }

                if (input.IsNewKeyPress(Keys.Escape, null, out index) ||
                    input.IsNewKeyPress(Keys.Enter, null, out index))
                {
                    InputState.waitForRelease();
                    userCancelled = true;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            PlayerIndex index;
            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.Enter, null, out index))
                StartGameSelected(null, new PlayerIndexEventArgs(index));
        }
示例#3
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            // Look up inputs for the active player profile.
            int playerIndex = (int)ControllingPlayer.Value;

            PlayerIndex index;

            if (input.IsNewKeyPress(Keys.Left, null, out index))
            {
                graphKind--;
                if (graphKind < 0)
                    graphKind = (int)Statistic.Kind.Count - 1;
                SetRowNumber();
            } else if(input.IsNewKeyPress(Keys.Right, null, out index))
            {
                ToNextGraph();
            }

            if (input.IsNewKeyPress(Keys.Tab, null, out index) ||
                input.IsNewKeyPress(Keys.Enter, null, out index) ||
                input.IsNewKeyPress(Keys.Escape, null, out index))
            {
                InputState.waitForRelease();
                userCancelled = true;
            }
        }