Ejemplo n.º 1
0
 public CommsProcessor(IClient client, IReadonlyRoutingTable peers, Rooms rooms, ChannelCollection channels)
 {
     _client   = client;
     _peers    = peers;
     _rooms    = rooms;
     _channels = channels;
 }
Ejemplo n.º 2
0
        public ChannelCollection(IReadonlyRoutingTable peers, PlayerChannels playerChannels, RoomChannels roomChannels)
        {
            _peers          = peers;
            _playerChannels = playerChannels;
            _roomChannels   = roomChannels;

            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);
            }
        }