Пример #1
0
 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() });
 }
Пример #2
0
        /// <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);
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
 public static void SendRPC(string rpcName, int eventIndex, UnityEngine.RPCMode target, Distance::IBitSerializable data)
 {
     SendRPC(rpcName, eventIndex, target, data, View);
 }
Пример #5
0
 /// <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);
 }