예제 #1
0
        public VoiceSender(
            [NotNull] ISendQueue <TPeer> sender,
            [NotNull] ISession session,
            [NotNull] IClientCollection <TPeer?> peers,
            [NotNull] EventQueue events,
            [NotNull] PlayerChannels playerChannels,
            [NotNull] RoomChannels roomChannels)
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (peers == null)
            {
                throw new ArgumentNullException("peers");
            }
            if (events == null)
            {
                throw new ArgumentNullException("events");
            }
            if (playerChannels == null)
            {
                throw new ArgumentNullException("playerChannels");
            }
            if (roomChannels == null)
            {
                throw new ArgumentNullException("roomChannels");
            }

            _sender         = sender;
            _session        = session;
            _peers          = peers;
            _playerChannels = playerChannels;
            _roomChannels   = roomChannels;
            _events         = events;

            //Subscribe to future channel open and close events for both channel types
            _playerChannels.OpenedChannel += OpenPlayerChannel;
            _playerChannels.ClosedChannel += ClosePlayerChannel;
            _roomChannels.OpenedChannel   += OpenRoomChannel;
            _roomChannels.ClosedChannel   += CloseRoomChannel;

            //There may already be some channels which were created before we created those events, run through them all now so we're up to date
            foreach (var playerChannel in playerChannels)
            {
                OpenPlayerChannel(playerChannel.Value.TargetId, playerChannel.Value.Properties);
            }
            foreach (var roomChannel in roomChannels)
            {
                OpenRoomChannel(roomChannel.Value.TargetId, roomChannel.Value.Properties);
            }

            //We need to watch for player join/leave events to properly handle player channel management
            _events.PlayerJoined += OnPlayerJoined;
            _events.PlayerLeft   += OnPlayerLeft;
        }
예제 #2
0
        public VoiceReceiver(ISession session, IClientCollection <TPeer?> clients, EventQueue events, Rooms rooms, ConcurrentPool <List <RemoteChannel> > channelListPool)
        {
            _session         = session;
            _clients         = clients;
            _events          = events;
            _rooms           = rooms;
            _channelListPool = channelListPool;

            _events.OnEnqueuePlayerLeft += OnPlayerLeft;
        }
예제 #3
0
 public DefaultGarbageCollector(
     PomeliumOptions pomeliumOptions,
     IClientCollection clientCollection,
     IDistributedCache distributedCache,
     ISession session,
     IServerIdentifier serverIdentifier,
     AsyncLockers asyncLockers)
 {
     _pomeliumOptions  = pomeliumOptions;
     _clientCollection = clientCollection;
     _distributedCache = distributedCache;
     _session          = session;
     _serverIdentifier = serverIdentifier;
     _collectTimer     = new Timer(CollectCallback, null, 0, 1000 * 60);
     _asyncLockers     = asyncLockers;
 }
예제 #4
0
 public PomeliumServer(
     IPomeliumHubLocator pomeliumHubLocator,
     ISession session,
     IServiceProvider serviceProvider,
     ISemaphoreProvider semaphoreProvider,
     IHubActivitor hubActivitor,
     IClientCollection clientCollection,
     INodeProvider nodeProvider,
     IGarbageCollector garbageCollector)
 {
     _pomeliumHubLocator = pomeliumHubLocator;
     _session            = session;
     _serviceProvider    = serviceProvider;
     _semaphoreProvider  = semaphoreProvider;
     _hubActivitor       = hubActivitor;
     _clientCollection   = clientCollection;
     _nodeProvider       = nodeProvider;
     _heartbeatTimer     = new Timer(TimerCallback, null, 0, 5000);
 }
예제 #5
0
        public TextReceiver([NotNull] EventQueue events, [NotNull] Rooms rooms, [NotNull] IClientCollection <TPeer?> peers)
        {
            if (events == null)
            {
                throw new ArgumentNullException("events");
            }
            if (rooms == null)
            {
                throw new ArgumentNullException("rooms");
            }
            if (peers == null)
            {
                throw new ArgumentNullException("peers");
            }

            _events = events;
            _rooms  = rooms;
            _peers  = peers;
        }
예제 #6
0
        public IClientCollection GetClients()
        {
            IClientCollection clientCollection = Factory.ClientCollectionFactory.Instantiate();

            DataSet ds = CnBDAL.LookupFactory.Instantiate().GetClients();

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    IClient _Client;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        _Client            = Factory.ClientFactory.Instantiate();
                        _Client.ClientID   = Convert.ToInt32(dr["ClientID"].ToString());
                        _Client.ClientName = dr["ClientName"].ToString().Trim();

                        clientCollection.Add(_Client);
                    }
                }
            }

            return(clientCollection);
        }
예제 #7
0
 public SimulationClientContext(IClientCollection clients, IClientFactory clientFactory, ISimulationStorage simulationStorage)
 {
     this.clients           = clients;
     this.clientFactory     = clientFactory;
     this.simulationStorage = simulationStorage;
 }
예제 #8
0
 public ClientContext(IClientCollection clients)
 {
     this.clients = clients;
 }
 public GrpcSimulationClientHandler(IClientCollection clients)
 {
     this.clients = clients;
 }
예제 #10
0
 public TextSender(ISendQueue <TPeer> sender, ISession session, IClientCollection <TPeer?> peers)
 {
     _session = session;
     _sender  = sender;
     _peers   = peers;
 }
예제 #11
0
 public SimulationApiInformation(IClientCollection clientCollection)
 {
     this.clientCollection = clientCollection;
 }