//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; }
//Sakkfor public void OnSakkFor(Player a) { if (a == null) { PlayerOneSakkL.Invoke((MethodInvoker)(() => PlayerOneSakkL.Visible = false)); PlayerTwoSakkL.Invoke((MethodInvoker)(() => PlayerTwoSakkL.Visible = false)); } if (a == table.players[0]) { PlayerOneSakkL.Invoke((MethodInvoker)(() => PlayerOneSakkL.Visible = true)); } if (a == table.players[1]) { PlayerTwoSakkL.Invoke((MethodInvoker)(() => PlayerTwoSakkL.Visible = true)); } }