NetworkBehaviour.InvokeSyncEventDelegate simplified

This commit is contained in:
vis2k 2018-12-30 17:30:43 +01:00
parent 3d7a10fd08
commit 98f984182a

View File

@ -322,19 +322,14 @@ internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader)
internal bool InvokeSyncEventDelegate(int cmdHash, NetworkReader reader) internal bool InvokeSyncEventDelegate(int cmdHash, NetworkReader reader)
{ {
if (!s_CmdHandlerDelegates.ContainsKey(cmdHash)) Invoker invoker;
if (s_CmdHandlerDelegates.TryGetValue(cmdHash, out invoker) &&
invoker.invokeType == UNetInvokeType.SyncEvent)
{ {
return false; invoker.invokeFunction(this, reader);
return true;
} }
return false;
Invoker inv = s_CmdHandlerDelegates[cmdHash];
if (inv.invokeType != UNetInvokeType.SyncEvent)
{
return false;
}
inv.invokeFunction(this, reader);
return true;
} }
internal static string GetCmdHashHandlerName(int cmdHash) internal static string GetCmdHashHandlerName(int cmdHash)