mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkBehaviourProcessor: MirrorProcessed function name stored in const
This commit is contained in:
parent
0710c720ef
commit
ff056707d4
@ -144,17 +144,19 @@ public static bool WriteArguments(ILProcessor worker, MethodDefinition md, strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mark / check type as processed //////////////////////////////////////
|
// mark / check type as processed //////////////////////////////////////
|
||||||
|
const string MirrorProcessedFunction = "MirrorProcessed";
|
||||||
|
|
||||||
// by adding an empty MirrorProcessed() function
|
// by adding an empty MirrorProcessed() function
|
||||||
public static bool WasProcessed(TypeDefinition td)
|
public static bool WasProcessed(TypeDefinition td)
|
||||||
{
|
{
|
||||||
return td.Methods.Any(method => method.Name == "MirrorProcessed");
|
return td.Methods.Any(method => method.Name == MirrorProcessedFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MarkAsProcessed(TypeDefinition td)
|
public static void MarkAsProcessed(TypeDefinition td)
|
||||||
{
|
{
|
||||||
if (!WasProcessed(td))
|
if (!WasProcessed(td))
|
||||||
{
|
{
|
||||||
MethodDefinition versionMethod = new MethodDefinition("MirrorProcessed", MethodAttributes.Private, Weaver.voidType);
|
MethodDefinition versionMethod = new MethodDefinition(MirrorProcessedFunction, MethodAttributes.Private, Weaver.voidType);
|
||||||
ILProcessor worker = versionMethod.Body.GetILProcessor();
|
ILProcessor worker = versionMethod.Body.GetILProcessor();
|
||||||
worker.Append(worker.Create(OpCodes.Ret));
|
worker.Append(worker.Create(OpCodes.Ret));
|
||||||
td.Methods.Add(versionMethod);
|
td.Methods.Add(versionMethod);
|
||||||
|
Loading…
Reference in New Issue
Block a user