Beispiel #1
0
        public async Task <IActionResult> JoinLobby([FromBody] JoinLobbyRequest request)
        {
            Guid lobbyId = _registry.JoinLobby(request.HostId, request.JoineeId);

            ServerSidePlayer joinee = _registry.GetPlayerById(request.JoineeId);

            List <ServerSidePlayer> members = _registry.GetLobbyMembers(request.HostId);

            await _hubContext.Clients.Group(lobbyId.ToString()).NewPlayerInLobby(new ServerSidePlayerOverview {
                Id        = joinee.Id,
                AvatarUrl = joinee.AvatarUrl,
                Name      = joinee.Name,
            });

            return(base.Ok(new JoinLobbyResponse {
                LobbyId = lobbyId,
                Members = GetOverviewFromPlayer(members)
            }));
        }