mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkIdentity.HandleRemoteCall uses NetworkBehaviour.InvokeHandlerDelegate; Removed unnecessary GetInvokerFunctionForHash afterwards.
This commit is contained in:
parent
fa893c0ff1
commit
8854eba284
@ -246,18 +246,6 @@ static bool GetInvokerForHash(int cmdHash, UNetInvokeType invokeType, out Invoke
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static bool GetInvokerFunctionForHash(int cmdHash, UNetInvokeType invokeType, out CmdDelegate invokeFunction)
|
||||
{
|
||||
Invoker invoker;
|
||||
if (GetInvokerForHash(cmdHash, invokeType, out invoker))
|
||||
{
|
||||
invokeFunction = invoker.invokeFunction;
|
||||
return true;
|
||||
}
|
||||
invokeFunction = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// InvokeCmd/Rpc/SyncEventDelegate can all use the same function here
|
||||
internal bool InvokeHandlerDelegate(int cmdHash, UNetInvokeType invokeType, NetworkReader reader)
|
||||
{
|
||||
|
@ -568,21 +568,15 @@ internal void HandleRemoteCall(int componentIndex, int functionHash, UNetInvokeT
|
||||
return;
|
||||
}
|
||||
|
||||
// find the matching invoke function and NetworkBehaviour class
|
||||
NetworkBehaviour.CmdDelegate invokeFunction;
|
||||
if (!NetworkBehaviour.GetInvokerFunctionForHash(functionHash, invokeType, out invokeFunction))
|
||||
{
|
||||
// We don't get a valid lookup of the command name when it doesn't exist...
|
||||
string functionName = NetworkBehaviour.GetCmdHashHandlerName(functionHash);
|
||||
Debug.LogError("Found no receiver for incoming [" + functionName + "] on " + gameObject + ", the server and client should have the same NetworkBehaviour instances [netId=" + netId + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
// find the right component to invoke the function on
|
||||
if (0 <= componentIndex && componentIndex < m_NetworkBehaviours.Length)
|
||||
{
|
||||
NetworkBehaviour invokeComponent = m_NetworkBehaviours[componentIndex];
|
||||
invokeFunction(invokeComponent, reader);
|
||||
if (!invokeComponent.InvokeHandlerDelegate(functionHash, invokeType, reader))
|
||||
{
|
||||
string functionName = NetworkBehaviour.GetCmdHashHandlerName(functionHash);
|
||||
Debug.LogError("Found no receiver for incoming [" + functionName + "] on " + gameObject + ", the server and client should have the same NetworkBehaviour instances [netId=" + netId + "].");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user