Beispiel #1
0
        public async Task <ActionResult> AddPlayerAsync([FromBody] PlayerModel player)
        {
            try
            {
                if (player != null)
                {
                    await _playerManager.AddPlayerAsync(player);

                    return(Ok());
                }
                else
                {
                    return(BadRequest("Player payload cannot be empty"));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Error adding player with message: {ex.Message}");
                return(BadRequest(ex.Message));
            }
        }
 //[MethodDescriptor(Name = "Add Player to Game Session", Description = "Adds the target player to the ongoing session. This will lock the target player to the session and then return the player data.", RequiresSession = true)]
 public Task <Player> PlayerJoinAsync(string userId, Single <string> username)
 {
     return(playerManager.AddPlayerAsync(AssertGetSessionToken(), userId, username.Value));
 }