public void ProcessRequest(HttpContext context)
 {
     if (context.IsWebSocketRequest)
       {
     var player = new GamePlayer();
     FourInABruGame.Join(player);
     context.AcceptWebSocketRequest(player.SocketReceiver);
       }
 }
Example #2
0
 public static void Join(GamePlayer player)
 {
     GameInProgress currentGame = LookForAvailableGame();
       if (currentGame != null)
       {
     currentGame.Join(player);
       }
       else
       {
     currentGame = new GameInProgress();
     currentGame.GameOver += (game) => { lock (games) games.Remove(game); };
     currentGame.Join(player);
     lock( games )
       games.Add(currentGame);
       }
 }
 public PlayerConnectedMessage(GamePlayer player)
     : base("connect")
 {
     playerNumber = player.PlayerNr;
 }