private void SendPlayerList(PlayerConnection connection) { var players = playerProvider.GetPlayers(connection.User).ToArray(); var appearances = players.Select(x => gameData.GetAppearance(x.AppearanceId)).ToArray(); connection.Send(UserPlayerList.Create(gameData, players, appearances), SendOption.Reliable); }
public IActionResult GetPlayers() { try { var user = User.Claims.FirstOrDefault(x => x.Type == "User"); if (user == null) { return(Unauthorized("Bad token")); } var players = _playerService.GetPlayers(); if (players.Count > 0) { return(Ok(players)); } else { return(BadRequest("Something failed")); } } catch (Exception ex) { return(Problem("Something is broke, yo")); } }
public List <Player> GetPlayers() { return(_playerProvider.GetPlayers().OrderBy(p => p.Id).ToList()); }