예제 #1
0
        public void AddConnection(Connection connection)
        {
            _context.Value.Groups.Add(connection.Id, GroupId);
            _connections.Add(connection);
            _context.Value.Clients.Client(connection.Id).joinRoom(GroupId.Substring(0, 4));
            _context.Value.Clients.Group(GroupId, connection.Id).playerConnected(connection);

            _scores.Add(connection, 0);
            _history.Add(connection, new List <string>());

            _context.Value.Clients.Client(connection.Id)
            .updateScores(_scores.OrderByDescending(s => s.Value).Select(s => new { name = s.Key.Name, value = s.Value, imageUrl = s.Key.ImageUrl }));
            _context.Value.Clients.Group(GroupId, connection.Id)
            .updateScores(_scores.OrderByDescending(s => s.Value).Select(s => new { name = s.Key.Name, value = s.Value, imageUrl = s.Key.ImageUrl }));
        }