Ejemplo n.º 1
0
 public void Pong_OnPointEnded(object sender, PointEndedEventArgs e)
 {
     if (e.Joueur == 1)
     {
         this.Parent.ScoreJoueur1.Point++;
         switch (this.Parent.ScoreJoueur1.Point)
         {
             case 0:
                 this.Parent.Jeu.Score1.Point = 0;
                 break;
             case 1:
                 this.Parent.Jeu.Score1.Point = 15;
                 break;
             case 2:
                 this.Parent.Jeu.Score1.Point = 30;
                 break;
             case 3:
                 this.Parent.Jeu.Score1.Point = 40;
                 break;
             case 4:
                 this.Parent.ScoreJoueur1 = new Score();
                 GameEndedEventArgs geea = new GameEndedEventArgs(1, this.Parent.Jeu);
                 this.OnGameEnded(this, geea);
                 this.Parent.Jeu.Score1.Point = 0;
                 break;
         }
     }
     else
     {
         this.Parent.ScoreJoueur2.Point++;
         switch (this.Parent.ScoreJoueur2.Point)
         {
             case 0:
                 this.Parent.Jeu.Score2.Point = 0;
                 break;
             case 1:
                 this.Parent.Jeu.Score2.Point = 15;
                 break;
             case 2:
                 this.Parent.Jeu.Score2.Point = 30;
                 break;
             case 3:
                 this.Parent.Jeu.Score2.Point = 40;
                 break;
             case 4:
                 this.Parent.ScoreJoueur2 = new Score();
                 GameEndedEventArgs geea = new GameEndedEventArgs(2, this.Parent.Jeu);
                 this.OnGameEnded(this, geea);
                 this.Parent.Jeu.Score2.Point = 0;
                 break;
         }
     }
 }
Ejemplo n.º 2
0
 public void Pong_OnGameEnded(object sender, GameEndedEventArgs e)
 {
     if (e.Joueur == 1)
     {
         if ((this.Parent.Set.Score1.Point == 6) && (this.Parent.Set.Score1.Point - 2 >= this.Parent.Set.Score2.Point))
         {
             SetEndedEventArgs seea = new SetEndedEventArgs(1, this.Parent.Set);
             this.OnSetEnded(this, seea);
             this.Parent.Set.Score1.Point = 0;
         }
         else
         {
             this.Parent.Set.ListeJeu.AddLast(new Jeu(e.Jeu));
             if (e.Jeu.Score1.Point > e.Jeu.Score2.Point)
                 this.Parent.Set.Score1.Point++;
             else if (e.Jeu.Score1.Point < e.Jeu.Score2.Point)
                 this.Parent.Set.Score2.Point++;
             else
                 this.Parent.Set.Score1.Point++;
         }
     }
     else
     {
         if ((this.Parent.Set.Score2.Point == 6) && (this.Parent.Set.Score2.Point - 2 >= this.Parent.Set.Score1.Point))
         {
             SetEndedEventArgs seea = new SetEndedEventArgs(2, this.Parent.Set);
             this.OnSetEnded(this, seea);
             this.Parent.Set.Score2.Point = 0;
         }
         else
         {
             this.Parent.Set.ListeJeu.AddLast(new Jeu(e.Jeu));
             if (e.Jeu.Score1.Point > e.Jeu.Score2.Point)
                 this.Parent.Set.Score1.Point++;
             else if (e.Jeu.Score1.Point < e.Jeu.Score2.Point)
                 this.Parent.Set.Score2.Point++;
             else
                 this.Parent.Set.Score2.Point++;
         }
     }
 }