Ejemplo n.º 1
0
        public async Task JoinRoom(string roomCode, string name)
        {
            Room room = GetRoom(roomCode);

            if (room != null)
            {
                Player player = GlobalData.CreatePlayer(Context.ConnectionId, name, room.RoomCode);
                room.AddPlayer(player);
                await SendPlayerConnectionNotification(room, name);

                await Groups.AddToGroupAsync(Context.ConnectionId, room.RoomCode);

                await Clients.Caller.SendAsync("Load:Player", roomCode, Context.ConnectionId);
                await SendTabletopInfoToRoom(room);
            }
        }