mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Simplify namespace
This commit is contained in:
parent
0fbcefe8df
commit
9d7c9069d7
@ -20,7 +20,7 @@ static string HookParameterMessage(string hookName, TypeReference ValueType)
|
|||||||
// Get hook method if any
|
// Get hook method if any
|
||||||
public static MethodDefinition GetHookMethod(TypeDefinition td, FieldDefinition syncVar)
|
public static MethodDefinition GetHookMethod(TypeDefinition td, FieldDefinition syncVar)
|
||||||
{
|
{
|
||||||
CustomAttribute syncVarAttr = syncVar.GetCustomAttribute<Mirror.SyncVarAttribute>();
|
CustomAttribute syncVarAttr = syncVar.GetCustomAttribute<SyncVarAttribute>();
|
||||||
|
|
||||||
if (syncVarAttr == null)
|
if (syncVarAttr == null)
|
||||||
return null;
|
return null;
|
||||||
@ -95,7 +95,7 @@ public static MethodDefinition ProcessSyncVarGet(FieldDefinition fd, string orig
|
|||||||
worker.Append(worker.Create(OpCodes.Ret));
|
worker.Append(worker.Create(OpCodes.Ret));
|
||||||
}
|
}
|
||||||
// [SyncVar] NetworkIdentity?
|
// [SyncVar] NetworkIdentity?
|
||||||
else if (fd.FieldType.Is<Mirror.NetworkIdentity>())
|
else if (fd.FieldType.Is<NetworkIdentity>())
|
||||||
{
|
{
|
||||||
// return this.GetSyncVarNetworkIdentity(ref field, uint netId);
|
// return this.GetSyncVarNetworkIdentity(ref field, uint netId);
|
||||||
// this.
|
// this.
|
||||||
@ -149,7 +149,7 @@ public static MethodDefinition ProcessSyncVarSet(TypeDefinition td, FieldDefinit
|
|||||||
|
|
||||||
worker.Append(worker.Create(OpCodes.Call, WeaverTypes.syncVarGameObjectEqualReference));
|
worker.Append(worker.Create(OpCodes.Call, WeaverTypes.syncVarGameObjectEqualReference));
|
||||||
}
|
}
|
||||||
else if (fd.FieldType.Is<Mirror.NetworkIdentity>())
|
else if (fd.FieldType.Is<NetworkIdentity>())
|
||||||
{
|
{
|
||||||
// reference to netId Field to set
|
// reference to netId Field to set
|
||||||
worker.Append(worker.Create(OpCodes.Ldarg_0));
|
worker.Append(worker.Create(OpCodes.Ldarg_0));
|
||||||
@ -199,7 +199,7 @@ public static MethodDefinition ProcessSyncVarSet(TypeDefinition td, FieldDefinit
|
|||||||
|
|
||||||
worker.Append(worker.Create(OpCodes.Call, WeaverTypes.setSyncVarGameObjectReference));
|
worker.Append(worker.Create(OpCodes.Call, WeaverTypes.setSyncVarGameObjectReference));
|
||||||
}
|
}
|
||||||
else if (fd.FieldType.Is<Mirror.NetworkIdentity>())
|
else if (fd.FieldType.Is<NetworkIdentity>())
|
||||||
{
|
{
|
||||||
// reference to netId Field to set
|
// reference to netId Field to set
|
||||||
worker.Append(worker.Create(OpCodes.Ldarg_0));
|
worker.Append(worker.Create(OpCodes.Ldarg_0));
|
||||||
@ -267,7 +267,7 @@ public static void ProcessSyncVar(TypeDefinition td, FieldDefinition fd, Diction
|
|||||||
// GameObject/NetworkIdentity SyncVars have a new field for netId
|
// GameObject/NetworkIdentity SyncVars have a new field for netId
|
||||||
FieldDefinition netIdField = null;
|
FieldDefinition netIdField = null;
|
||||||
if (fd.FieldType.Is<UnityEngine.GameObject>() ||
|
if (fd.FieldType.Is<UnityEngine.GameObject>() ||
|
||||||
fd.FieldType.Is<Mirror.NetworkIdentity>())
|
fd.FieldType.Is<NetworkIdentity>())
|
||||||
{
|
{
|
||||||
netIdField = new FieldDefinition("___" + fd.Name + "NetId",
|
netIdField = new FieldDefinition("___" + fd.Name + "NetId",
|
||||||
FieldAttributes.Private,
|
FieldAttributes.Private,
|
||||||
@ -298,7 +298,7 @@ public static void ProcessSyncVar(TypeDefinition td, FieldDefinition fd, Diction
|
|||||||
// -> only for GameObjects, otherwise an int syncvar's getter would
|
// -> only for GameObjects, otherwise an int syncvar's getter would
|
||||||
// end up in recursion.
|
// end up in recursion.
|
||||||
if (fd.FieldType.Is<UnityEngine.GameObject>() ||
|
if (fd.FieldType.Is<UnityEngine.GameObject>() ||
|
||||||
fd.FieldType.Is<Mirror.NetworkIdentity>())
|
fd.FieldType.Is<NetworkIdentity>())
|
||||||
{
|
{
|
||||||
Weaver.WeaveLists.replacementGetterProperties[fd] = get;
|
Weaver.WeaveLists.replacementGetterProperties[fd] = get;
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ public static (List<FieldDefinition> syncVars, Dictionary<FieldDefinition, Field
|
|||||||
// find syncvars
|
// find syncvars
|
||||||
foreach (FieldDefinition fd in td.Fields)
|
foreach (FieldDefinition fd in td.Fields)
|
||||||
{
|
{
|
||||||
if (fd.HasCustomAttribute<Mirror.SyncVarAttribute>())
|
if (fd.HasCustomAttribute<SyncVarAttribute>())
|
||||||
{
|
{
|
||||||
if ((fd.Attributes & FieldAttributes.Static) != 0)
|
if ((fd.Attributes & FieldAttributes.Static) != 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user