Ejemplo n.º 1
0
		protected void RelayStream(uint updateidentifier, NetworkingStream stream)
		{
			if (stream.identifierType == NetworkingStream.IdentifierType.RPC && stream.BufferedRPC)
			{
				NetworkingStream recreatedStream = new NetworkingStream(stream.ProtocolType).PrepareFinal(this, stream.identifierType, stream.NetworkedBehaviorId, stream.Bytes, stream.Receivers, stream.BufferedRPC, stream.Customidentifier, stream.RealSenderId);
				recreatedStream.AssignSender(stream.Sender);

				if (!udpRpcBuffer.ContainsKey(stream.RealSenderId))
					udpRpcBuffer.Add(stream.RealSenderId, new List<KeyValuePair<uint, NetworkingStream>>());

				udpRpcBuffer[stream.RealSenderId].Add(new KeyValuePair<uint, NetworkingStream>(updateidentifier, recreatedStream));
			}

			writeStream.SetProtocolType(stream.ProtocolType);
			if (!Networking.IsBareMetal)
				writeStream.Prepare(this, stream.identifierType, stream.NetworkedBehavior, stream.Bytes, stream.Receivers, stream.BufferedRPC, stream.Customidentifier, stream.RealSenderId);
			else
				writeStream.PrepareFinal(this, stream.identifierType, stream.NetworkedBehaviorId, stream.Bytes, stream.Receivers, stream.BufferedRPC, stream.Customidentifier, stream.RealSenderId);

			Write(updateidentifier, writeStream);
		}
Ejemplo n.º 2
0
		protected void RelayStream(NetworkingStream stream)
		{
			if (stream.Receivers == NetworkReceivers.Server)
				return;

			if (stream.identifierType == NetworkingStream.IdentifierType.RPC && stream.BufferedRPC)
			{
				NetworkingStream clonedStream = new NetworkingStream(stream.ProtocolType).PrepareFinal(this, stream.identifierType, stream.NetworkedBehaviorId, stream.Bytes, stream.Receivers, stream.BufferedRPC, stream.Customidentifier, senderId: stream.RealSenderId);
				clonedStream.AssignSender(stream.Sender);

				if (!rpcBuffer.ContainsKey(stream.RealSenderId))
					rpcBuffer.Add(stream.RealSenderId, new List<NetworkingStream>());

				rpcBuffer[stream.RealSenderId].Add(clonedStream);
			}

			writeStream.SetProtocolType(stream.ProtocolType);

			if (!Networking.IsBareMetal)
				writeStream.Prepare(this, stream.identifierType, stream.NetworkedBehavior, stream.Bytes, stream.Receivers, stream.BufferedRPC, stream.Customidentifier, stream.RealSenderId);
			else
				writeStream.PrepareFinal(this, stream.identifierType, stream.NetworkedBehaviorId, stream.Bytes, stream.Receivers, stream.BufferedRPC, stream.Customidentifier, stream.RealSenderId);

			// Write what was read to all the clients
			Write(writeStream);
		}
Ejemplo n.º 3
0
		protected void ServerBufferRPC(uint updateidentifier, NetworkingStream stream)
		{
			if (stream.Receivers != NetworkReceivers.AllBuffered && stream.Receivers != NetworkReceivers.OthersBuffered)
				return;

			if (stream.identifierType == NetworkingStream.IdentifierType.RPC && stream.BufferedRPC)
			{
#if BMS_DEBUGGING_UNITY
				UnityEngine.Debug.Log("[NetWorker ServerBuffering RPC]");
#endif
				if (!udpRpcBuffer.ContainsKey(stream.RealSenderId))
					udpRpcBuffer.Add(stream.RealSenderId, new List<KeyValuePair<uint, NetworkingStream>>());

				NetworkingStream clonedStream = new NetworkingStream(stream.ProtocolType);
				clonedStream.Bytes.BlockCopy(stream.Bytes.byteArr, stream.Bytes.StartIndex(), stream.Bytes.Size);
				clonedStream.AssignSender(Me);

				udpRpcBuffer[stream.RealSenderId].Add(new KeyValuePair<uint, NetworkingStream>(updateidentifier, clonedStream));
			}
		}
Ejemplo n.º 4
0
		protected void ServerBufferRPC(NetworkingStream stream)
		{
			if (stream.identifierType == NetworkingStream.IdentifierType.RPC && stream.BufferedRPC)
			{
				if (!rpcBuffer.ContainsKey(stream.RealSenderId))
					rpcBuffer.Add(stream.RealSenderId, new List<NetworkingStream>());

				NetworkingStream clonedStream = new NetworkingStream(stream.ProtocolType);
				clonedStream.Bytes.BlockCopy(stream.Bytes.byteArr, stream.Bytes.StartIndex(), stream.Bytes.Size);
				clonedStream.AssignSender(Me);

				rpcBuffer[stream.RealSenderId].Add(clonedStream);
			}
		}