Пример #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
        /// <summary>
        /// Handler for when the user has chosen a menu entry.
        /// </summary>
        protected virtual void OnSelectEntry(int entryIndex, PlayerIndex playerIndex)
        {
            //  .selectednode
            GameScreen[] screenstoload = new GameScreen[2];
            screenstoload[0] = new BackgroundScreen(ScreenManager);
            mSound.Play(Sound.SoundFX.Selection);
            switch(selectednode.Value.text)
            {
                case "Basic":
                    screenstoload[1] = new BoringGameScreen(ScreenManager);
                    break;
                case "Battle":
                    /// Wait for challenger
                    waitingforchallenger = true;
                    return;
                  //  screenstoload[1] = new BattleMode(ScreenManager);
                    break;
                case "Single Player":
                    screenstoload[1] = new ParticleScreen(ScreenManager);
                    break;
                case "Single Player Keyboard":
                    screenstoload[1] = new Particle_Keyboard(ScreenManager);
                    break;
                case "Basic Keyboard test":
                    screenstoload[1] = new BoringGameScreenwithkeyboard(ScreenManager);
                    break;
                case "Combo":
                    screenstoload[1] = new ComboMode(ScreenManager); ;
                    break;
                default:
                    screenstoload[1] = new GameplayScreen(ScreenManager);
                    break;
            }

            LoadingScreen.Load(ScreenManager, true, playerIndex, screenstoload);
        }
Пример #3
0
        /// <summary>
        /// Handler for when the user has chosen a menu entry.
        /// </summary>
        protected virtual void OnSelectEntry(int entryIndex, PlayerIndex playerIndex)
        {
            //  .selectednode
            GameScreen[] screenstoload=new GameScreen[2];
            screenstoload[0] = new BackgroundScreen(ScreenManager);
            mSound.Play(Sound.SoundFX.Selection);
            switch(entryIndex)
            {
                case 0:
                    screenstoload[1] = new PlayMenuScreen(ScreenManager);
                    break;
                case 1:
                    screenstoload[1] = new OptionsMenuScreen(ScreenManager);
                    break;
                case 2:
                    screenstoload[1] = new CreditsScreen(ScreenManager);
                    break;
                case 3:
                    //screenstoload[1] = new CreditsScreen(ScreenManager);
                    Game.Exit();
                    break;
                case 4:
                    Guide.ShowMarketplace(PlayerIndex.One);
                    screenstoload[1] = new PlayMenuScreen(ScreenManager);
                    break;
                default:
                    screenstoload[1] = new PlayMenuScreen(ScreenManager);
                    break;
            }

            LoadingScreen.Load(ScreenManager, true, playerIndex, screenstoload);
        }