This commit is contained in:
DCFApixels 2025-03-24 19:29:58 +08:00
parent 615d201424
commit 2fa250b648
2 changed files with 7 additions and 5 deletions

View File

@ -81,6 +81,7 @@ namespace DCFApixels.DragonECS
public static void ResetStaticState()
{
var nullworld = _worlds[0];
for (int i = 1; i < _worlds.Length; i++)
{
var world = _worlds[i];
@ -92,7 +93,8 @@ namespace DCFApixels.DragonECS
}
world = null;
}
_worlds = Array.Empty<EcsWorld>();
_worlds = new EcsWorld[_worldIdDispenser.Capacity];
_worlds[0] = nullworld;
_worldIdDispenser.ReleaseAll();
}

View File

@ -35,7 +35,7 @@ namespace DCFApixels.DragonECS.Internal
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _usedCount; }
}
public int Size
public int Capacity
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _size; }
@ -339,7 +339,7 @@ namespace DCFApixels.DragonECS.Internal
{
get
{
Pair[] result = new Pair[_target.Size];
Pair[] result = new Pair[_target.Capacity];
for (int i = 0; i < result.Length; i++)
{
result[i] = new Pair(
@ -354,7 +354,7 @@ namespace DCFApixels.DragonECS.Internal
{
get
{
ID[] result = new ID[_target.Size];
ID[] result = new ID[_target.Capacity];
for (int i = 0; i < result.Length; i++)
{
int id = _target._dense[i];
@ -365,7 +365,7 @@ namespace DCFApixels.DragonECS.Internal
}
public bool IsValid => _target.IsValid();
public int Count => _target.Count;
public int Size => _target.Size;
public int Capacity => _target.Capacity;
public int NullID => _target._nullID;
internal readonly struct ID
{