コード例 #1
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;
            if (input.CurrentKeyboardStates[0].IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D) && input.CurrentKeyboardStates[0].IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F3))
            {
                if (!dev_modes)
                {
                    dev_modes = true;

                    InitilizeDeveloperModes();

                }
            }
            selectedtext = selectednode.Value.text;
            switch (selectedtext)
            {
                case "Single Player":
                    preview = Game.Content.Load<Texture2D>("Images/prevew3");
                    break;
                case "Basic":
                    preview = Game.Content.Load<Texture2D>("Images/preview2");
                    break;
                case "Combo":
                    preview = Game.Content.Load<Texture2D>("Images/prevew3");
                    break;
                case "Battle":
                    preview = Game.Content.Load<Texture2D>("Images/preview2");
                    break;
                default:
                    preview = Game.Content.Load<Texture2D>("Images/prevew3");
                    break;
            }

            if (waitingforchallenger)
            {
            PlayerIndex challenger=ControllingPlayer.Value;

            if (input.CurrentGamePadStates[0].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.Start) || input.CurrentGamePadStates[0].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A))
                {challenger=PlayerIndex.One;
                }
                if(input.CurrentGamePadStates[1].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.Start)|| input.CurrentGamePadStates[1].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A))
                {challenger=PlayerIndex.Two;
                }
                if(input.CurrentGamePadStates[2].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.Start)|| input.CurrentGamePadStates[2].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A))
                {challenger=PlayerIndex.Three;
                }
                if(input.CurrentGamePadStates[3].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.Start)|| input.CurrentGamePadStates[3].IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A))
                {challenger=PlayerIndex.Four;
                }

                    if(ControllingPlayer!=challenger)
                    {
                        GameScreen[] screenstoload=new GameScreen[2];
                    screenstoload[0] = new BackgroundScreen(ScreenManager);
            screenstoload[1] = new BattleMode(ScreenManager, ControllingPlayer.Value,challenger);
                     LoadingScreen.Load(ScreenManager, true,ControllingPlayer, screenstoload);

                }
             if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
                {
                    //OnCancel(playerIndex);
                    waitingforchallenger = false;

                }
            }
            else
            {
                // Move to the previous menu entry?
                if (input.IsMenuUp(ControllingPlayer))
                {
                    mSound.Play(Sound.SoundFX.Move);

                    if (selectednode.Previous == null)
                    {//you hit the beginning of the list loop back around
                        selectednode = menuEntries.Last;

                    }
                    else
                        selectednode = selectednode.Previous;
                    // menutransition = -1;
                }

                // Move to the next menu entry?
                if (input.IsMenuDown(ControllingPlayer))
                {
                    mSound.Play(Sound.SoundFX.Move);

                    if (selectednode.Next == null)
                    {//you hit the beginning of the list loop back around
                        selectednode = menuEntries.First;

                    }
                    else
                        selectednode = selectednode.Next;
                    //. menutransition = 1;
                }

                // Accept or cancel the menu? We pass in our ControllingPlayer, which may
                // either be null (to accept input from any player) or a specific index.
                // If we pass a null controlling player, the InputState helper returns to
                // us which player actually provided the input. We pass that through to
                // OnSelectEntry and OnCancel, so they can tell which player triggered them.

                if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
                {
                    OnSelectEntry(selectedEntry, playerIndex);
                }
                else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
                {
                    OnCancel(playerIndex);
                }
            }
        }
コード例 #2
0
ファイル: MenuScreen.cs プロジェクト: hillgr/SuperXblox360
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            // Move to the previous menu entry?
            if (input.IsMenuUp(ControllingPlayer))
            {
                selectedEntry--;

                if (selectedEntry < 0)
                    selectedEntry = menuEntries.Count - 1;
               // mSound.Play(Sound.SoundFX.Move);
            }

            // Move to the next menu entry?
            if (input.IsMenuDown(ControllingPlayer))
            {
                selectedEntry++;

                if (selectedEntry >= menuEntries.Count)
                    selectedEntry = 0;
               // mSound.Play(Sound.SoundFX.Move);
            }

            // Accept or cancel the menu? We pass in our ControllingPlayer, which may
            // either be null (to accept input from any player) or a specific index.
            // If we pass a null controlling player, the InputState helper returns to
            // us which player actually provided the input. We pass that through to
            // OnSelectEntry and OnCancel, so they can tell which player triggered them.
            PlayerIndex playerIndex;

            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                mSound.Play(Sound.SoundFX.Selection);
                OnSelectEntry(selectedEntry, playerIndex);

            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                OnCancel(playerIndex);
            }
        }
コード例 #3
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            // Move to the previous menu entry?
            if (input.IsMenuUp(ControllingPlayer))
            {
                mSound.Play(Sound.SoundFX.Move);

                if (Guide.IsTrialMode)
                {
                    if (selectedEntry - 1 < 0)
                    {//you hit the beginning of the list loop back around
                        selectedEntry = 4;
                    }
                    else
                        selectedEntry = selectedEntry - 1;
                }
                else
                {
                    if (selectedEntry - 1 < 0)
                    {//you hit the beginning of the list loop back around
                        selectedEntry = 3;
                    }
                    else
                        selectedEntry = selectedEntry - 1;
                }
            }

            // Move to the next menu entry?
            if (input.IsMenuDown(ControllingPlayer))
            {
                mSound.Play(Sound.SoundFX.Move);

                if (Guide.IsTrialMode)
                {
                    if (selectedEntry + 1 > 4)
                    {//you hit the beginning of the list loop back around
                        selectedEntry = 0;
                    }
                    else
                        selectedEntry = selectedEntry + 1;
                }
                else
                {
                    if (selectedEntry + 1 > 3)
                    {//you hit the beginning of the list loop back around
                        selectedEntry = 0;
                    }
                    else
                        selectedEntry = selectedEntry + 1;
                }

                //if (Guide.IsTrialMode == false && selectedEntry==4)
                //{
                //    selectedEntry++;
                //}

               //. menutransition = 1;
            }

            // Accept or cancel the menu? We pass in our ControllingPlayer, which may
            // either be null (to accept input from any player) or a specific index.
            // If we pass a null controlling player, the InputState helper returns to
            // us which player actually provided the input. We pass that through to
            // OnSelectEntry and OnCancel, so they can tell which player triggered them.
            PlayerIndex playerIndex;

            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                OnSelectEntry(selectedEntry, playerIndex);
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                OnCancel(playerIndex);
            }
        }