コード例 #1
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

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

            transition.Update_Transition(timer);
        }
コード例 #2
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.ExitScreen();
                ScreenManager.AddScreen(new Name_Screen(true));
            }

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

            if (server.Test_Connection(timer))
            {
                server.CloseConnection();
            }

            Execution_Screen();
            transition.Update_Transition(timer);


            if (server.Info_Attente_Check())
            {
                string   data       = server.Recuperer_Info();
                string[] data_array = data.Split(' ');


                if (id != null)
                {
                    if (data_array [0] == "false")
                    {
                        id = null;
                        Random _rand = new Random();
                        int    blblb = _rand.Next(1, 1000000);
                        if (langue.lang == "FR")
                        {
                            IsolatedStorageSettings.ApplicationSettings ["name"] = "Joueur" + blblb.ToString();
                            player_name = "Joueur" + blblb.ToString();
                        }
                        else
                        {
                            IsolatedStorageSettings.ApplicationSettings ["name"] = "Guest" + blblb.ToString();
                            player_name = "Guest" + blblb.ToString();
                        }
                        server.Check_Name(player_name);
                    }
                    else
                    {
                        for (int i = 0; i < data_array.Length; i++)
                        {
                            if (data_array [i] == null)
                            {
                                data_array [i] = "0";
                            }
                        }

                        red_win     = data_array [0];
                        green_win   = data_array [1];
                        player_game = data_array [2];
                        player_win  = data_array [3];
                        player_elo  = data_array [4];
                        player_rank = data_array [5];

                        IsolatedStorageSettings.ApplicationSettings ["red_win"]     = red_win;
                        IsolatedStorageSettings.ApplicationSettings ["green_win"]   = green_win;
                        IsolatedStorageSettings.ApplicationSettings ["elo"]         = player_elo;
                        IsolatedStorageSettings.ApplicationSettings ["player_game"] = player_game;
                        IsolatedStorageSettings.ApplicationSettings ["rank"]        = player_rank;
                        IsolatedStorageSettings.ApplicationSettings ["player_win"]  = player_win;

                        //ADRESS PORT SERVER
                        if (data_array.Length > 6)
                        {
                            IsolatedStorageSettings.ApplicationSettings ["adresse_ip"] = data_array [6];
                            IsolatedStorageSettings.ApplicationSettings ["port"]       = data_array [7];
                        }
                    }
                }
                else if (!_name_check)
                {
                    if (data_array [0] == "false")
                    {
                        _name_check = true;
                        server.Nouveau_Joueur(player_name, side);
                    }
                    else
                    {
                        Random _rand = new Random();
                        int    blblb = _rand.Next(1, 1000000);
                        if (langue.lang == "FR")
                        {
                            IsolatedStorageSettings.ApplicationSettings ["name"] = "Joueur" + blblb.ToString();
                            player_name = "Joueur" + blblb.ToString();
                        }
                        else
                        {
                            IsolatedStorageSettings.ApplicationSettings ["name"] = "Guest" + blblb.ToString();
                            player_name = "Guest" + blblb.ToString();
                        }
                        server.Check_Name(player_name);
                    }
                }
                else if (_name_check && !_envoie_name)
                {
                    string code = "0";                     //ASSIGNE
                    id   = data_array [0].ToString();
                    code = data_array [1].ToString();
                    IsolatedStorageSettings.ApplicationSettings ["id"]   = id;
                    IsolatedStorageSettings.ApplicationSettings ["code"] = code;
                }
            }

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
コード例 #3
0
        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);
        }