void ICommsNetwork.Initialize([NotNull] string playerName, [NotNull] Rooms rooms, [NotNull] PlayerChannels playerChannels, [NotNull] RoomChannels roomChannels, CodecSettings codecSettings) { if (playerName == null) { throw new ArgumentNullException("playerName"); } if (rooms == null) { throw new ArgumentNullException("rooms"); } if (playerChannels == null) { throw new ArgumentNullException("playerChannels"); } if (roomChannels == null) { throw new ArgumentNullException("roomChannels"); } PlayerName = playerName; Rooms = rooms; PlayerChannels = playerChannels; RoomChannels = roomChannels; CodecSettings = codecSettings; Profiler.BeginSample("virtual void Initialize"); Initialize(); Profiler.EndSample(); IsInitialized = true; }
public CapturePipelineManager([NotNull] CodecSettingsLoader codecSettingsLoader, [NotNull] RoomChannels roomChannels, [NotNull] PlayerChannels playerChannels, [NotNull] ReadOnlyCollection <VoicePlayerState> players, int startupDelay = 0) { if (codecSettingsLoader == null) { throw new ArgumentNullException("codecSettingsLoader"); } if (roomChannels == null) { throw new ArgumentNullException("roomChannels"); } if (playerChannels == null) { throw new ArgumentNullException("playerChannels"); } if (players == null) { throw new ArgumentNullException("players"); } _codecSettingsLoader = codecSettingsLoader; _roomChannels = roomChannels; _playerChannels = playerChannels; _receivingPacketLossMonitor = new PacketLossMonitor(players); _startupDelay = startupDelay; }
void ICommsNetwork.Initialize([NotNull] string playerName, [NotNull] Rooms rooms, [NotNull] PlayerChannels playerChannels, [NotNull] RoomChannels roomChannels) { if (playerName == null) { throw new ArgumentNullException("playerName"); } if (rooms == null) { throw new ArgumentNullException("rooms"); } if (playerChannels == null) { throw new ArgumentNullException("playerChannels"); } if (roomChannels == null) { throw new ArgumentNullException("roomChannels"); } PlayerName = playerName; Rooms = rooms; PlayerChannels = playerChannels; RoomChannels = roomChannels; Initialize(); IsInitialized = true; }
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; }
public void Initialize(string playerName, Rooms rooms, PlayerChannels playerChannels, RoomChannels roomChannels) { if (playerName == null) { throw new ArgumentNullException("playerName"); } if (rooms == null) { throw new ArgumentNullException("rooms"); } if (playerChannels == null) { throw new ArgumentNullException("playerChannels"); } if (roomChannels == null) { throw new ArgumentNullException("roomChannels"); } PlayerName = playerName; Rooms = rooms; PlayerChannels = playerChannels; RoomChannels = roomChannels; Initialize(); _initialized = true; }
public OpenChannelVolumeDuck(RoomChannels rooms, PlayerChannels players) { _rooms = rooms; _players = players; _fader.FadeTo(1, 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); } }
public OpenChannelVolumeDuck(RoomChannels rooms, PlayerChannels players) { _rooms = rooms; _players = players; }
private BaseClient(string playerName, Rooms rooms, PlayerChannels playerChannels, RoomChannels roomChannels) { if (playerName == null) { throw new ArgumentNullException("playerName"); } if (rooms == null) { throw new ArgumentNullException("rooms"); } if (playerChannels == null) { throw new ArgumentNullException("playerChannels"); } if (roomChannels == null) { throw new ArgumentNullException("roomChannels"); } Log = Logs.Create(LogCategory.Network, GetType().Name); _playerName = playerName; _byteBufferPool = new ConcurrentPool <byte[]>(10, () => new byte[1024]); _queuedUnreliableTransmissions = new TransferBuffer <ArraySegment <byte> >(16); _queuedReliableTransmissions = new TransferBuffer <ArraySegment <byte> >(16); _queuedEvents = new List <NetworkEvent>(); _peers = new PeerCollection(this); _channels = new ChannelCollection(_peers.RoutingTable, playerChannels, roomChannels); _connectionNegotiator = new ConnectionNegotiator(this); _router = new PacketRouter(this, _connectionNegotiator); _commsProcessor = new CommsProcessor(this, _peers.RoutingTable, rooms, _channels); _roomsManager = new RoomMembershipManager(this, _connectionNegotiator, rooms); }