Exemple #1
0
        public void Join(Client P2)
        {
            Player2 = new XandO_Player(P2);

            GamePoolThread = new Thread(GamePool);
            GamePoolThread.Start();
        }
Exemple #2
0
        public XandO(Client P1, NotificableClient NotificableP2, List <Game> Games, string Username)
        {
            this.Games = Games;
            Player1    = new XandO_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_XandO, base.GameId, Username });
        }