mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
Merge branch 'dev' of github.com:DCFApixels/DragonECS into dev
This commit is contained in:
commit
c9d9f4c268
@ -21,7 +21,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private static EcsWorld[] _worlds = Array.Empty<EcsWorld>();
|
private static EcsWorld[] _worlds = Array.Empty<EcsWorld>();
|
||||||
private static IdDispenser _worldIdDispenser = new IdDispenser(4, 0, n => Array.Resize(ref _worlds, n));
|
private static readonly IdDispenser _worldIdDispenser = new IdDispenser(4, 0, n => Array.Resize(ref _worlds, n));
|
||||||
|
|
||||||
private static StructList<WorldComponentPoolAbstract> _allWorldComponentPools = new StructList<WorldComponentPoolAbstract>(64);
|
private static StructList<WorldComponentPoolAbstract> _allWorldComponentPools = new StructList<WorldComponentPoolAbstract>(64);
|
||||||
private StructList<WorldComponentPoolAbstract> _worldComponentPools;
|
private StructList<WorldComponentPoolAbstract> _worldComponentPools;
|
||||||
@ -66,6 +66,22 @@ namespace DCFApixels.DragonECS
|
|||||||
return ref WorldComponentPool<T>.GetForWorldUnchecked(worldID);
|
return ref WorldComponentPool<T>.GetForWorldUnchecked(worldID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ResetStaticState()
|
||||||
|
{
|
||||||
|
for (int i = 1; i < _worlds.Length; i++)
|
||||||
|
{
|
||||||
|
var world = _worlds[i];
|
||||||
|
if (world == null) { continue; }
|
||||||
|
|
||||||
|
if(world.IsDestroyed == false)
|
||||||
|
{
|
||||||
|
world.Destroy();
|
||||||
|
}
|
||||||
|
world = null;
|
||||||
|
}
|
||||||
|
_worldIdDispenser.ReleaseAll();
|
||||||
|
}
|
||||||
|
|
||||||
#region WorldComponentPool
|
#region WorldComponentPool
|
||||||
public ReadOnlySpan<WorldComponentPoolAbstract> GetWorldComponents()
|
public ReadOnlySpan<WorldComponentPoolAbstract> GetWorldComponents()
|
||||||
{
|
{
|
||||||
@ -251,11 +267,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region NullWorld
|
||||||
private sealed class NullWorld : EcsWorld
|
private sealed class NullWorld : EcsWorld
|
||||||
{
|
{
|
||||||
internal NullWorld() : base(new EcsWorldConfig(4, 4, 4, 4, 4), null, 0) { }
|
internal NullWorld() : base(new EcsWorldConfig(4, 4, 4, 4, 4), null, 0) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region DebuggerProxy
|
#region DebuggerProxy
|
||||||
protected partial class DebuggerProxy
|
protected partial class DebuggerProxy
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user