mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
simple refactoring
This commit is contained in:
parent
e7bec84bf4
commit
f228ca50d2
@ -668,11 +668,9 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public unsafe void ReleaseDelEntityBuffer(int count)
|
public unsafe void ReleaseDelEntityBuffer(int count)
|
||||||
{
|
{
|
||||||
if (_delEntBufferCount <= 0)
|
if (_delEntBufferCount <= 0) { return; }
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
unchecked { _version++; }
|
unchecked { _version++; }
|
||||||
|
|
||||||
count = Math.Max(0, Math.Min(count, _delEntBufferCount));
|
count = Math.Max(0, Math.Min(count, _delEntBufferCount));
|
||||||
_delEntBufferCount -= count;
|
_delEntBufferCount -= count;
|
||||||
int slisedCount = count;
|
int slisedCount = count;
|
||||||
@ -689,7 +687,9 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadOnlySpan<int> buffer = new ReadOnlySpan<int>(_delEntBuffer, _delEntBufferCount, count);
|
//если фулл очистка то _delEntBufferCount будет 0
|
||||||
|
|
||||||
|
ReadOnlySpan<int> fullBuffer = new ReadOnlySpan<int>(_delEntBuffer, _delEntBufferCount, count);
|
||||||
if (slisedCount > 0)
|
if (slisedCount > 0)
|
||||||
{
|
{
|
||||||
ReadOnlySpan<int> bufferSlised = new ReadOnlySpan<int>(_delEntBuffer, _delEntBufferCount, slisedCount);
|
ReadOnlySpan<int> bufferSlised = new ReadOnlySpan<int>(_delEntBuffer, _delEntBufferCount, slisedCount);
|
||||||
@ -704,7 +704,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
if (group.IsReleased)
|
if (group.IsReleased)
|
||||||
{
|
{
|
||||||
group.OnReleaseDelEntityBuffer_Internal(buffer);
|
group.OnReleaseDelEntityBuffer_Internal(fullBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -713,10 +713,10 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_listeners.InvokeOnReleaseDelEntityBuffer(buffer);
|
_listeners.InvokeOnReleaseDelEntityBuffer(fullBuffer);
|
||||||
for (int i = 0; i < buffer.Length; i++)
|
for (int i = 0; i < fullBuffer.Length; i++)
|
||||||
{
|
{
|
||||||
int e = buffer[i];
|
int e = fullBuffer[i];
|
||||||
_entityDispenser.Release(e);
|
_entityDispenser.Release(e);
|
||||||
_entities[e].gen |= GEN_SLEEP_MASK;
|
_entities[e].gen |= GEN_SLEEP_MASK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user