public override async Task <OpenLobbiesResponse> GetOpenLobbies(OpenLobbiesRequest request, ServerCallContext context) { DbUserModel dbUserModel = context.UserState["user"] as DbUserModel; if (dbUserModel == null) { return new OpenLobbiesResponse() { Status = ResponseFactory.createResponse(ResponseType.UNAUTHORIZED) } } ; OpenLobbiesResponse roomResponse = new OpenLobbiesResponse(); List <SubterfugeRemakeService.GameConfiguration> rooms = (await Room.GetOpenLobbies()).Select(it => it.GameConfiguration).ToList(); roomResponse.Rooms.AddRange(rooms); roomResponse.Status = ResponseFactory.createResponse(ResponseType.SUCCESS); return(roomResponse); }
public override async Task <OpenLobbiesResponse> GetOpenLobbies(OpenLobbiesRequest request, ServerCallContext context) { RedisUserModel user = context.UserState["user"] as RedisUserModel; if (user == null) { return new OpenLobbiesResponse() { Status = ResponseFactory.createResponse(ResponseType.UNAUTHORIZED) } } ; OpenLobbiesResponse roomResponse = new OpenLobbiesResponse(); List <Room> rooms = (await RedisRoomModel.GetOpenLobbies()).ConvertAll(it => it.asRoom().Result); roomResponse.Rooms.AddRange(rooms); roomResponse.Status = ResponseFactory.createResponse(ResponseType.SUCCESS); return(roomResponse); }