Esempio n. 1
0
        public void LoadContent()
        {
            menubg = Ressources.Content.Load<Texture2D>("Menu/menubg");

            //charger buttons
            buttonTextureStartH = Ressources.GetLangue(Langue.Choisie).buttonTextureStartH;
            buttonTextureStartI = Ressources.GetLangue(Langue.Choisie).buttonTextureStartI;
            buttonTextureOptionsH = Ressources.GetLangue(Langue.Choisie).buttonTextureOptionsH;
            buttonTextureOptionsI = Ressources.GetLangue(Langue.Choisie).buttonTextureOptionsI;
            buttonTextureHelpH = Ressources.GetLangue(Langue.Choisie).buttonTextureHelpH;
            buttonTextureHelpI = Ressources.GetLangue(Langue.Choisie).buttonTextureHelpI;
            buttonTextureExitH = Ressources.GetLangue(Langue.Choisie).buttonTextureExitH;
            buttonTextureExitI = Ressources.GetLangue(Langue.Choisie).buttonTextureExitI;

            buttonTextureStart = buttonTextureStartI;
            buttonTextureOptions = buttonTextureOptionsI;
            buttonTextureHelp = buttonTextureHelpI;
            buttonTextureExit = buttonTextureExitI;

            buttonStart = new Button(buttonTextureStart, (int)positionStart.X, (int)positionStart.Y);
            buttonOptions = new Button(buttonTextureOptions, (int)positionOptions.X, (int)positionOptions.Y);
            buttonHelp = new Button(buttonTextureHelp, (int)positionHelp.X, (int)positionHelp.Y);
            buttonExit = new Button(buttonTextureExit, (int)positionExit.X, (int)positionExit.Y);
            buttonStartH = new Button(buttonTextureStartH, (int)positionStart.X, (int)positionStart.Y);
            buttonOptionsH = new Button(buttonTextureOptionsH, (int)positionOptions.X, (int)positionOptions.Y);
            buttonHelpH = new Button(buttonTextureHelpH, (int)positionHelp.X, (int)positionHelp.Y);
            buttonExitH = new Button(buttonTextureExitH, (int)positionExit.X, (int)positionExit.Y);
        }
Esempio n. 2
0
        public void LoadContent(ContentManager Content)
        {
            buttonTextureStartH = Ressources.GetLangue(Langue.Choisie).buttonTextureStartH;
            buttonTextureStartI = Ressources.GetLangue(Langue.Choisie).buttonTextureStartI;
            buttonTextureHelpH = Ressources.GetLangue(Langue.Choisie).buttonTextureHelpH;
            buttonTextureHelpI = Ressources.GetLangue(Langue.Choisie).buttonTextureHelpI;
            buttonTextureMenuH = Ressources.GetLangue(Langue.Choisie).buttonTextureMenuH;
            buttonTextureMenuI = Ressources.GetLangue(Langue.Choisie).buttonTextureMenuI;

            buttonTextureStart = buttonTextureStartI;
            buttonTextureHelp = buttonTextureHelpI;
            buttonTextureMenu = buttonTextureMenuI;

            buttonBack = new Button(buttonTextureStart, (int)positionStart.X, (int)positionStart.Y);
            buttonHelp = new Button(buttonTextureHelp, (int)positionHelp.X, (int)positionHelp.Y);
            buttonMenu = new Button(buttonTextureMenu, (int)positionMenu.X, (int)positionMenu.Y);
            buttonBackH = new Button(buttonTextureStartH, (int)positionStart.X, (int)positionStart.Y);
            buttonHelpH = new Button(buttonTextureHelpH, (int)positionHelp.X, (int)positionHelp.Y);
            buttonMenuH = new Button(buttonTextureMenuH, (int)positionMenu.X, (int)positionMenu.Y);
        }
Esempio n. 3
0
        public void Update(GameTime gameTime, int vitesse)
        {
            #region Déclaration de bouttons
            buttonStart = new Button(buttonTextureStart, (int)positionStart.X, (int)positionStart.Y);
            buttonOptions = new Button(buttonTextureOptions, (int)positionOptions.X, (int)positionOptions.Y);
            buttonHelp = new Button(buttonTextureHelp, (int)positionHelp.X, (int)positionHelp.Y);
            buttonExit = new Button(buttonTextureExit, (int)positionExit.X, (int)positionExit.Y);
            buttonStartH = new Button(buttonTextureStartH, (int)positionStart.X, (int)positionStart.Y);
            buttonOptionsH = new Button(buttonTextureOptionsH, (int)positionOptions.X, (int)positionOptions.Y);
            buttonHelpH = new Button(buttonTextureHelpH, (int)positionHelp.X, (int)positionHelp.Y);
            buttonExitH = new Button(buttonTextureExitH, (int)positionExit.X, (int)positionExit.Y);
            #endregion

            #region Survoler le menu

            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 Changer la texture du bouton survolé

            if (selection == 0)
                buttonTextureStart = buttonTextureStartH;
            else
                buttonTextureStart = buttonTextureStartI;

            if (selection == 1)
                buttonTextureOptions = buttonTextureOptionsH;
            else
                buttonTextureOptions = buttonTextureOptionsI;

            if (selection == 2)
                buttonTextureHelp = buttonTextureHelpH;
            else
                buttonTextureHelp = buttonTextureHelpI;

            if (selection == 3)
                buttonTextureExit = buttonTextureExitH;
            else
                buttonTextureExit = buttonTextureExitI;

            #endregion

            #region Entrée sortie slide buttons
            if (EntreeButtons && !ButtonsIn) //entree
            {
                if (positionStart.Y <= 105)
                    positionStart.Y += vitesse;

                if (positionOptions.Y <= 234)
                    positionOptions.Y += vitesse + 6;

                if (positionHelp.Y <= 363)
                    positionHelp.Y += vitesse + 8;

                if (positionExit.Y <= 492)
                    positionExit.Y += vitesse + 12;

                if (positionExit.Y >= 492)
                    ButtonsIn = true;
            }

            if (SortieButtons && !ButtonsOut) //sortie
            {
                if (positionStart.Y >= -buttonTextureExit.Height)
                    positionStart.Y -= vitesse;

                if (positionOptions.Y >= -buttonTextureExit.Height)
                    positionOptions.Y -= vitesse + 6;

                if (positionHelp.Y >= -buttonTextureExit.Height)
                    positionHelp.Y -= vitesse + 8;

                if (positionExit.Y >= -buttonTextureExit.Height)
                    positionExit.Y -= vitesse + 12;

                if (positionExit.Y <= -buttonTextureExit.Height)
                    ButtonsOut = true;
            }
            #endregion

            #region Entrée

            if (KB.New.IsKeyDown(Keys.Enter) && !KB.Old.IsKeyDown(Keys.Enter))
            {
                EntreeButtons = false; //arreter l'entrée
                SortieButtons = true;  //démarrer la sortie
            }

            if (ButtonsOut)
            {
                if (selection == 0) //play
                {
                    GameState.State = "menuMode";
                    //initialiser la selection à 0 donc sur start
                    selection = 0;

                    //entrée des buttons
                    EntreeButtons = true;
                    ButtonsIn = false;
                    SortieButtons = false;
                    ButtonsOut = false;
                }

                if (selection == 2) //aide
                {
                    GameState.State = "menuAide";
                    //initialiser la selection à 0 donc sur start
                    selection = 0;

                    //entrée des buttons
                    EntreeButtons = true;
                    ButtonsIn = false;
                    SortieButtons = false;
                    ButtonsOut = false;
                }

                if (selection == 1) //options
                {
                    GameState.State = "menuOptions";
                    //initialiser la selection à 0 donc sur start
                    selection = 0;

                    //entrée des buttons
                    EntreeButtons = true;
                    ButtonsIn = false;
                    SortieButtons = false;
                    ButtonsOut = false;
                }

                if (selection == 3) //exit
                {
                    System.Environment.Exit(0);
                }
            }

            #endregion
        }
Esempio n. 4
0
        public void Update(GameTime gameTime, int vitesse)
        {
            #region Déclaration de bouttons
            buttonBack = new Button(buttonTextureStart, (int)positionStart.X, (int)positionStart.Y);
            buttonHelp = new Button(buttonTextureHelp, (int)positionHelp.X, (int)positionHelp.Y);
            buttonMenu = new Button(buttonTextureMenu, (int)positionMenu.X, (int)positionMenu.Y);
            buttonBackH = new Button(buttonTextureStartH, (int)positionStart.X, (int)positionStart.Y);
            buttonHelpH = new Button(buttonTextureHelpH, (int)positionHelp.X, (int)positionHelp.Y);
            buttonMenuH = new Button(buttonTextureMenuH, (int)positionMenu.X, (int)positionMenu.Y);
            #endregion

            #region Survoler le menu

            if (selection == -1) //pour que la selection ne dépasse pas les negatifs
                selection = 2;
            else
                selection = selection % 3; //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 Changer la texture du bouton survolé

            if (selection == 0)
                buttonTextureStart = buttonTextureStartH;
            else
                buttonTextureStart = buttonTextureStartI;

            if (selection == 1)
                buttonTextureHelp = buttonTextureHelpH;
            else
                buttonTextureHelp = buttonTextureHelpI;

            if (selection == 2)
                buttonTextureMenu = buttonTextureMenuH;
            else
                buttonTextureMenu = buttonTextureMenuI;

            #endregion

            #region Entrée sortie slide buttons

            if (EntreeButtons && !ButtonsIn) //entree
            {
                if (positionStart.Y <= 105)
                    positionStart.Y += vitesse;

                if (positionHelp.Y <= 234)
                    positionHelp.Y += vitesse + 6;

                if (positionMenu.Y <= 363)
                    positionMenu.Y += vitesse + 8;

                if (positionMenu.Y >= 363)
                    ButtonsIn = true;
            }

            if (SortieButtons && !ButtonsOut) //sortie
            {
                if (positionStart.Y >= -buttonTextureMenu.Height)
                    positionStart.Y -= vitesse;

                if (positionHelp.Y >= -buttonTextureMenu.Height)
                    positionHelp.Y -= vitesse + 6;

                if (positionMenu.Y >= -buttonTextureMenu.Height)
                    positionMenu.Y -= vitesse + 8;

                if (positionMenu.Y <= -buttonTextureMenu.Height)
                    ButtonsOut = true;
            }
            #endregion

            #region Entrée

            if (KB.New.IsKeyDown(Keys.Enter) && !KB.Old.IsKeyDown(Keys.Enter)) //confirmation
            {
                EntreeButtons = false;
                SortieButtons = true;
            }

            if (ButtonsOut) //si les buttons sont sortis
            {
                if (selection == 0) //si c'est sur start
                {
                    GameState.State = "multiInGame";

                    //mise à 0 des variables
                    EntreeButtons = true;
                    ButtonsIn = false;
                    SortieButtons = false;
                    ButtonsOut = false;
                    selection = 0;
                }

                if (selection == 1) //si c'est sur aide
                {
                    GameState.State = "menuPauseAide";

                    //mise à 0 des variables
                    EntreeButtons = true;
                    ButtonsIn = false;
                    SortieButtons = false;
                    ButtonsOut = false;
                    selection = 0;
                }

                if (selection == 2) //si c'est sur Menu (back to menu dans ce cas)
                {
                    GameState.State = "initial";

                    //mise à 0 des variables
                    EntreeButtons = true;
                    ButtonsIn = false;
                    SortieButtons = false;
                    ButtonsOut = false;
                    selection = 0;
                }

            }

            #endregion
        }