static void SetupTargetTypes() { // system types SetupCorLib(); voidType = ImportCorLibType("System.Void"); singleType = ImportCorLibType("System.Single"); doubleType = ImportCorLibType("System.Double"); decimalType = ImportCorLibType("System.Decimal"); boolType = ImportCorLibType("System.Boolean"); stringType = ImportCorLibType("System.String"); int64Type = ImportCorLibType("System.Int64"); uint64Type = ImportCorLibType("System.UInt64"); int32Type = ImportCorLibType("System.Int32"); uint32Type = ImportCorLibType("System.UInt32"); int16Type = ImportCorLibType("System.Int16"); uint16Type = ImportCorLibType("System.UInt16"); byteType = ImportCorLibType("System.Byte"); sbyteType = ImportCorLibType("System.SByte"); charType = ImportCorLibType("System.Char"); objectType = ImportCorLibType("System.Object"); valueTypeType = ImportCorLibType("System.ValueType"); typeType = ImportCorLibType("System.Type"); IEnumeratorType = ImportCorLibType("System.Collections.IEnumerator"); guidType = ImportCorLibType("System.Guid"); NetworkReaderType = NetAssembly.MainModule.GetType("Mirror.NetworkReader"); NetworkReaderDef = NetworkReaderType.Resolve(); NetworkReaderCtor = Resolvers.ResolveMethod(NetworkReaderDef, CurrentAssembly, ".ctor"); NetworkWriterType = NetAssembly.MainModule.GetType("Mirror.NetworkWriter"); NetworkWriterDef = NetworkWriterType.Resolve(); NetworkWriterCtor = Resolvers.ResolveMethod(NetworkWriterDef, CurrentAssembly, ".ctor"); NetworkServerGetActive = Resolvers.ResolveMethod(NetworkServerType, CurrentAssembly, "get_active"); NetworkServerGetLocalClientActive = Resolvers.ResolveMethod(NetworkServerType, CurrentAssembly, "get_localClientActive"); NetworkClientGetActive = Resolvers.ResolveMethod(NetworkClientType, CurrentAssembly, "get_active"); NetworkWriterWriteInt16 = Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", int16Type); NetworkReaderReadPackedUInt32 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadPackedUInt32"); NetworkReaderReadPackedUInt64 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadPackedUInt64"); NetworkWriterWritePackedUInt64 = Resolvers.ResolveMethod(NetworkWriterType, CurrentAssembly, "WritePackedUInt64"); NetworkReadUInt16 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadUInt16"); NetworkWriteUInt16 = Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", uint16Type); CmdDelegateReference = NetAssembly.MainModule.GetType("Mirror.NetworkBehaviour/CmdDelegate"); CmdDelegateConstructor = Resolvers.ResolveMethod(CmdDelegateReference, CurrentAssembly, ".ctor"); CurrentAssembly.MainModule.ImportReference(gameObjectType); CurrentAssembly.MainModule.ImportReference(transformType); TypeReference networkIdentityTmp = NetAssembly.MainModule.GetType("Mirror.NetworkIdentity"); NetworkIdentityType = CurrentAssembly.MainModule.ImportReference(networkIdentityTmp); NetworkBehaviourType = NetAssembly.MainModule.GetType("Mirror.NetworkBehaviour"); NetworkBehaviourType2 = CurrentAssembly.MainModule.ImportReference(NetworkBehaviourType); NetworkConnectionType = NetAssembly.MainModule.GetType("Mirror.NetworkConnection"); MonoBehaviourType = UnityAssembly.MainModule.GetType("UnityEngine.MonoBehaviour"); ScriptableObjectType = UnityAssembly.MainModule.GetType("UnityEngine.ScriptableObject"); NetworkConnectionType = NetAssembly.MainModule.GetType("Mirror.NetworkConnection"); NetworkConnectionType = CurrentAssembly.MainModule.ImportReference(NetworkConnectionType); MessageBaseType = NetAssembly.MainModule.GetType("Mirror.MessageBase"); SyncListType = NetAssembly.MainModule.GetType("Mirror.SyncList`1"); SyncSetType = NetAssembly.MainModule.GetType("Mirror.SyncSet`1"); SyncDictionaryType = NetAssembly.MainModule.GetType("Mirror.SyncDictionary`2"); NetworkBehaviourDirtyBitsReference = Resolvers.ResolveProperty(NetworkBehaviourType, CurrentAssembly, "syncVarDirtyBits"); ComponentType = UnityAssembly.MainModule.GetType("UnityEngine.Component"); ClientSceneType = NetAssembly.MainModule.GetType("Mirror.ClientScene"); ReadyConnectionReference = Resolvers.ResolveMethod(ClientSceneType, CurrentAssembly, "get_readyConnection"); // get specialized GetComponent<NetworkIdentity>() getComponentReference = Resolvers.ResolveMethodGeneric(ComponentType, CurrentAssembly, "GetComponent", NetworkIdentityType); getNetIdReference = Resolvers.ResolveMethod(networkIdentityTmp, CurrentAssembly, "get_netId"); gameObjectInequality = Resolvers.ResolveMethod(unityObjectType, CurrentAssembly, "op_Inequality"); getBehaviourIsServer = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "get_isServer"); setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SetSyncVar"); setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "set_syncVarHookGuard"); getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "get_syncVarHookGuard"); setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SetSyncVarGameObject"); getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "GetSyncVarGameObject"); setSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SetSyncVarNetworkIdentity"); getSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "GetSyncVarNetworkIdentity"); registerCommandDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "RegisterCommandDelegate"); registerRpcDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "RegisterRpcDelegate"); registerEventDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "RegisterEventDelegate"); getTypeReference = Resolvers.ResolveMethod(objectType, CurrentAssembly, "GetType"); getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, CurrentAssembly, "GetTypeFromHandle"); logErrorReference = Resolvers.ResolveMethod(UnityAssembly.MainModule.GetType("UnityEngine.Debug"), CurrentAssembly, "LogError"); logWarningReference = Resolvers.ResolveMethod(UnityAssembly.MainModule.GetType("UnityEngine.Debug"), CurrentAssembly, "LogWarning"); sendCommandInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendCommandInternal"); sendRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendRPCInternal"); sendTargetRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendTargetRPCInternal"); sendEventInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendEventInternal"); SyncObjectType = CurrentAssembly.MainModule.ImportReference(SyncObjectType); InitSyncObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "InitSyncObject"); }