private void ListPlayersImpl(ListPlayersReq req, ListPlayersResp resp) { resp.Players = Server.GameManager .ListPlayers(Server.TeamRegistry.GetTeam(req.Auth.TeamName)) .Select(p => new EnPlayerInfo(p)) .ToList(); }
public async Task <IEnumerable <Player> > ListPlayersAsync() { using (var adminService = new AdminServiceClient(new BasicHttpBinding(), new EndpointAddress(ConnectionData.Url))) { int sequenceNumber = SequenceNumber; var listPlayersReq = new ListPlayersReq { Auth = new ReqAuth { ClientName = ConnectionData.Username, TeamName = ConnectionData.TeamName, SessionId = _sessionId, SequenceNumber = sequenceNumber, AuthCode = GetAuthCode(string.Format("{0}:{1}:{2}:{3}{4}", ConnectionData.TeamName, ConnectionData.Username, _sessionId, sequenceNumber, ConnectionData.Password)), }, }; _stopwatch.Start(); var listPlayersResp = await adminService.ListPlayersAsync(listPlayersReq); _stopwatch.Stop(); LastCallTime = _stopwatch.ElapsedMilliseconds; _stopwatch.Reset(); if (listPlayersResp.Status != "OK") { throw new Exception(listPlayersResp.Message); } var players = listPlayersResp.Players.Select(p => new Player { Name = p.Name, GameId = p.GameId, PlayerId = p.PlayerId, Team = p.Team, }); return(players); } }
public ListPlayersResp ListPlayers(ListPlayersReq req) { return(HandleServiceCall(req, new ListPlayersResp(), ListPlayersImpl)); }