Пример #1
0
        public void Join(Int32? gameID, Entities.Enums.ConnectionType connectionType)
        {
            String groupName = GLOBAL;

            if (gameID.HasValue)
            {
                groupName = String.Format("Game_{0}", gameID.Value);
            }

            Entities.ActiveConnection newConnection = InsertConnection(groupName, connectionType);

            Entities.Models.Hub.Lobby lobby = new Entities.Models.Hub.Lobby
            {
                ActiveConnections = GetConnections(groupName, connectionType)
            };

            if (gameID.HasValue)
            {
                this.Groups.Add(Context.ConnectionId, groupName);
                Clients.Group(groupName).UpdateLobby(lobby);
            }
            else
            {
                Clients.All.UpdateLobby(lobby.ActiveConnections);
            }
        }
Пример #2
0
        public void Join(Int32?gameID, Entities.Enums.ConnectionType connectionType)
        {
            String groupName = GLOBAL;

            if (gameID.HasValue)
            {
                groupName = String.Format("Game_{0}", gameID.Value);
            }

            Entities.ActiveConnection newConnection = InsertConnection(groupName, connectionType);

            Entities.Models.Hub.Lobby lobby = new Entities.Models.Hub.Lobby
            {
                ActiveConnections = GetConnections(groupName, connectionType)
            };

            if (gameID.HasValue)
            {
                this.Groups.Add(Context.ConnectionId, groupName);
                Clients.Group(groupName).UpdateLobby(lobby);
            }
            else
            {
                Clients.All.UpdateLobby(lobby.ActiveConnections);
            }
        }