RemoteCalls.Invoker.remoteCallType renamed to callType for simplicity

This commit is contained in:
vis2k 2022-01-18 16:38:57 +08:00
parent 1242fb1356
commit 0418f1c9d2

View File

@ -13,14 +13,14 @@ public enum RemoteCallType { Command, ClientRpc }
class Invoker class Invoker
{ {
public Type invokeClass; public Type invokeClass;
public RemoteCallType remoteCallType; public RemoteCallType callType;
public RemoteCallDelegate function; public RemoteCallDelegate function;
public bool cmdRequiresAuthority; public bool cmdRequiresAuthority;
public bool AreEqual(Type invokeClass, RemoteCallType remoteCallType, RemoteCallDelegate invokeFunction) public bool AreEqual(Type invokeClass, RemoteCallType remoteCallType, RemoteCallDelegate invokeFunction)
{ {
return (this.invokeClass == invokeClass && return (this.invokeClass == invokeClass &&
this.remoteCallType == remoteCallType && this.callType == remoteCallType &&
this.function == invokeFunction); this.function == invokeFunction);
} }
} }
@ -60,7 +60,7 @@ internal static int RegisterDelegate(Type invokeClass, string functionFullName,
remoteCallDelegates[hash] = new Invoker remoteCallDelegates[hash] = new Invoker
{ {
remoteCallType = remoteCallType, callType = remoteCallType,
invokeClass = invokeClass, invokeClass = invokeClass,
function = func, function = func,
cmdRequiresAuthority = cmdRequiresAuthority cmdRequiresAuthority = cmdRequiresAuthority
@ -86,7 +86,7 @@ internal static void RemoveDelegate(int hash) =>
static bool GetInvokerForHash(int functionHash, RemoteCallType remoteCallType, out Invoker invoker) => static bool GetInvokerForHash(int functionHash, RemoteCallType remoteCallType, out Invoker invoker) =>
remoteCallDelegates.TryGetValue(functionHash, out invoker) && remoteCallDelegates.TryGetValue(functionHash, out invoker) &&
invoker != null && invoker != null &&
invoker.remoteCallType == remoteCallType; invoker.callType == remoteCallType;
// InvokeCmd/Rpc Delegate can all use the same function here // InvokeCmd/Rpc Delegate can all use the same function here
internal static bool Invoke(int functionHash, RemoteCallType remoteCallType, NetworkReader reader, NetworkBehaviour component, NetworkConnectionToClient senderConnection = null) internal static bool Invoke(int functionHash, RemoteCallType remoteCallType, NetworkReader reader, NetworkBehaviour component, NetworkConnectionToClient senderConnection = null)