예제 #1
0
 public void Pong_OnSetEnded(object sender, SetEndedEventArgs e)
 {
     if (e.Joueur == 1)
     {
         if (this.Parent.Match.Score1.Point == 3)
         {
             MatchEndedEventArgs meea = new MatchEndedEventArgs(this.Parent.Match);
             this.onMatchEnded(this, meea);
             this.Parent.Match.Score1.Point = 0;
         }
         else
         {
             this.Parent.Match.ListeSet.AddLast(new Set(e.Set));
             if (e.Set.Score1.Point > e.Set.Score2.Point)
                 this.Parent.Match.Score1.Point++;
             else if (e.Set.Score1.Point < e.Set.Score2.Point)
                 this.Parent.Match.Score2.Point++;
             else
                 this.Parent.Match.Score1.Point++;
         }
     }
     else
     {
         if (this.Parent.Match.Score2.Point == 3)
         {
             MatchEndedEventArgs meea = new MatchEndedEventArgs(this.Parent.Match);
             this.onMatchEnded(this, meea);
             this.Parent.Match.Score2.Point = 0;
         }
         else
         {
             this.Parent.Match.ListeSet.AddLast(new Set(e.Set));
             if (e.Set.Score1.Point > e.Set.Score2.Point)
                 this.Parent.Match.Score1.Point++;
             else if (e.Set.Score1.Point < e.Set.Score2.Point)
                 this.Parent.Match.Score2.Point++;
             else
                 this.Parent.Match.Score2.Point++;
         }
     }
 }
예제 #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++;
         }
     }
 }