public void Join(Client P2) { Player2 = new BounceGame_Player(P2); GamePoolThread = new Thread(GamePool); GamePoolThread.Start(); }
public BounceGame(Client P1, NotificableClient NotificableP2, List <Game> Games, string Username) { this.Games = Games; Player1 = new BounceGame_Player(P1); Thread TimeOut = new Thread(() => { while (this.Player2 == null) { Thread.Sleep(1000); } }); TimeOut.Start(); new Thread(() => { if (!TimeOut.Join(TimeSpan.FromSeconds(20))) { Player1.Dispose(); Games.Remove(this); } }).Start(); NotificableP2.Send(new string[] { _Details.GameInvitation_Bounce, base.GameId, Username }); }