예제 #1
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            float timer = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            _no_co.Update(timer, server);

            //KEYBOARD
            if (_statut_bouton == Statut_Bouton.Normal || _statut_bouton == Statut_Bouton.Attente_Confirmation || _statut_bouton == Statut_Bouton.Deja_Pris)
            {
                if (keyboard._tapped)
                {
                    if (keyboard._type_tapped == Keyboard.TypeLettre.Lettre)
                    {
                        if (_name.Length < nombre_max_name)
                        {
                            if (_name.Length == 0)
                            {
                                keyboard.Changer_en_MIN();
                                isMaj = false;
                            }
                            _name += keyboard._letter_tapped;
                            _error_nbr_letters = false;
                            if (_statut_bouton == Statut_Bouton.Deja_Pris || _statut_bouton == Statut_Bouton.Attente_Confirmation)
                            {
                                Statut_Normal();
                            }
                        }
                        else
                        {
                            _error_trop_de_letters = true;
                        }
                    }
                    else if (keyboard._type_tapped == Keyboard.TypeLettre.Effacer)
                    {
                        if (_name.Length > 0)
                        {
                            _name = _name.Remove(_name.Length - 1, 1);
                            if (_statut_bouton == Statut_Bouton.Attente_Confirmation || _statut_bouton == Statut_Bouton.Deja_Pris)
                            {
                                Statut_Normal();
                            }
                        }
                    }
                    else if (keyboard._type_tapped == Keyboard.TypeLettre.Maj_Min)
                    {
                        Inverser_MAJ();
                    }

                    keyboard.Reboot_Variable();
                }
            }

            if (server.Info_Attente_Check())
            {
                if (_statut_bouton == Statut_Bouton.Attente_Verification)
                {
                    string data   = server.Recuperer_Info();
                    bool   result = false;

                    if (data == "true")
                    {
                        result = true;
                    }
                    else if (data == "false")
                    {
                        result = false;
                    }

                    if (result)
                    {
                        Statut_Already_Take();
                    }
                    else
                    {
                        Statut_Bon();
                    }
                }
                else if (_statut_bouton == Statut_Bouton.Envoie_Confirmation)
                {
                    string   data       = server.Recuperer_Info();
                    string[] data_array = data.Split(' ');

                    string id = "0", code = "0";                     //ASSIGNE
                    id   = data_array [0].ToString();
                    code = data_array [1].ToString();
                    IsolatedStorageSettings.ApplicationSettings ["id"]   = id;
                    IsolatedStorageSettings.ApplicationSettings ["code"] = code;

                    Valider();
                }
            }

            if (_name.Length < nombre_max_name)
            {
                _error_trop_de_letters = false;
            }

            if (_loading != null & _statut_bouton == Statut_Bouton.Attente_Verification || _statut_bouton == Statut_Bouton.Envoie_Confirmation)
            {
                _loading.Update(timer);
            }

            keyboard.Update_Timer(timer);

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.ExitScreen();
                ScreenManager.AddScreen(new MainMenuScreen());
            }

            float timer = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            transition.Update_Transition(timer);

            _no_co.Update(timer, server);

            if (!popup.is_active)
            {
                _loading.Update(timer);
            }
            else
            {
                GestionFin_Popup();
                popup.Update(timer);
            }

            if (!popup.is_active)
            {
                if (server.Info_Attente_Check())
                {
                    string   blbl = server.Recuperer_Info();
                    string[] data = blbl.Split(' ');

                    if (!is_dans_salle_attente)
                    {
                        if (data [0] == "true")
                        {
                            is_dans_salle_attente = true;
                            server.Verifier_Partie_trouver(_id, _code);
                        }
                        else
                        {
                            server.Ajout_Joueur_Liste_Attente(_id, _code);
                        }
                    }
                    else
                    {
                        if (data [0] == "true")
                        {
                            Adversaire_Found(data [1]);
                        }
                    }
                }
                if (is_dans_salle_attente)
                {
                    if (!server.Echange_en_cours && _timer_ping_partie.IncreaseTimer(timer))
                    {
                        server.Verifier_Partie_trouver(_id, _code);
                    }
                }
            }



            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }