/// <summary> /// Permet d'afficher le menu de configuration bluetooth; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Start_Click(object sender, EventArgs e) { ConfigurationPanel cp = new ConfigurationPanel(this); cp.Show(); this.Hide(); }
/// <summary> /// Constructeur de la fenêtre de la partie /// </summary> /// <param name="joueur">Identifiant permettant de différencier client et serveur</param> /// <param name="form">Fenêtre de configuration bluetooth active</param> /// <param name="nameJoueur">Nom du joueur</param> public Partie(int joueur, ConfigurationPanel form, String nameJoueur) { // Initialisation des variables scoreServer = 0; scoreClient = 0; this.joueur = joueur; this.form = form; // Initialisation des composant graphiques InitializeComponent(); temps.Location = new Point(this.ClientSize.Width / 2 - temps.Width / 2, temps.Location.Y); score.Location = new Point(this.ClientSize.Width / 2 - score.Width / 2, score.Location.Y); ball.Location = new Point(this.ClientSize.Width / 2 - ball.Width / 2, this.ClientSize.Height / 2 - ball.Height / 2); // Création d'un objet Balle permettant de manipuler le composant graphique ball b = new Balle(ball.Location.X, ball.Location.Y); // Initialisation de l'évènement des touches du clavier KeyDown += new KeyEventHandler(Partie_KeyDown); // Si le joueur est du côté client if (joueur == 1) { // On cache la balle et on change place la raquette ball.Visible = false; raquette.Location = new Point(this.ClientSize.Width - 46, this.ClientSize.Height / 2 - raquette.Height / 2); // On retourne les images affichées Image img = raquette.Image; img.RotateFlip(RotateFlipType.Rotate180FlipNone); raquette.Image = img; Image img_terrain = this.BackgroundImage; img_terrain.RotateFlip(RotateFlipType.Rotate180FlipNone); this.BackgroundImage = img_terrain; // On attribut le nom du joueur client nameClient = nameJoueur; nameServer = ""; } else { // On place la raquette raquette.Location = new Point(raquette.Location.X, this.ClientSize.Height / 2 - raquette.Height / 2); // On attribut le nom du joueur serveur nameServer = nameJoueur; nameClient = ""; } }