Пример #1
0
 public override void HandleInput(InputState input)
 {
     if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.Enter) || ServiceHelper.Get<IGamePadService>().Tirer())
     {
         VLC.Stop();
         ScreenManager.AudioEngine.LoadContent(game.Content);
         LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                                        new MainMenuScreen(game));
     }
 }
Пример #2
0
        public override void HandleInput(InputState input)
        {
            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.Escape))
                this.ExitScreen();

            if (current != ennemis && current != manette && (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.Enter) || ServiceHelper.Get<IGamePadService>().Tirer()))
            {
                current = manette;
                return;
            }

            if (current == manette && (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.Enter) || ServiceHelper.Get<IGamePadService>().Tirer()))
            {
                current = ennemis;
                return;
            }

            if (current == ennemis && (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.Enter) || ServiceHelper.Get<IGamePadService>().Tirer()))
                this.ExitScreen();
        }
Пример #3
0
 /// <summary>
 /// Allows the screen to handle user input. Unlike Update, this method
 /// is only called when the screen is active, and not when some other
 /// screen has taken the focus.
 /// </summary>
 public virtual void HandleInput(InputState input)
 {
 }
Пример #4
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 left menu entry?
            if (input.IsMenuLeft(ControllingPlayer))
            {
                AudioEngine.SoundBank.PlayCue("sonMenuBoutton");
                if (selectedEntry == 0)
                {
                    page = maxpage;
                    selectedEntry = levels.Count - 1;
                }
                else if (selectedEntry == (page * 8) && page > 0)
                {
                    page--;
                    selectedEntry--;
                }
                else if (selectedEntry > 0)
                    selectedEntry--;
            }

            // Move to the right menu entry?
            if (input.IsMenuRight(ControllingPlayer))
            {
                AudioEngine.SoundBank.PlayCue("sonMenuBoutton");
                if (selectedEntry == (page + 1) * 8 - 1 && selectedEntry < (levels.Count - 2))
                {
                    page++;
                    selectedEntry++;
                }
                else if (selectedEntry == levels.Count - 1)
                {
                    page = 0;
                    selectedEntry = 0;
                }
                else if (selectedEntry < levels.Count - 1)
                    selectedEntry++;
            }

            // Move to the up menu entry?
            if (input.IsMenuUp(ControllingPlayer))
            {
                AudioEngine.SoundBank.PlayCue("sonMenuBoutton");
                if (selectedEntry == levels.Count - 1)
                    selectedEntry--;
                else if (page == 0 && selectedEntry < 4)
                {
                    page = maxpage;
                    selectedEntry = levels.Count - 1;
                }
                else if (selectedEntry > (page * 8) + 3)
                    selectedEntry -= 4;
                else if (page > 0 && selectedEntry <= (page * 8) + 3)
                {
                    selectedEntry -= 4;
                    page--;
                }
            }

            // Move to the down menu entry?
            if (input.IsMenuDown(ControllingPlayer))
            {
                AudioEngine.SoundBank.PlayCue("sonMenuBoutton");
                if (selectedEntry == levels.Count - 1)
                {
                    page = 0;
                    selectedEntry = 0;
                }
                else if (selectedEntry > (page * 8) + 3 && page < maxpage)
                {
                    page++;
                    selectedEntry += 4;
                }
                else if (selectedEntry <= (page * 8) + 3)
                    selectedEntry += 4;
                else if (selectedEntry < levels.Count - 1)
                    selectedEntry = levels.Count - 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.IsMenuCancel(ControllingPlayer, out playerIndex))
                OnSelectEntry(levels.Count - 1, playerIndex);

            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                AudioEngine.SoundBank.PlayCue("menuBouge");
                OnSelectEntry(selectedEntry, playerIndex);
            }
        }
Пример #5
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.IsMenuLeft(ControllingPlayer))
            {
                AudioEngine.SoundBank.PlayCue("sonMenuBoutton");
                selectedEntry--;

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

            // Move to the next menu entry?
            if (input.IsMenuRight(ControllingPlayer))
            {
                AudioEngine.SoundBank.PlayCue("sonMenuBoutton");
                selectedEntry++;

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

            // 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);
        }
Пример #6
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;

            // 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 our Accepted and
            // Cancelled events, so they can tell which player triggered them.
            if (input.IsScoreSelect(ControllingPlayer, out playerIndex))
            {
                AudioEngine.SoundBank.PlayCue("menuBouge");
                // Raise the accepted event, then exit the message box.
                if (playerName.Length > 0)
                {
                    HiScoreAccepted(this, new PlayerIndexEventArgs(playerIndex));
                    ExitScreen();
                }
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                AudioEngine.SoundBank.PlayCue("menuBouge");
                ExitScreen();
            }

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.Back) && (playerName.Length > 0))
            {
                playerName = playerName.Remove(playerName.Length - 1);
            }
        }
Пример #7
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            // 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.

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

            lastKeyboardState = keyboardState;
            keyboardState = input.CurrentKeyboardStates[playerIndex];

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

            // Event handler for when the Sound Volume menu entry is selected.
            if (MenuEntries[selectedEntry] == soundVolumeMenuEntry
                && input.IsMenuLeft(ControllingPlayer) && soundVolume > 0)
            {
                MediaPlayer.Volume -= 0.0999f;
                soundVolume = (MediaPlayer.Volume * 10);
                SetMenuEntryText();
            }
            if (MenuEntries[selectedEntry] == soundVolumeMenuEntry
                && input.IsMenuRight(ControllingPlayer) && soundVolume < 10)
            {
                MediaPlayer.Volume += 0.0999f;
                soundVolume = (MediaPlayer.Volume * 10);
                SetMenuEntryText();
            }

            // Event handler for when the Sound FX Volume menu entry is selected.
            if (input.IsMenuLeft(ControllingPlayer) && MenuEntries[selectedEntry] == fxVolumeMenuEntry)
            {
                fxVolume--;
                SetMenuEntryText();
            }
            if (input.IsMenuRight(ControllingPlayer) && MenuEntries[selectedEntry] == fxVolumeMenuEntry)
            {
                fxVolume++;
                SetMenuEntryText();
            }

            base.HandleInput(input);
        }
Пример #8
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;

            // 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 our Accepted and
            // Cancelled events, so they can tell which player triggered them.
            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                // Raise the accepted event, then exit the message box.
                if (Accepted != null)
                    Accepted(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                // Raise the cancelled event, then exit the message box.
                if (Cancelled != null)
                    Cancelled(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
        }
Пример #9
0
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            int playerIndex = (int)ControllingPlayer.Value;

            GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];

            bool gamePadDisconnected = !gamePadState.IsConnected && input.GamePadWasConnected[playerIndex];

            if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)
            {
                ScreenManager.AddScreen(new Pausebckground(), ControllingPlayer, true);
                PauseMenuScreen pauseMenuScreen = new PauseMenuScreen(0, 2, game);
                pauseMenuScreen.SaveMapMenuEntrySelected += SaveMapMenuAccepted;
                pauseMenuScreen.F1 += F1Selected;
                pauseMenuScreen.F2 += F2Selected;
                pauseMenuScreen.F3 += F3Selected;
                pauseMenuScreen.F4 += F4Selected;
                pauseMenuScreen.F5 += F5Selected;
                pauseMenuScreen.F6 += F6Selected;
                pauseMenuScreen.F7 += F7Selected;
                pauseMenuScreen.F8 += F8Selected;
                ScreenManager.AddScreen(pauseMenuScreen, ControllingPlayer, true);
            }

            if (camera.X > 0 && ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.Left))
                camera.X--;

            else if (camera.X < Taille_Map.LARGEUR_MAP - camera.Width && ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.Right))
                camera.X++;

            else if (camera.Y > 0 && ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.Up))
                camera.Y--;

            else if (camera.Y < Taille_Map.HAUTEUR_MAP - camera.Height && ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.Down))
                camera.Y++;

            if (curseur.Type == TypeCase.Gomme && ServiceHelper.Get<IMouseService>().ClicBoutonGauche())
                Supprimer_Ennemi_Ou_Bonus();

            if (ServiceHelper.Get<IMouseService>().ClicBoutonGauche() && ServiceHelper.Get<IMouseService>().DansLaCarte() && CasePossible)
                Placer_Personnage_Ou_Bonus();

            if (ServiceHelper.Get<IMouseService>().ClicBoutonDroit() && ServiceHelper.Get<IMouseService>().DansLaCarte() && CasePossible)
            {
                if (curseur.Type == TypeCase.Patrouilleur && _originesPatrouilleurs.Count > 0)
                    _originesPatrouilleurs[_originesPatrouilleurs.Count - 1].Add(new Vector2(curseur.Position.X + camera.X, curseur.Position.Y + camera.Y));
                else if (curseur.Type == TypeCase.Patrouilleur_a_cheval && _originesPatrouilleursAChevaux.Count > 0)
                    _originesPatrouilleursAChevaux[_originesPatrouilleursAChevaux.Count - 1].Add(new Vector2(curseur.Position.X + camera.X, curseur.Position.Y + camera.Y));
                else if (_originesStatues.Count > 0 && curseur.Type == TypeCase.Statues && _originesStatues.Count > 0)
                    rotationsDesStatues[rotationsDesStatues.Count - 1] = (byte)((rotationsDesStatues[rotationsDesStatues.Count - 1] + 1) % 4);
                else if (curseur.Type == TypeCase.Interrupteur && interrupteurs.Count > 0)
                    interrupteurs[interrupteurs.Count - 1].ChangerPosition(carte, new Vector2(curseur.Position.X + camera.X, curseur.Position.Y + camera.Y));
            }

            if (ServiceHelper.Get<IMouseService>().ClicBoutonMilieu() && ServiceHelper.Get<IMouseService>().DansLaCarte() && curseur.Type == TypeCase.Interrupteur)
                interrupteurs[interrupteurs.Count - 1].Rotationner(carte);

            if (ServiceHelper.Get<IMouseService>().BoutonGauchePresse() && ServiceHelper.Get<IMouseService>().DansLaCarte())
                Placer_Case();

            if (ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.LeftControl) && ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.S))
            {
                if (enableOrigine1 && enableOrigine2 || _originesBoss.Count == 0)
                    afficherMessageErreur = true;
                else
                {
                    EditorSavePop editorSavePop = new EditorSavePop(nomSauvegarde, 0);
                    editorSavePop.Accepted += SaveMapAccepted;
                    ScreenManager.AddScreen(editorSavePop, ControllingPlayer);
                }
            }

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F1))
                ChangerStyle(TypeCase.herbe);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F2))
                ChangerStyle(TypeCase.herbeFoncee);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F3))
                ChangerStyle(TypeCase.terre);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F4))
                ChangerStyle(TypeCase.parquet);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F5))
                Labyrinthe.CreerLabyrintheSimple(carte);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F6))
                Labyrinthe.CreerLabyrintheDouble(carte);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F7))
                Labyrinthe.CreerLabyrintheTriple(carte);

            if (ServiceHelper.Get<IKeyboardService>().ToucheAEtePressee(Keys.F8))
                Labyrinthe.CreerLabyrintheQuadruple(carte);

            infos.Update();

            ScreenManager.Game.IsMouseVisible = !ServiceHelper.Get<IMouseService>().DansLaCarte();
        }