Example #1
0
 public void DropPlayer(int playerId, int gameId, ClientCode clientCode, Team team)
 {
     lock (_gameLock)
     {
         Player player = getPlayer(playerId);
         if (team != null)
         {
             checkPlayerAccess(player, team);
         }
         else
         {
             checkPlayerAccess(player, clientCode);
         }
         Game game = player.Game;
         if (game == null)
         {
             throw new ApplicationException("Player is not in a game");
         }
         if (gameId > 0 && game.GameId != gameId)
         {
             throw new ApplicationException("Player is not in the specified game");
         }
         game.DropPlayer(player, clientCode.ToString());
     }
 }
Example #2
0
 public void LeaveGame(int playerId, ClientCode clientCode)
 {
     lock (_gameLock)
     {
         Player player = getPlayer(playerId);
         checkPlayerAccess(player, clientCode);
         GameModel game = player.Game;
         if (game == null)
         {
             return;
         }
         game.DropPlayer(player, clientCode.ToString());
     }
 }
Example #3
0
 public void DropPlayer(int playerId, int gameId, ClientCode clientCode, Team team)
 {
     lock (_gameLock)
     {
         Player    player = getPlayer(playerId);
         GameModel game   = getGame(gameId);
         checkGameChange(game, team);
         if (player.Game != game)
         {
             throw new ApplicationException("Player is not in this game");
         }
         game.DropPlayer(player, clientCode.ToString());
     }
 }