Esempio n. 1
0
 void MessageHandler.RPCHandler(RPC rpc)
 {
     if ((rpc.rpcType & RPCType.Self) != 0)
     {
         _messenger.Send(rpc.sender, rpc);
     }
     //if ((rpc.rpcType & RPCType.Server) == RPCType.Server)
     //{
     //    _messenger.Send(_worldByUser[rpc.sender], rpc);
     //}
     if ((rpc.rpcType & RPCType.Others) != 0)
     {
         foreach (var target in _messenger.Keys)
         {
             if (target != rpc.sender && _worldByUser[target] == _worldByUser[rpc.sender])
                 _messenger.Send(target, rpc);
         }
     }
     if ((rpc.rpcType & RPCType.Buffered) != 0)
     {
         _rpcBufferByWorld[_worldByUser[rpc.sender]].Add(rpc);
     }
     if ((rpc.rpcType & RPCType.Specific) != 0)
     {
         _messenger.Send(rpc.receiver, rpc);
     }
 }
Esempio n. 2
0
    void MessageHandler.RPCHandler(TeraTaleNet.RPC rpc)
    {
        NetworkScript script;

        if (signallersByID.TryGetValue(rpc.signallerID, out script))
        {
            if (script.gameObject.activeSelf)
            {
                script.SendMessage(rpc.GetType().Name, rpc, SendMessageOptions.RequireReceiver);
            }
            else
            {
                SetActive sa = rpc as SetActive;
                if (sa != null)
                {
                    script.SetActive(sa);
                }
                else
                {
                    Debug.Log("A RPC was not arrived. Name:" + rpc.GetType().Name + " DestinationID:" + rpc.signallerID);
                }
            }
        }
        else
        {
            Debug.Log("A RPC was not arrived. Name:" + rpc.GetType().Name + " DestinationID:" + rpc.signallerID);
        }
    }
Esempio n. 3
0
 void MessageHandler.RPCHandler(RPC rpc)
 {
     throw new NotImplementedException();
 }
Esempio n. 4
0
 public void Send(TeraTaleNet.RPC rpc)
 {
     rpc.signallerID = networkID;
     rpc.sender      = userName;
     NetworkProgramUnity.currentInstance.Send(new Packet(rpc));
 }