Esempio n. 1
0
 private void Form2_OnSetEnded(object sender, SetEndedEventArgs e)
 {
     if (e.Joueur == 1)
     {
         if (this.Match.Score1.Point == 3)
         {
             MatchEndedEventArgs meea = new MatchEndedEventArgs(this.Match);
             this.onMatchEnded(this, meea);
             this.Match.Score1.Point = 0;
         }
         else
         {
             this.Match.ListeSet.AddLast(new Set(e.Set));
             if (e.Set.Score1.Point > e.Set.Score2.Point)
                 this.Match.Score1.Point++;
             else if (e.Set.Score1.Point < e.Set.Score2.Point)
                 this.Match.Score2.Point++;
             else
                 this.Match.Score1.Point++;
         }
     }
     else
     {
         if (this.Match.Score2.Point == 3)
         {
             MatchEndedEventArgs meea = new MatchEndedEventArgs(this.Match);
             this.onMatchEnded(this, meea);
             this.Match.Score2.Point = 0;
         }
         else
         {
             this.Match.ListeSet.AddLast(new Set(e.Set));
             if (e.Set.Score1.Point > e.Set.Score2.Point)
                 this.Match.Score1.Point++;
             else if (e.Set.Score1.Point < e.Set.Score2.Point)
                 this.Match.Score2.Point++;
             else
                 this.Match.Score2.Point++;
         }
     }
     this.matchJoueur1ToolBox.Text = this.Match.Score1.Point.ToString();
     this.matchJoueur2ToolBox.Text = this.Match.Score2.Point.ToString();
 }
Esempio n. 2
0
 private void Pong_OnSetEnded(object sender, SetEndedEventArgs e)
 {
     if (e.Joueur == 1)
     {
         if (this.Match.Score1.Point == 3)
         {
             MatchEndedEventArgs meea = new MatchEndedEventArgs(this.Match);
             this.onMatchEnded(this, meea);
             this.Match.Score1.Point = 0;
         }
         else
         {
             this.Match.ListeSet.AddLast(new Set(e.Set));
             if (e.Set.Score1.Point > e.Set.Score2.Point)
                 this.Match.Score1.Point++;
             else if (e.Set.Score1.Point < e.Set.Score2.Point)
                 this.Match.Score2.Point++;
             else
                 this.Match.Score1.Point++;
         }
     }
     else
     {
         if (this.Match.Score2.Point == 3)
         {
             MatchEndedEventArgs meea = new MatchEndedEventArgs(this.Match);
             this.onMatchEnded(this, meea);
             this.Match.Score2.Point = 0;
         }
         else
         {
             this.Match.ListeSet.AddLast(new Set(e.Set));
             if (e.Set.Score1.Point > e.Set.Score2.Point)
                 this.Match.Score1.Point++;
             else if (e.Set.Score1.Point < e.Set.Score2.Point)
                 this.Match.Score2.Point++;
             else
                 this.Match.Score2.Point++;
         }
     }
     this.ScoreTexteJoueur1.Texto = this.ScoreJoueur1.Point.ToString() + " - " +
         this.Jeu.Score1.Point.ToString() + " - " + this.Set.Score1.Point.ToString() + " - " +
         this.Match.Score1.Point.ToString();
     this.ScoreTexteJoueur2.Texto = this.ScoreJoueur2.Point.ToString() + " - " +
         this.Jeu.Score2.Point.ToString() + " - " + this.Set.Score2.Point.ToString() + " - " +
         this.Match.Score2.Point.ToString();
 }
Esempio n. 3
0
 void Form2_onMatchEnded(object sender, MatchEndedEventArgs e)
 {
     if (e.Match.Score1.Point > e.Match.Score2.Point)
         new WinForm("Le Joueur 1 a gagné !").ShowDialog();
     else if (e.Match.Score1.Point < e.Match.Score2.Point)
         new WinForm("Le Joueur 2 a gagné !").ShowDialog();
     else
         new WinForm("Egalite !").ShowDialog();
 }
Esempio n. 4
0
 private void Pong_onMatchEnded(object sender, MatchEndedEventArgs e)
 {
     if (e.Match.Score1.Point > e.Match.Score2.Point)
         new WinForm("Le Joueur 1 a gagné !").ShowDialog();
     else if (e.Match.Score1.Point < e.Match.Score2.Point)
         new WinForm("Le Joueur 2 a gagné !").ShowDialog();
     else
         new WinForm("Egalite !").ShowDialog();
     this.Partie = false;
     this.TimerBalle.Stop();
     this.TimerBalle.Close();
     this.ScoreJoueur1 = new Score();
     this.ScoreJoueur2 = new Score();
     this.Jeu = new Jeu();
     this.Set = new Set();
     this.Match = new Match();
     this.CreateEnvironment();
     this.Parent.NouvellePartieToolStripMenuItem.Enabled = true;
     this.Parent.TerminerLaPartieToolStripMenuItem.Enabled = false;
     this.Parent.JoueursToolStripMenuItem.Enabled = true;
     this.Parent.DifficultéToolStripMenuItem.Enabled = true;
     if (!this.Parent.ManetteController.ManetteController.IsAlive)
     {
         this.Parent.ManetteController.ManetteController = new Thread(this.Parent.ManetteController.ManetteThread);
         this.Parent.ManetteController.ManetteController.Start();
     }
     if ((this.Parent.ClavierToolStripMenuItem.CheckState == CheckState.Checked) ||
         (this.Parent.ClavierToolStripMenuItem1.CheckState == CheckState.Checked))
         this.Parent.KeyDown -= new KeyEventHandler(this.Parent.pictureBox1_KeyDown);
     if ((this.Parent.SourisToolStripMenuItem.CheckState == CheckState.Checked) ||
         (this.Parent.SourisToolStripMenuItem1.CheckState == CheckState.Checked))
     {
         this.Parent.PictureBox1.MouseClick -= new System.Windows.Forms.MouseEventHandler(this.Parent.pictureBox1_MouseClick);
         this.Parent.PictureBox1.MouseMove -= new System.Windows.Forms.MouseEventHandler(this.Parent.pictureBox1_MouseMove);
     }
     if (this.Parent.ManetteController.Manette1Controller.IsAlive)
         this.Parent.ManetteController.Manette1Controller.Abort();
     if (this.Parent.ManetteController.Manette2Controller.IsAlive)
         this.Parent.ManetteController.Manette2Controller.Abort();
     if (this.Parent.AiController.Ai1Controller.IsAlive)
         this.Parent.AiController.Ai1Controller.Abort();
     if (this.Parent.AiController.Ai2Controller.IsAlive)
         this.Parent.AiController.Ai2Controller.Abort();
 }