mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
rename field
This commit is contained in:
parent
d996ef23ac
commit
49d8608b7b
@ -51,31 +51,31 @@ public class WeaverTypes
|
||||
|
||||
public MethodReference readNetworkBehaviourGeneric;
|
||||
|
||||
AssemblyDefinition currentAssembly;
|
||||
AssemblyDefinition assembly;
|
||||
|
||||
public TypeReference Import<T>() => Import(typeof(T));
|
||||
|
||||
public TypeReference Import(Type t) => currentAssembly.MainModule.ImportReference(t);
|
||||
public TypeReference Import(Type t) => assembly.MainModule.ImportReference(t);
|
||||
|
||||
// constructor resolves the types and stores them in fields
|
||||
public WeaverTypes(AssemblyDefinition currentAssembly)
|
||||
public WeaverTypes(AssemblyDefinition assembly)
|
||||
{
|
||||
// system types
|
||||
this.currentAssembly = currentAssembly;
|
||||
this.assembly = assembly;
|
||||
|
||||
TypeReference ArraySegmentType = Import(typeof(ArraySegment<>));
|
||||
ArraySegmentConstructorReference = Resolvers.ResolveMethod(ArraySegmentType, currentAssembly, ".ctor");
|
||||
ArraySegmentConstructorReference = Resolvers.ResolveMethod(ArraySegmentType, assembly, ".ctor");
|
||||
|
||||
TypeReference ListType = Import(typeof(System.Collections.Generic.List<>));
|
||||
|
||||
TypeReference NetworkServerType = Import(typeof(NetworkServer));
|
||||
NetworkServerGetActive = Resolvers.ResolveMethod(NetworkServerType, currentAssembly, "get_active");
|
||||
NetworkServerGetLocalClientActive = Resolvers.ResolveMethod(NetworkServerType, currentAssembly, "get_localClientActive");
|
||||
NetworkServerGetActive = Resolvers.ResolveMethod(NetworkServerType, assembly, "get_active");
|
||||
NetworkServerGetLocalClientActive = Resolvers.ResolveMethod(NetworkServerType, assembly, "get_localClientActive");
|
||||
TypeReference NetworkClientType = Import(typeof(NetworkClient));
|
||||
NetworkClientGetActive = Resolvers.ResolveMethod(NetworkClientType, currentAssembly, "get_active");
|
||||
NetworkClientGetActive = Resolvers.ResolveMethod(NetworkClientType, assembly, "get_active");
|
||||
|
||||
TypeReference cmdDelegateReference = Import<RemoteCalls.CmdDelegate>();
|
||||
CmdDelegateConstructor = Resolvers.ResolveMethod(cmdDelegateReference, currentAssembly, ".ctor");
|
||||
CmdDelegateConstructor = Resolvers.ResolveMethod(cmdDelegateReference, assembly, ".ctor");
|
||||
|
||||
TypeReference NetworkBehaviourType = Import<NetworkBehaviour>();
|
||||
TypeReference RemoteCallHelperType = Import(typeof(RemoteCalls.RemoteCallHelper));
|
||||
@ -83,56 +83,56 @@ public WeaverTypes(AssemblyDefinition currentAssembly)
|
||||
TypeReference ScriptableObjectType = Import<UnityEngine.ScriptableObject>();
|
||||
|
||||
ScriptableObjectCreateInstanceMethod = Resolvers.ResolveMethod(
|
||||
ScriptableObjectType, currentAssembly,
|
||||
ScriptableObjectType, assembly,
|
||||
md => md.Name == "CreateInstance" && md.HasGenericParameters);
|
||||
|
||||
NetworkBehaviourDirtyBitsReference = Resolvers.ResolveProperty(NetworkBehaviourType, currentAssembly, "syncVarDirtyBits");
|
||||
NetworkBehaviourDirtyBitsReference = Resolvers.ResolveProperty(NetworkBehaviourType, assembly, "syncVarDirtyBits");
|
||||
TypeReference NetworkWriterPoolType = Import(typeof(NetworkWriterPool));
|
||||
GetPooledWriterReference = Resolvers.ResolveMethod(NetworkWriterPoolType, currentAssembly, "GetWriter");
|
||||
RecycleWriterReference = Resolvers.ResolveMethod(NetworkWriterPoolType, currentAssembly, "Recycle");
|
||||
GetPooledWriterReference = Resolvers.ResolveMethod(NetworkWriterPoolType, assembly, "GetWriter");
|
||||
RecycleWriterReference = Resolvers.ResolveMethod(NetworkWriterPoolType, assembly, "Recycle");
|
||||
|
||||
ReadyConnectionReference = Resolvers.ResolveMethod(NetworkClientType, currentAssembly, "get_readyConnection");
|
||||
ReadyConnectionReference = Resolvers.ResolveMethod(NetworkClientType, assembly, "get_readyConnection");
|
||||
|
||||
syncVarEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SyncVarEqual");
|
||||
syncVarNetworkIdentityEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SyncVarNetworkIdentityEqual");
|
||||
syncVarGameObjectEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SyncVarGameObjectEqual");
|
||||
setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SetSyncVar");
|
||||
setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "setSyncVarHookGuard");
|
||||
getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "getSyncVarHookGuard");
|
||||
syncVarEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SyncVarEqual");
|
||||
syncVarNetworkIdentityEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SyncVarNetworkIdentityEqual");
|
||||
syncVarGameObjectEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SyncVarGameObjectEqual");
|
||||
setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SetSyncVar");
|
||||
setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "setSyncVarHookGuard");
|
||||
getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "getSyncVarHookGuard");
|
||||
|
||||
setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SetSyncVarGameObject");
|
||||
getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "GetSyncVarGameObject");
|
||||
setSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SetSyncVarNetworkIdentity");
|
||||
getSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "GetSyncVarNetworkIdentity");
|
||||
syncVarNetworkBehaviourEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SyncVarNetworkBehaviourEqual");
|
||||
setSyncVarNetworkBehaviourReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SetSyncVarNetworkBehaviour");
|
||||
getSyncVarNetworkBehaviourReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "GetSyncVarNetworkBehaviour");
|
||||
setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SetSyncVarGameObject");
|
||||
getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "GetSyncVarGameObject");
|
||||
setSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SetSyncVarNetworkIdentity");
|
||||
getSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "GetSyncVarNetworkIdentity");
|
||||
syncVarNetworkBehaviourEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SyncVarNetworkBehaviourEqual");
|
||||
setSyncVarNetworkBehaviourReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SetSyncVarNetworkBehaviour");
|
||||
getSyncVarNetworkBehaviourReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "GetSyncVarNetworkBehaviour");
|
||||
|
||||
registerCommandDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, currentAssembly, "RegisterCommandDelegate");
|
||||
registerRpcDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, currentAssembly, "RegisterRpcDelegate");
|
||||
registerCommandDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, assembly, "RegisterCommandDelegate");
|
||||
registerRpcDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, assembly, "RegisterRpcDelegate");
|
||||
|
||||
TypeReference unityDebug = Import(typeof(UnityEngine.Debug));
|
||||
// these have multiple methods with same name, so need to check parameters too
|
||||
logErrorReference = Resolvers.ResolveMethod(unityDebug, currentAssembly, md =>
|
||||
logErrorReference = Resolvers.ResolveMethod(unityDebug, assembly, md =>
|
||||
md.Name == "LogError" &&
|
||||
md.Parameters.Count == 1 &&
|
||||
md.Parameters[0].ParameterType.FullName == typeof(object).FullName);
|
||||
|
||||
logWarningReference = Resolvers.ResolveMethod(unityDebug, currentAssembly, md =>
|
||||
logWarningReference = Resolvers.ResolveMethod(unityDebug, assembly, md =>
|
||||
md.Name == "LogWarning" &&
|
||||
md.Parameters.Count == 1 &&
|
||||
md.Parameters[0].ParameterType.FullName == typeof(object).FullName);
|
||||
|
||||
TypeReference typeType = Import(typeof(Type));
|
||||
getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, currentAssembly, "GetTypeFromHandle");
|
||||
sendCommandInternal = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SendCommandInternal");
|
||||
sendRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SendRPCInternal");
|
||||
sendTargetRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "SendTargetRPCInternal");
|
||||
getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, assembly, "GetTypeFromHandle");
|
||||
sendCommandInternal = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SendCommandInternal");
|
||||
sendRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SendRPCInternal");
|
||||
sendTargetRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "SendTargetRPCInternal");
|
||||
|
||||
InitSyncObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, currentAssembly, "InitSyncObject");
|
||||
InitSyncObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, "InitSyncObject");
|
||||
|
||||
TypeReference readerExtensions = Import(typeof(NetworkReaderExtensions));
|
||||
readNetworkBehaviourGeneric = Resolvers.ResolveMethod(readerExtensions, currentAssembly, (md =>
|
||||
readNetworkBehaviourGeneric = Resolvers.ResolveMethod(readerExtensions, assembly, (md =>
|
||||
{
|
||||
return md.Name == nameof(NetworkReaderExtensions.ReadNetworkBehaviour) &&
|
||||
md.HasGenericParameters;
|
||||
|
Loading…
Reference in New Issue
Block a user