public void Update(float timer, Echange_Server_Class server)
 {
     if (_statut == No_Connection_POPUP.Statut_Popup.Wait)
     {
         if (server.Test_Connection(timer))
         {
             _statut = No_Connection_POPUP.Statut_Popup.Active;
         }
     }
 }
        public override void LoadContent()
        {
            width  = ScreenManager.GraphicsDevice.Viewport.Width;
            height = ScreenManager.GraphicsDevice.Viewport.Height;
            r      = new Rectangle(0, 0, width, height);

            font_manage = new Police_Size_Manage(height, width, this);
            font        = font_manage.Get_Regular_Font();

            string_1        = langue.getString(43);
            bouton_1_string = langue.getString(44);
            bouton_2_string = langue.getString(21);

            _no_co = new No_Connection_POPUP(this);

            _code = (string)IsolatedStorageSettings.ApplicationSettings ["code"];
            _id   = (string)IsolatedStorageSettings.ApplicationSettings ["id"];

            int _loading_height = (int)(width * 0.05);

            _position_texte   = new Vector2((float)(width / 2 - font.MeasureString(string_1).X *font_manage._scale / 2), (float)(height * 0.3));
            _position_loading = new Vector2((float)(width * 0.6 + font.MeasureString(string_1).X *font_manage._scale / 2), (float)(height * 0.3 + font.MeasureString(string_1).Y *font_manage._scale / 2));

            Vector2 bouton_taille     = new Vector2((float)(width * 0.5), (float)(height * 0.15));
            Vector2 position_bouton_1 = new Vector2((float)(width / 2 - bouton_taille.X / 2), (float)(height * 0.45));

            Rectangle r1    = new Rectangle((int)(position_bouton_1.X), (int)(position_bouton_1.Y), (int)(bouton_taille.X), (int)(bouton_taille.Y));
            Rectangle r2    = new Rectangle((int)(position_bouton_1.X), (int)(height * 0.65), (int)(bouton_taille.X), (int)(bouton_taille.Y));
            int       marge = (int)(r1.Height * 0.1);

            _bouton_1 = new Bouton(this, r1, font, bouton_1_string, marge, 0, Color.White, color_bouton, font_manage._scale);
            _bouton_2 = new Bouton(this, r2, font, bouton_2_string, marge, 0, Color.White, color_bouton, font_manage._scale);

            _loading = new LoadingSprite(this, _loading_height, _position_loading, color_texte);

            if (server == null)
            {
                server = new Echange_Server_Class();
                server.Ajout_Joueur_Liste_Attente(_id, _code);
            }
            else
            {
                if (!server.Echange_en_cours)
                {
                    server.Verifier_Partie_trouver(_id, _code);
                }
            }
            popup = new Adversaire_Found_POPUP(this, server);

            base.LoadContent();
        }
예제 #3
0
        public override void HandleInput(InputState input)
        {
            if (_no_co._statut != No_Connection_POPUP.Statut_Popup.Wait)
            {
                _no_co.Input(input);
                if (_no_co._statut == No_Connection_POPUP.Statut_Popup.Option_1)
                {
                    _no_co._statut = No_Connection_POPUP.Statut_Popup.Wait;
                    Statut_Normal();
                    _name = "";
                    keyboard.Changer_en_MAJ();
                    server = new Echange_Server_Class();
                }
                else if (_no_co._statut == No_Connection_POPUP.Statut_Popup.Option_2)
                {
                    No_Name();
                }
            }
            else
            {
                keyboard.Input_Keyboard(input);

                foreach (GestureSample gesture in input.Gestures)
                {
                    if (gesture.GestureType == GestureType.Tap)
                    {
                        if (_statut_bouton == Statut_Bouton.Normal && bouton_1.Input(gesture.Position))
                        {
                            Check();
                        }
                        else if (_statut_bouton == Statut_Bouton.Attente_Confirmation && bouton_1.Input(gesture.Position))
                        {
                            Statut_Envoie();
                        }

                        else if (gesture.Position.X > _quit_position.X &&
                                 gesture.Position.X < _quit_position.X + (_quit_texture.Width * font_manage._scale) &&
                                 gesture.Position.Y > _quit_position.Y &&
                                 gesture.Position.Y < _quit_position.Y + (_quit_texture.Height * font_manage._scale))
                        {
                            No_Name();
                        }
                    }
                }
            }

            base.HandleInput(input);
        }
 public override void HandleInput(InputState input)
 {
     if (_no_co._statut != No_Connection_POPUP.Statut_Popup.Wait)
     {
         _no_co.Input(input);
         if (_no_co._statut == No_Connection_POPUP.Statut_Popup.Option_1)
         {
             _no_co._statut = No_Connection_POPUP.Statut_Popup.Wait;
             server.CloseConnection();
             server = new Echange_Server_Class();
             server.Ajout_Joueur_Liste_Attente(_id, _code);
         }
         else if (_no_co._statut == No_Connection_POPUP.Statut_Popup.Option_2)
         {
             server.CloseConnection();
             this.ExitScreen();
             ScreenManager.AddScreen(new MainMenuScreen());
         }
     }
     else if (popup.is_active)
     {
         popup.Input(input);
     }
     else
     {
         foreach (GestureSample gesture in input.Gestures)
         {
             if (gesture.GestureType == GestureType.Tap)
             {
                 if (_bouton_1.Input(gesture.Position))
                 {
                     this.ExitScreen();
                     ScreenManager.AddScreen(new PlayClass(server, is_dans_salle_attente));
                 }
                 if (_bouton_2.Input(gesture.Position))
                 {
                     server.CloseConnection();
                     this.ExitScreen();
                     ScreenManager.AddScreen(new MainMenuScreen());
                 }
             }
         }
     }
     base.HandleInput(input);
 }
 public RechercheAdversaireClass(Echange_Server_Class _server)
 {
     server = _server;
 }
 public Adversaire_Found_POPUP(GameScreen screen, Echange_Server_Class server)
 {
     _screen = screen;
     _server = server;
     LoadContent();
 }