public void StreamData(bool spawnSelf, UdpChannelName channel, BoltConnection connection = null) { StringBuilder sb = new StringBuilder(JsonConvert.SerializeObject(this, Formatting.Indented)); byte[] aggregationData = Encoding.UTF8.GetBytes(sb.ToString()); if (connection == null) { foreach (BoltConnection boltCon in BoltNetwork.Connections) { boltCon.StreamBytes(channel, aggregationData); } } else { connection.StreamBytes(channel, aggregationData); } if (spawnSelf) { NetworkPartSpawner.Data.AddRange(data); } data.Clear(); }
public StreamChannel(UdpChannelName udpChannelName, string name, bool isReliable, int priority, StreamChannelType type) { UdpChannelName = udpChannelName; Name = name; IsReliable = isReliable; Priority = priority; Type = type; }
IStreamChannel FindStreamChannel(UdpChannelName channelName) { IEqualityComparer <UdpChannelName> equalityComparer = UdpChannelName.EqualityComparer.Instance; foreach (var item in _streamChannels) { if (equalityComparer.Equals(((StreamChannel)item.Value).UdpChannelName, channelName)) { return(item.Value); } } return(null); }
public override void BoltStartBegin() { InitJsonChannel = BoltNetwork.CreateStreamChannel(InitJsonChannelName, UdpChannelMode.Reliable, 4); WaspJsonChannel = BoltNetwork.CreateStreamChannel(WaspJsonChannelName, UdpChannelMode.Reliable, 4); PlayerJsonChannel = BoltNetwork.CreateStreamChannel(PlayerJsonChannelName, UdpChannelMode.Reliable, 4); StreamAggregationChannel = BoltNetwork.CreateStreamChannel(StreamAggregationName, UdpChannelMode.Reliable, 4); UpdateAggregationChannel = BoltNetwork.CreateStreamChannel(UpdateAggregationName, UdpChannelMode.Reliable, 4); BoltNetwork.RegisterTokenClass <PartToken>(); BoltNetwork.RegisterTokenClass <PartTokenParent>(); BoltNetwork.RegisterTokenClass <PartTokenComplex>(); }
private void CreateStreamChannels() { _streamChannels.Clear(); string[] streamChannelNames = Enum.GetNames(typeof(StreamChannelType)); int[] streamChannelValues = Enum.GetValues(typeof(StreamChannelType)) as int[]; for (int i = 0; i < streamChannelValues.Length; i++) { StreamChannelType type = (StreamChannelType)streamChannelValues[i]; GetStreamChannelSettings(type, out bool reliable, out int priority); UdpChannelName photonChannelName = BoltNetwork.CreateStreamChannel(streamChannelNames[i], reliable ? UdpChannelMode.Reliable : UdpChannelMode.Unreliable, priority); StreamChannel channel = new StreamChannel(photonChannelName, streamChannelNames[i], reliable, priority, type); _streamChannels.Add(type, channel); } }
public void Event_StreamDataProgress(BoltConnection connection, UdpChannelName channel, ulong streamID, float progress) { INetworkInterfaceConnection interfaceConnection = FindInterfaceConnection(connection); if (interfaceConnection == null) { Log.Error($"[PhotonNetworkInterface] StreamDataProgress from unknown connection: {connection}."); return; } IStreamChannel streamChannel = FindStreamChannel(channel); if (streamChannel == null) { Log.Error($"[PhotonNetworkInterface] StreamDataProgress from an unknown channel '{channel}'."); return; } StreamDataProgress?.Invoke(interfaceConnection, streamChannel, streamID, progress); }
public void Event_StreamDataAborted(BoltConnection connection, UdpChannelName channel, ulong streamID) { INetworkInterfaceConnection interfaceConnection = FindInterfaceConnection(connection); if (interfaceConnection == null) { Log.Info($"[PhotonNetworkInterface] StreamDataAborted from unknown connection: {connection}."); } IStreamChannel streamChannel = FindStreamChannel(channel); if (streamChannel == null) { Log.Error($"[PhotonNetworkInterface] StreamDataAborted from an unknown channel '{channel}'."); return; } Log.Info(LogChannel, $"[PhotonNetworkInterface] Incoming stream aborted: (streamID){streamID}"); StreamDataAborted?.Invoke(interfaceConnection, streamChannel, streamID); }
public override void StreamDataProgress(BoltConnection connection, UdpChannelName channel, ulong streamID, float progress) { if (channel.ToString() == StreamAggregationChannel.ToString()) { return; } if (channel.ToString() == UpdateAggregationChannel.ToString()) { return; } if (progressBars == null) { return; } if (!progressBars.Active) { progressBars.ActivateSliders(); } if (channel.ToString() == InitJsonChannel.ToString()) { progressBars.ChangeInitProgress(progress); } if (channel.ToString() == WaspJsonChannel.ToString()) { progressBars.ChangeWaspProgress(progress); } if (channel.ToString() == PlayerJsonChannel.ToString()) { progressBars.ChangePlayerProgress(progress); } }
public override void BoltStartBegin() { testChannel = BoltNetwork.CreateStreamChannel("test", UdpChannelMode.Reliable, 1); }
public override void StreamDataAborted(BoltConnection connection, UdpChannelName channel, ulong streamID) { BoltLog.Error("Stream {0} on channel {1} from connection {2} has been aborted.", streamID, channel, connection); }
public override void StreamDataProgress(BoltConnection connection, UdpChannelName channel, ulong streamID, float progress) { BoltLog.Info("[{3}%] Connection {0} is transfering data on channel {1} :: Transfer ID {2}", connection, channel, streamID, (int)(progress * 100)); }
public override void StreamDataStarted(BoltConnection connection, UdpChannelName channel, ulong streamID) { BoltLog.Warn("Connection {0} is transfering data on channel {1} :: Transfer {2}...", connection, channel, streamID); timestamp = Time.time; }
public override void StreamDataAborted(BoltConnection connection, UdpChannelName channel, ulong streamID) => PhotonNetworkInterface.Event_StreamDataAborted(connection, channel, streamID);
public override void StreamDataProgress(BoltConnection connection, UdpChannelName channel, ulong streamID, float progress) => PhotonNetworkInterface.Event_StreamDataProgress(connection, channel, streamID, progress);