Exemplo n.º 1
0
 public void Update(float timer)
 {
     if (_multi_quit_partie)
     {
         _loading.Update(timer);
     }
 }
        public void Update(float timer)
        {
            if (!_out_of_time && !_adversaire_refuse && !_ping_partie)
            {
                if (_timer.IncreaseTimer(timer))
                {
                    _server.Client_Valid_Or_Refuse_Game(_id, _id_partie_found, _code, "0");
                    _out_of_time = true;
                    _ping_partie = false;
                    Reset_Bouton_Phase_2();
                }
            }

            if (_server.Echange_en_cours)
            {
                _loading.Update(timer);
            }
            if (_server.Info_Attente_Check())
            {
                string   blbl = _server.Recuperer_Info();
                string[] data = blbl.Split(' ');
                if (data [0] == "ok")
                {
                    statut = Statut_Pop_Up.Refuse;
                }
                else if (data [0] == "ERREUR" || data [0] == "4")
                {
                    _out_of_time = true;
                    _ping_partie = false;
                    Reset_Bouton_Phase_2();
                }
                else if (data [0] == "3")
                {
                    _adversaire_refuse = true;
                    _ping_partie       = false;
                    Reset_Bouton_Phase_2();
                }
                else if (data [0] == "2")
                {
                    statut = Statut_Pop_Up.Partie_found;
                    data_game.Add(data [1]);
                    data_game.Add(data [2]);
                    data_game.Add(data [3]);
                    data_game.Add(data [4]);
                    data_game.Add(data [5]);
                    data_game.Add(data [6]);
                    data_game.Add(data [7]);
                }
                else if (data [0] == "1")
                {
                    _ping_partie = true;
                }
            }

            if (_ping_partie && _timer_ping.IncreaseTimer(timer))
            {
                _server.Client_Valid_Or_Refuse_Game(_id, _id_partie_found, _code, "1");
            }
        }
Exemplo n.º 3
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);
        }