private void TestForm_OnPointEnded(object sender, PointEndedEventArgs e) { if (e.Joueur == 1) { this.ScoreJoueur1.Point++; switch (this.ScoreJoueur1.Point) { case 0: this.Jeu.Score1.Point = 0; break; case 1: this.Jeu.Score1.Point = 15; break; case 2: this.Jeu.Score1.Point = 30; break; case 3: this.Jeu.Score1.Point = 40; break; case 4: this.ScoreJoueur1 = new Score(); GameEndedEventArgs geea = new GameEndedEventArgs(1, this.Jeu); this.OnGameEnded(this, geea); this.Jeu.Score1.Point = 0; break; } } else { this.ScoreJoueur2.Point++; switch (this.ScoreJoueur2.Point) { case 0: this.Jeu.Score2.Point = 0; break; case 1: this.Jeu.Score2.Point = 15; break; case 2: this.Jeu.Score2.Point = 30; break; case 3: this.Jeu.Score2.Point = 40; break; case 4: this.ScoreJoueur2 = new Score(); GameEndedEventArgs geea = new GameEndedEventArgs(2, this.Jeu); this.OnGameEnded(this, geea); this.Jeu.Score2.Point = 0; break; } } this.scoreJoueur1ToolBox.Text = this.ScoreJoueur1.Point.ToString(); this.jeuJoueur1ToolBox.Text = this.Jeu.Score1.Point.ToString(); this.scoreJoueur2ToolBox.Text = this.ScoreJoueur2.Point.ToString(); this.jeuJoueur2ToolBox.Text = this.Jeu.Score2.Point.ToString(); }
private void Pong_OnGameEnded(object sender, GameEndedEventArgs e) { if (e.Joueur == 1) { if ((this.Set.Score1.Point == 6) && (this.Set.Score1.Point - 2 >= this.Set.Score2.Point)) { SetEndedEventArgs seea = new SetEndedEventArgs(1, this.Set); this.OnSetEnded(this, seea); this.Set.Score1.Point = 0; } else { this.Set.ListeJeu.AddLast(new Jeu(e.Jeu)); if (e.Jeu.Score1.Point > e.Jeu.Score2.Point) this.Set.Score1.Point++; else if (e.Jeu.Score1.Point < e.Jeu.Score2.Point) this.Set.Score2.Point++; else this.Set.Score1.Point++; } } else { if ((this.Set.Score2.Point == 6) && (this.Set.Score2.Point - 2 >= this.Set.Score1.Point)) { SetEndedEventArgs seea = new SetEndedEventArgs(2, this.Set); this.OnSetEnded(this, seea); this.Set.Score2.Point = 0; } else { this.Set.ListeJeu.AddLast(new Jeu(e.Jeu)); if (e.Jeu.Score1.Point > e.Jeu.Score2.Point) this.Set.Score1.Point++; else if (e.Jeu.Score1.Point < e.Jeu.Score2.Point) this.Set.Score2.Point++; else this.Set.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(); }
private void TestForm_OnGameEnded(object sender, GameEndedEventArgs e) { if (e.Joueur == 1) { if ((this.Set.Score1.Point == 6) && (this.Set.Score1.Point - 2 >= this.Set.Score2.Point)) { SetEndedEventArgs seea = new SetEndedEventArgs(1, this.Set); this.OnSetEnded(this, seea); this.Set.Score1.Point = 0; } else { this.Set.ListeJeu.AddLast(new Jeu(e.Jeu)); if (e.Jeu.Score1.Point > e.Jeu.Score2.Point) this.Set.Score1.Point++; else if (e.Jeu.Score1.Point < e.Jeu.Score2.Point) this.Set.Score2.Point++; else this.Set.Score1.Point++; } } else { if ((this.Set.Score2.Point == 6) && (this.Set.Score2.Point - 2 >= this.Set.Score1.Point)) { SetEndedEventArgs seea = new SetEndedEventArgs(2, this.Set); this.OnSetEnded(this, seea); this.Set.Score2.Point = 0; } else { this.Set.ListeJeu.AddLast(new Jeu(e.Jeu)); if (e.Jeu.Score1.Point > e.Jeu.Score2.Point) this.Set.Score1.Point++; else if (e.Jeu.Score1.Point < e.Jeu.Score2.Point) this.Set.Score2.Point++; else this.Set.Score2.Point++; } } this.setJoueur1ToolBox.Text = this.Set.Score1.Point.ToString(); this.setJoueur2ToolBox.Text = this.Set.Score2.Point.ToString(); }
private void Pong_OnPointEnded(object sender, PointEndedEventArgs e) { if (e.Joueur == 1) { this.ScoreJoueur1.Point++; switch (this.ScoreJoueur1.Point) { case 0: this.Jeu.Score1.Point = 0; break; case 1: this.Jeu.Score1.Point = 15; break; case 2: this.Jeu.Score1.Point = 30; break; case 3: this.Jeu.Score1.Point = 40; break; case 4: this.ScoreJoueur1 = new Score(); GameEndedEventArgs geea = new GameEndedEventArgs(1, this.Jeu); this.OnGameEnded(this, geea); this.Jeu.Score1.Point = 0; break; } } else { this.ScoreJoueur2.Point++; switch (this.ScoreJoueur2.Point) { case 0: this.Jeu.Score2.Point = 0; break; case 1: this.Jeu.Score2.Point = 15; break; case 2: this.Jeu.Score2.Point = 30; break; case 3: this.Jeu.Score2.Point = 40; break; case 4: this.ScoreJoueur2 = new Score(); GameEndedEventArgs geea = new GameEndedEventArgs(2, this.Jeu); this.OnGameEnded(this, geea); this.Jeu.Score2.Point = 0; break; } } 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(); }