public void RPC(byte rpcID, Player player, INetSerializable arg0, INetSerializable arg1) { var size = DEFAULT_RPC_HEADER_SIZE; size += arg0.AllocSize; size += arg1.AllocSize; var msg = CreateMessage(size, rpcID); arg0.OnSerialize(msg); arg1.OnSerialize(msg); FinishRPCSend(player, msg); }
public void Rpc(byte rpcId, INetSerializable arg0, INetSerializable arg1, INetSerializable arg2) { int size = 0; size += arg0.AllocSize; size += arg1.AllocSize; size += arg2.AllocSize; var msg = StartMessage(Room, rpcId, ReliabilityMode.Ordered, size); arg0.OnSerialize(msg); arg1.OnSerialize(msg); arg2.OnSerialize(msg); SendMessage(msg, ReliabilityMode.Ordered); }
/// <summary> /// Send a static RPC to the player. (prevents array allocation) /// </summary> /// <param name="rpcID"></param> /// <param name="arg0"></param> /// <param name="ordered"></param> public void RPC(byte rpcID, INetSerializable arg0, bool ordered = true) { var size = 1; size += arg0.AllocSize; var message = CreateMessage(rpcID, size); arg0.OnSerialize(message); if (ordered) { SendMessage(message); } else { SendUnorderedMessage(message); } }
internal void OnFinishedInstantiate(Player player) { //get the player up to speed SendBuffer(player); try { FinishedInstantiation?.Invoke(player); } catch (Exception e) { Debug.LogException(e); } if (MoreInstantiates != null) { var msg = Room.RoomGetMessage(4 + MoreInstantiates.AllocSize); msg.Write(RpcUtils.GetHeader(ReliabilityMode.Ordered, BroadcastMode.Server, MsgType.Internal)); msg.Write(RandPRpcs.InstantiatePlus); Id.OnSerialize(msg); MoreInstantiates.OnSerialize(msg); Room.SendToPlayer(player, msg, ReliabilityMode.Ordered); } }
/// <summary> /// Send a static RPC to the player. (prevents array allocation) /// </summary> /// <param name="rpcID"></param> /// <param name="arg0"></param> /// <param name="arg1"></param> /// <param name="arg2"></param> /// <param name="arg3"></param> /// <param name="arg4"></param> /// <param name="ordered"></param> public void RPC(byte rpcID, INetSerializable arg0, INetSerializable arg1, INetSerializable arg2, INetSerializable arg3, INetSerializable arg4, bool ordered = true) { var size = 1; size += arg0.AllocSize; size += arg1.AllocSize; size += arg2.AllocSize; size += arg3.AllocSize; size += arg4.AllocSize; var message = CreateMessage(rpcID, size); arg0.OnSerialize(message); arg1.OnSerialize(message); arg2.OnSerialize(message); arg3.OnSerialize(message); arg4.OnSerialize(message); if (ordered) SendMessage(message); else SendUnorderedMessage(message); }