mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
breaking: get/setSyncVarHookGuard renamed to Get/SetSyncVarHookGuard
This commit is contained in:
parent
e4305b9d97
commit
e9a6b6e3d3
@ -102,8 +102,8 @@ public WeaverTypes(AssemblyDefinition assembly, Logger Log, ref bool WeavingFail
|
|||||||
syncVarNetworkIdentityEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SyncVarNetworkIdentityEqual", ref WeavingFailed);
|
syncVarNetworkIdentityEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SyncVarNetworkIdentityEqual", ref WeavingFailed);
|
||||||
syncVarGameObjectEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SyncVarGameObjectEqual", ref WeavingFailed);
|
syncVarGameObjectEqualReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SyncVarGameObjectEqual", ref WeavingFailed);
|
||||||
setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SetSyncVar", ref WeavingFailed);
|
setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SetSyncVar", ref WeavingFailed);
|
||||||
setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "setSyncVarHookGuard", ref WeavingFailed);
|
setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SetSyncVarHookGuard", ref WeavingFailed);
|
||||||
getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "getSyncVarHookGuard", ref WeavingFailed);
|
getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "GetSyncVarHookGuard", ref WeavingFailed);
|
||||||
|
|
||||||
setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SetSyncVarGameObject", ref WeavingFailed);
|
setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "SetSyncVarGameObject", ref WeavingFailed);
|
||||||
getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "GetSyncVarGameObject", ref WeavingFailed);
|
getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, assembly, Log, "GetSyncVarGameObject", ref WeavingFailed);
|
||||||
|
@ -74,13 +74,14 @@ public abstract class NetworkBehaviour : MonoBehaviour
|
|||||||
ulong syncVarHookGuard;
|
ulong syncVarHookGuard;
|
||||||
|
|
||||||
// USED BY WEAVER to set syncvars in host mode without deadlocking
|
// USED BY WEAVER to set syncvars in host mode without deadlocking
|
||||||
protected bool getSyncVarHookGuard(ulong dirtyBit)
|
protected bool GetSyncVarHookGuard(ulong dirtyBit) =>
|
||||||
{
|
(syncVarHookGuard & dirtyBit) != 0UL;
|
||||||
return (syncVarHookGuard & dirtyBit) != 0UL;
|
|
||||||
}
|
[Obsolete("Renamed to GetSyncVarHookGuard (uppercase)")]
|
||||||
|
protected bool getSyncVarHookGuard(ulong dirtyBit) => GetSyncVarHookGuard(dirtyBit);
|
||||||
|
|
||||||
// USED BY WEAVER to set syncvars in host mode without deadlocking
|
// USED BY WEAVER to set syncvars in host mode without deadlocking
|
||||||
protected void setSyncVarHookGuard(ulong dirtyBit, bool value)
|
protected void SetSyncVarHookGuard(ulong dirtyBit, bool value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
syncVarHookGuard |= dirtyBit;
|
syncVarHookGuard |= dirtyBit;
|
||||||
@ -88,6 +89,9 @@ protected void setSyncVarHookGuard(ulong dirtyBit, bool value)
|
|||||||
syncVarHookGuard &= ~dirtyBit;
|
syncVarHookGuard &= ~dirtyBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Renamed to SetSyncVarHookGuard (uppercase)")]
|
||||||
|
protected void setSyncVarHookGuard(ulong dirtyBit, bool value) => SetSyncVarHookGuard(dirtyBit, value);
|
||||||
|
|
||||||
// SyncLists, SyncSets, etc.
|
// SyncLists, SyncSets, etc.
|
||||||
protected readonly List<SyncObject> syncObjects = new List<SyncObject>();
|
protected readonly List<SyncObject> syncObjects = new List<SyncObject>();
|
||||||
|
|
||||||
@ -271,7 +275,7 @@ protected bool SyncVarGameObjectEqual(GameObject newGameObject, uint netIdField)
|
|||||||
// helper function for [SyncVar] GameObjects.
|
// helper function for [SyncVar] GameObjects.
|
||||||
protected void SetSyncVarGameObject(GameObject newGameObject, ref GameObject gameObjectField, ulong dirtyBit, ref uint netIdField)
|
protected void SetSyncVarGameObject(GameObject newGameObject, ref GameObject gameObjectField, ulong dirtyBit, ref uint netIdField)
|
||||||
{
|
{
|
||||||
if (getSyncVarHookGuard(dirtyBit))
|
if (GetSyncVarHookGuard(dirtyBit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint newNetId = 0;
|
uint newNetId = 0;
|
||||||
@ -334,7 +338,7 @@ protected bool SyncVarNetworkIdentityEqual(NetworkIdentity newIdentity, uint net
|
|||||||
// helper function for [SyncVar] NetworkIdentities.
|
// helper function for [SyncVar] NetworkIdentities.
|
||||||
protected void SetSyncVarNetworkIdentity(NetworkIdentity newIdentity, ref NetworkIdentity identityField, ulong dirtyBit, ref uint netIdField)
|
protected void SetSyncVarNetworkIdentity(NetworkIdentity newIdentity, ref NetworkIdentity identityField, ulong dirtyBit, ref uint netIdField)
|
||||||
{
|
{
|
||||||
if (getSyncVarHookGuard(dirtyBit))
|
if (GetSyncVarHookGuard(dirtyBit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint newNetId = 0;
|
uint newNetId = 0;
|
||||||
@ -391,7 +395,7 @@ protected bool SyncVarNetworkBehaviourEqual<T>(T newBehaviour, NetworkBehaviourS
|
|||||||
// helper function for [SyncVar] NetworkIdentities.
|
// helper function for [SyncVar] NetworkIdentities.
|
||||||
protected void SetSyncVarNetworkBehaviour<T>(T newBehaviour, ref T behaviourField, ulong dirtyBit, ref NetworkBehaviourSyncVar syncField) where T : NetworkBehaviour
|
protected void SetSyncVarNetworkBehaviour<T>(T newBehaviour, ref T behaviourField, ulong dirtyBit, ref NetworkBehaviourSyncVar syncField) where T : NetworkBehaviour
|
||||||
{
|
{
|
||||||
if (getSyncVarHookGuard(dirtyBit))
|
if (GetSyncVarHookGuard(dirtyBit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint newNetId = 0;
|
uint newNetId = 0;
|
||||||
|
@ -974,15 +974,15 @@ public void HookGuard()
|
|||||||
ulong bit = 1ul << i;
|
ulong bit = 1ul << i;
|
||||||
|
|
||||||
// should be false by default
|
// should be false by default
|
||||||
Assert.That(getSyncVarHookGuard(bit), Is.False);
|
Assert.That(GetSyncVarHookGuard(bit), Is.False);
|
||||||
|
|
||||||
// set true
|
// set true
|
||||||
setSyncVarHookGuard(bit, true);
|
SetSyncVarHookGuard(bit, true);
|
||||||
Assert.That(getSyncVarHookGuard(bit), Is.True);
|
Assert.That(GetSyncVarHookGuard(bit), Is.True);
|
||||||
|
|
||||||
// set false again
|
// set false again
|
||||||
setSyncVarHookGuard(bit, false);
|
SetSyncVarHookGuard(bit, false);
|
||||||
Assert.That(getSyncVarHookGuard(bit), Is.False);
|
Assert.That(GetSyncVarHookGuard(bit), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user