mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
SyncVarProcessor: remove static Weaver.CurrentAssembly references
This commit is contained in:
parent
e36b39f328
commit
133c4bb181
@ -46,7 +46,7 @@ public struct ClientRpcResult
|
||||
public NetworkBehaviourProcessor(AssemblyDefinition assembly, TypeDefinition td)
|
||||
{
|
||||
this.assembly = assembly;
|
||||
syncVarProcessor = new SyncVarProcessor();
|
||||
syncVarProcessor = new SyncVarProcessor(assembly);
|
||||
netBehaviourSubclass = td;
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,16 @@ public class SyncVarProcessor
|
||||
// ulong = 64 bytes
|
||||
const int SyncVarLimit = 64;
|
||||
|
||||
AssemblyDefinition assembly;
|
||||
|
||||
string HookParameterMessage(string hookName, TypeReference ValueType) =>
|
||||
$"void {hookName}({ValueType} oldValue, {ValueType} newValue)";
|
||||
|
||||
public SyncVarProcessor(AssemblyDefinition assembly)
|
||||
{
|
||||
this.assembly = assembly;
|
||||
}
|
||||
|
||||
// Get hook method if any
|
||||
public MethodDefinition GetHookMethod(TypeDefinition td, FieldDefinition syncVar)
|
||||
{
|
||||
@ -116,7 +123,7 @@ public MethodDefinition GenerateSyncVarGetter(FieldDefinition fd, string origina
|
||||
worker.Emit(OpCodes.Ldfld, netFieldId);
|
||||
worker.Emit(OpCodes.Ldarg_0);
|
||||
worker.Emit(OpCodes.Ldflda, fd);
|
||||
MethodReference getFunc = Weaver.weaverTypes.getSyncVarNetworkBehaviourReference.MakeGeneric(Weaver.CurrentAssembly.MainModule, fd.FieldType);
|
||||
MethodReference getFunc = Weaver.weaverTypes.getSyncVarNetworkBehaviourReference.MakeGeneric(assembly.MainModule, fd.FieldType);
|
||||
worker.Emit(OpCodes.Call, getFunc);
|
||||
worker.Emit(OpCodes.Ret);
|
||||
}
|
||||
@ -176,7 +183,7 @@ public MethodDefinition GenerateSyncVarSetter(TypeDefinition td, FieldDefinition
|
||||
worker.Emit(OpCodes.Ldarg_0);
|
||||
worker.Emit(OpCodes.Ldfld, netFieldId);
|
||||
|
||||
MethodReference getFunc = Weaver.weaverTypes.syncVarNetworkBehaviourEqualReference.MakeGeneric(Weaver.CurrentAssembly.MainModule, fd.FieldType);
|
||||
MethodReference getFunc = Weaver.weaverTypes.syncVarNetworkBehaviourEqualReference.MakeGeneric(assembly.MainModule, fd.FieldType);
|
||||
worker.Emit(OpCodes.Call, getFunc);
|
||||
}
|
||||
else
|
||||
@ -235,7 +242,7 @@ public MethodDefinition GenerateSyncVarSetter(TypeDefinition td, FieldDefinition
|
||||
worker.Emit(OpCodes.Ldarg_0);
|
||||
worker.Emit(OpCodes.Ldflda, netFieldId);
|
||||
|
||||
MethodReference getFunc = Weaver.weaverTypes.setSyncVarNetworkBehaviourReference.MakeGeneric(Weaver.CurrentAssembly.MainModule, fd.FieldType);
|
||||
MethodReference getFunc = Weaver.weaverTypes.setSyncVarNetworkBehaviourReference.MakeGeneric(assembly.MainModule, fd.FieldType);
|
||||
worker.Emit(OpCodes.Call, getFunc);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user