//Write out player names void SetUpPlayerNamesAndTable() { //SetUp: Name label PlayerOneNameL.Invoke((MethodInvoker)(() => PlayerOneNameL.Visible = true)); PlayerTwoNameL.Invoke((MethodInvoker)(() => PlayerTwoNameL.Visible = true)); //SetuUp: ELO label PlayerOneELOLabel.Invoke((MethodInvoker)(() => PlayerOneELOLabel.Visible = true)); PlayerTwoELOLabel.Invoke((MethodInvoker)(() => PlayerTwoELOLabel.Visible = true)); PlayerOneELORankLabel.Invoke((MethodInvoker)(() => PlayerOneELORankLabel.Visible = true)); PlayerTwoELORankLabel.Invoke((MethodInvoker)(() => PlayerTwoELORankLabel.Visible = true)); //SetUp: Name PlayerOneNameL.Invoke((MethodInvoker)(() => PlayerOneNameL.Text = "[ " + table.players[0].Name + " ]")); PlayerTwoNameL.Invoke((MethodInvoker)(() => PlayerTwoNameL.Text = "[ " + table.players[1].Name + " ]")); //SetuUp: ELO Thread a = new Thread(SetUpPlayerDatas); a.Start(); //SetUp: Table POUPG = PlayerOneUnitsP.CreateGraphics(); PTUPG = PlayerTwoUnitsP.CreateGraphics(); Graphics[] c = { PTUPG, POUPG }; foreach (Graphics u in c) { u.DrawRectangle(Pens.Black, 0, 0, 130, 26); } }
//Reset! public void Reset() { //Game win/lose || dodge too if (table.endgame != 2) { if (table.players.Find((v) => v != table.players[table.endgame]) == PlayerOne) { int val = kliens.GameEnd(PlayerOne, table.players[table.endgame]); endform.Win(val); } else { endform.Lose(); } } else { int val = kliens.GameEnd(PlayerOne, table.players.Find((v) => v.Name != PlayerOne.Name)); endform.Win(val); } //Reset: Game table = null; kliens = new Client(PlayerOne, getplayermove, findmatch, richTextBox1, resetgame, this); richTextBox1.Invoke((MethodInvoker)(() => richTextBox1.Text += "--------------------------")); StartButton.Invoke((MethodInvoker)(() => StartButton.Visible = true)); //Reset: Sakk label PlayerOneSakkL.Invoke((MethodInvoker)(() => PlayerOneSakkL.Visible = false)); PlayerTwoSakkL.Invoke((MethodInvoker)(() => PlayerTwoSakkL.Visible = false)); //Reset: Name label PlayerOneNameL.Invoke((MethodInvoker)(() => PlayerOneNameL.Visible = false)); PlayerTwoNameL.Invoke((MethodInvoker)(() => PlayerTwoNameL.Visible = false)); //SetuUp: ELO label PlayerOneELOLabel.Invoke((MethodInvoker)(() => PlayerOneELOLabel.Visible = false)); PlayerTwoELOLabel.Invoke((MethodInvoker)(() => PlayerTwoELOLabel.Visible = false)); PlayerOneELORankLabel.Invoke((MethodInvoker)(() => PlayerOneELORankLabel.Visible = false)); PlayerTwoELORankLabel.Invoke((MethodInvoker)(() => PlayerTwoELORankLabel.Visible = false)); Graphics[] c = { PTUPG, POUPG }; graphics.FillRectangle(Brushes.WhiteSmoke, 0, 0, 216, 216); foreach (Graphics u in c) { u.FillRectangle(Brushes.WhiteSmoke, 0, 0, 131, 27); } c = null; }