This commit is contained in:
vis2k 2021-09-16 14:35:31 +08:00
parent f161fa8f43
commit b5b3d33704

View File

@ -115,22 +115,6 @@ public void SetDirtyBit(ulong dirtyBit)
syncVarDirtyBits |= dirtyBit;
}
/// <summary>Clears all the dirty bits that were set by SetDirtyBits()</summary>
// automatically invoked when an update is sent for this object, but can
// be called manually as well.
public void ClearAllDirtyBits()
{
lastSyncTime = NetworkTime.localTime;
syncVarDirtyBits = 0L;
// flush all unsynchronized changes in syncobjects
// (Linq allocates, use for instead)
for (int i = 0; i < syncObjects.Count; ++i)
{
syncObjects[i].Flush();
}
}
// creates a 64 bit dirty mask for Sync Collections (aka SyncObjects)
internal ulong DirtyObjectBits()
{
@ -170,6 +154,22 @@ public bool IsDirty()
return false;
}
/// <summary>Clears all the dirty bits that were set by SetDirtyBits()</summary>
// automatically invoked when an update is sent for this object, but can
// be called manually as well.
public void ClearAllDirtyBits()
{
lastSyncTime = NetworkTime.localTime;
syncVarDirtyBits = 0L;
// flush all unsynchronized changes in syncobjects
// (Linq allocates, use for instead)
for (int i = 0; i < syncObjects.Count; ++i)
{
syncObjects[i].Flush();
}
}
// this gets called in the constructor by the weaver
// for every SyncObject in the component (e.g. SyncLists).
// We collect all of them and we synchronize them with OnSerialize/OnDeserialize