Example #1
0
        public void Update(ref MenuState state, double mouseCoef, ref bool full, ref bool soun, Sound play, Controles controles)
        {
            sound      = soun;
            fullsSreen = full;
            switch (submenu)
            {
            case SubMenuOpt.general:
                keys.Update(mouseCoef, controles);
                Francais.Update(mouseCoef, controles);
                English.Update(mouseCoef, controles);

                serverAdress.Update(controles);
                if (serverAdress.IsFinish)
                {
                    serverAdress.IsFinish        = false;
                    ConnectMaster.MasterIPAdress = serverAdress.text;
                }

                if (Francais.isCliked)
                {
                    Langage.langueactuelle = Langue.Francais;
                    keys.SetText(new string[] { Langage.getString(Langage.langueactuelle, 36) });
                    English.isCliked = false;
                }
                if (English.isCliked)
                {
                    Langage.langueactuelle = Langue.English;
                    keys.SetText(new string[] { Langage.getString(Langage.langueactuelle, 36) });
                    Francais.isCliked = false;
                }
                if (sound)
                {
                    soundON.Update(mouseCoef, controles);
                }
                else
                {
                    soundOFF.Update(mouseCoef, controles);
                }
                if (fullsSreen)
                {
                    fullsSreenON.Update(mouseCoef, controles);
                }
                else
                {
                    fullsSreenOFF.Update(mouseCoef, controles);
                }

                if (keys.isCliked)
                {
                    submenu       = SubMenuOpt.keys;
                    keys.isCliked = false;
                }
                if (soundON.isCliked)
                {
                    soun             = false;
                    soundON.isCliked = false;
                    play.soundPlayer.Stop();
                }
                if (soundOFF.isCliked)
                {
                    play.sounds[(int)SoundsName.fusil].Play();
                    soun = true;
                    soundOFF.isCliked = false;
                    play.soundPlayer.Play();
                }
                if (fullsSreenON.isCliked)
                {
                    toWindowed            = true;
                    full                  = false;
                    fullsSreenON.isCliked = false;
                }
                if (fullsSreenOFF.isCliked)
                {
                    play.Play(SoundsName.fusil);
                    toFullScreen           = true;
                    full                   = true;
                    fullsSreenOFF.isCliked = false;
                }
                break;

            case SubMenuOpt.keys:
                general.Update(mouseCoef, controles);
                if (general.isCliked)
                {
                    submenu          = SubMenuOpt.general;
                    general.isCliked = false;
                }
                if (controles.keyboard.GetPressedKeys().Length == 1 && controles.oldkeyboard.GetPressedKeys().Length == 0 && controles.keyboard.GetPressedKeys()[0] != Keys.Enter)
                {
                    controles.controleTab[changedKeys] = controles.keyboard.GetPressedKeys()[0];
                    touche = controles.keyboard.GetPressedKeys()[0].ToString();
                }
                if (controles.keyboard.GetPressedKeys().Length == 1 && controles.oldkeyboard.GetPressedKeys().Length == 0 && controles.keyboard.GetPressedKeys()[0] == Keys.Enter)
                {
                    changedKeys++;
                    touche = "";
                }
                if (changedKeys == controles.controleTab.Length)
                {
                    changedKeys = 0;
                    submenu     = SubMenuOpt.general;
                }
                break;

            default:
                break;
            }
        }