Exemplo n.º 1
0
        public void Update(GameTime gameTime, int vitesse, GraphicsDeviceManager graphics, MultiMenuChoose multimenuchoose)
        {
            if (KB.New.IsKeyDown(Keys.Escape) && !KB.Old.IsKeyDown(Keys.Escape))
            {
                selection = 0;
                GameState.State = "initial"; //retour au menu
            }

            #region selection

            if (selection == -1) //pour que la selection ne dépasse pas les negatifs
                selection = 3;
            else
                selection = selection % 4; //pour que la selection ne dépasse pas 4

            if (KB.New.IsKeyDown(Keys.Down) && !KB.Old.IsKeyDown(Keys.Down))
                selection++;

            if (KB.New.IsKeyDown(Keys.Up) && !KB.Old.IsKeyDown(Keys.Up))
                selection--;

            #endregion

            #region survoler le menu

            if (selection == 0)
                fullscreenText = fullscreenTextH; //fullscreen selectionné
            else
                fullscreenText = fullscreenTextN;

            if (selection == 1)
                soundText = soundTextH; //sound selectionné
            else
                soundText = soundTextN;

            if (selection == 2)
                langueText = langueTextH; //langue selectionné
            else
                langueText = langueTextN;

            if (selection == 3)
                nomText = nomTextH; //langue selectionné
            else
                nomText = nomTextN;

            #endregion

            #region fullscreenToggle

            if (selection == 0) //si fullscreen selectionné
            {
                if (KB.New.IsKeyDown(Keys.Left) && !KB.Old.IsKeyDown(Keys.Left) && selectionFullscreen == 1) //si appuye gauche
                {
                    selectionFullscreen = 0;
                    fullscreenToggle = fullscreenToggleOn;
                    graphics.ToggleFullScreen(); //changer fullscreen
                }

                if (KB.New.IsKeyDown(Keys.Right) && !KB.Old.IsKeyDown(Keys.Right) && selectionFullscreen == 0) //si appuye droite
                {
                    selectionFullscreen = 1;
                    fullscreenToggle = fullscreenToggleOff;
                    graphics.ToggleFullScreen(); //changer fullscreen
                }
            }

            #endregion

            #region soundToggle

            if (selection == 1) //is sound selected
            {
                if (KB.New.IsKeyDown(Keys.Left) && !KB.Old.IsKeyDown(Keys.Left) && selectionSound == 1)
                {
                    selectionSound = 0;
                    AudioRessources.volume = 1f;
                    soundToggle = soundToggleOn;
                }

                if (KB.New.IsKeyDown(Keys.Right) && !KB.Old.IsKeyDown(Keys.Right) && selectionSound == 0)
                {
                    selectionSound = 1;
                    AudioRessources.volume = 0f;
                    soundToggle = soundToggleOff;
                }
            }
            #endregion

            #region langueToggle

            if (selection == 2) //is sound selected
            {
                if (KB.New.IsKeyDown(Keys.Left) && !KB.Old.IsKeyDown(Keys.Left) && selectionLangue == 1)
                {
                    selectionLangue = 0;
                    Langue.Choisie = "fr";
                    LoadContent();
                    menu.LoadContent();
                    menuaide.LoadContent();
                    menuchoose.LoadContent();
                    multimenuchoose.LoadContent();
                    langueToggle = langueToggleFR;
                }

                if (KB.New.IsKeyDown(Keys.Right) && !KB.Old.IsKeyDown(Keys.Right) && selectionLangue == 0)
                {
                    selectionLangue = 1;
                    Langue.Choisie = "en";
                    LoadContent();
                    menu.LoadContent();
                    menuaide.LoadContent();
                    menuchoose.LoadContent();
                    langueToggle = langueToggleEN;
                }
            }
            #endregion

            #region nomButton
            if (selection == 3) //is sound selected
            {
                if (KB.New.IsKeyDown(Keys.Enter) && !KB.Old.IsKeyDown(Keys.Enter))
                {
                    GameState.State = "menuName";
                }

            }
            #endregion
        }
Exemplo n.º 2
0
        protected override void Initialize()
        {
            this.IsMouseVisible = true;
            KB.Old = Keyboard.GetState();

            Langue.Choisie = "en";
            Ressources.LoadLangue();

            menu = new Menu();
            menu.Initialize(-37, 0); //initialisation menu

            game = new Gameplay();

            multigame = new MultiGameplay();

            menupauseaide = new MenuPauseAide();

            menuaide = new MenuAide();
            menuaide.Initialize(); //initialisation menu aide

            menuchoose = new MenuChoose(game, Content);
            menuchoose.Initialize(); //initialisation menu options

            menuconnection = new MenuConnection(multigame);
            menuconnection.Initialize();

            multimenuchoose = new MultiMenuChoose(multigame, Components);
            multimenuchoose.Initialize();

            menuname = new MenuName();
            menuname.Initialize(); //initialisation menu options

            menuoptions = new MenuOptions(menu, menuaide, menuchoose);
            menuoptions.Initialize(); //initialisation menu options

            gameover = new GameOver();
            multigameover = new MultiGameOver();
            multigamewin = new MultiGameWin();

            pong = new Pong();
            pong.Initialize();

            keybonusgame = new KeyBonusGame();
            keybonusgame.Initialize();

            menupause = new MenuPause(pong, keybonusgame);
            menupause.Initialize(450, 0); //initialisation menu pause

            multimenupause = new MultiMenuPause();
            multimenupause.Initialize(450, 0); //initialisation menu pause

            menumode = new MenuMode();
            menumode.Initialize();

            audioPlay = new AudioPlay(1f);
            GameState.State = "Generique"; //mise à l'état initial

            base.Initialize();
        }