/// <summary> /// Send the netbuffer in the specified mode. /// Highly recommended that you don't use the buffered rpc modes, as this is kind of a manual buffering solution anyway. /// </summary> /// <param name="mode"></param> /// <param name="buffer"></param> public void SendBuffer(RPCMode mode, NetBuffer buffer) { var message = PNetServer.peer.CreateMessage(buffer.LengthBytes); buffer.Clone(message); FinishRPCSend(mode, message); }
//don't need to keep track of the mode, because the clients don't care about it, //and technically, neither do we (everyone new needs it anyway, so 'all' and 'other' are identical) internal void Buffer(NetBuffer msg) { var toBuffer = new NetBuffer(); msg.Clone(toBuffer); buffer.Add(toBuffer); }
internal void Send(NetBuffer msg, RPCMode mode, NetConnection originalSender = null) { var message = PNetServer.peer.CreateMessage(); msg.Clone(message); SendMessage(message, mode, originalSender); }
/// <summary> /// Send the netbuffer to the specified player /// </summary> /// <param name="player"></param> /// <param name="buffer"></param> public void SendBuffer(Player player, NetBuffer buffer) { var message = PNetServer.peer.CreateMessage(buffer.LengthBytes); buffer.Clone(message); FinishRPCSend(player, message); }
//fields are basically treated like OthersBuffered internal void SendField(NetBuffer msg, NetConnection originalSender = null) { var message = PNetServer.peer.CreateMessage(); msg.Clone(message); var conns = _connections.Where(c => c != originalSender).ToList(); if (conns.Count != 0) { PNetServer.peer.SendMessage(message, conns, NetDeliveryMethod.ReliableOrdered, Channels.SYNCHED_FIELD); } }