public static void SendRPC(string rpcName, int eventIndex, UnityEngine.RPCMode target, Distance::IBitSerializable data, NetworkView view) { bitStreamWriter.Clear(); bitStreamWriter.Serialize(ref eventIndex); if (data != null) { data.Serialize(bitStreamWriter); } view.RPC(rpcName, target, new object[] { bitStreamWriter.ToBytes() }); }
/// <summary> /// Send an rpc /// </summary> /// <param name="rpcID"></param> /// <param name="mode"></param> /// <param name="args"></param> public void RPC(byte rpcID, UnityEngine.RPCMode mode, params INetSerializable[] args) { var size = 2; RPCUtils.AllocSize(ref size, args); var message = Net.peer.CreateMessage(size); message.Write(viewID.guid); message.Write(rpcID); RPCUtils.WriteParams(ref message, args); Net.peer.SendMessage(message, NetDeliveryMethod.ReliableOrdered, (int)mode + Channels.BEGIN_RPCMODES); }
internal static PNetC.RPCMode ToPNetCMode(this UnityEngine.RPCMode mode) { switch (mode) { case RPCMode.Others: return(PNetC.RPCMode.Others); case RPCMode.Server: return(PNetC.RPCMode.Server); case RPCMode.All: return(PNetC.RPCMode.All); case RPCMode.OthersBuffered: return(PNetC.RPCMode.OthersBuffered); case RPCMode.AllBuffered: return(PNetC.RPCMode.AllBuffered); default: return(PNetC.RPCMode.Server); } }
public static void SendRPC(string rpcName, int eventIndex, UnityEngine.RPCMode target, Distance::IBitSerializable data) { SendRPC(rpcName, eventIndex, target, data, View); }
/// <summary> /// Send an rpc /// </summary> /// <param name="rpcID"></param> /// <param name="mode"></param> /// <param name="args"></param> public void RPC(byte rpcID, UnityEngine.RPCMode mode, params INetSerializable[] args) { _networkView.RPC(rpcID, mode.ToPNetCMode(), args); }