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); } }
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); } }
void MessageHandler.RPCHandler(RPC rpc) { throw new NotImplementedException(); }
public void Send(TeraTaleNet.RPC rpc) { rpc.signallerID = networkID; rpc.sender = userName; NetworkProgramUnity.currentInstance.Send(new Packet(rpc)); }