NetworkBehaviour.InvokeRpcDelegate simplified

This commit is contained in:
vis2k 2018-12-30 17:29:57 +01:00
parent b3a4c3159c
commit 3d7a10fd08

View File

@ -309,21 +309,12 @@ internal bool InvokeCommandDelegate(int cmdHash, NetworkReader reader)
internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader) internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader)
{ {
if (!s_CmdHandlerDelegates.ContainsKey(cmdHash)) Invoker invoker;
if (s_CmdHandlerDelegates.TryGetValue(cmdHash, out invoker) &&
invoker.invokeType == UNetInvokeType.ClientRpc &&
invoker.invokeClass.IsInstanceOfType(this))
{ {
return false; invoker.invokeFunction(this, reader);
}
Invoker inv = s_CmdHandlerDelegates[cmdHash];
if (inv.invokeType != UNetInvokeType.ClientRpc)
{
return false;
}
// 'this' instance of invokeClass?
if (inv.invokeClass.IsInstanceOfType(this))
{
inv.invokeFunction(this, reader);
return true; return true;
} }
return false; return false;