public Entities.JoinResponse Execute(Entities.Game game, Entities.User user, String passphrase, Entities.Enums.GamePlayerType playerType)
{
Entities.JoinResponse response = new Entities.JoinResponse();
Boolean wasWaiting = game.IsWaiting();
if (game.GameOver.HasValue)
{
response.Result = Entities.Enums.Game.JoinResponseCode.GameOver;
}
else
{
if (playerType == Entities.Enums.GamePlayerType.Spectator)
{
AsSpectator(game, user, passphrase, response);
}
else
{
AsPlayer(game, user, passphrase, response, wasWaiting);
}
}
return response;
}