NetworkBehaviour.InvokeCommandDelegate simplified

This commit is contained in:
vis2k 2018-12-30 17:29:07 +01:00
parent dd7915bf75
commit b3a4c3159c

View File

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