mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
add debugger proxy
This commit is contained in:
parent
07e8319475
commit
44c49b987a
@ -1,10 +1,14 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
[DebuggerTypeProxy(typeof(DebuggerProxy))]
|
||||
public sealed class EcsDefaultWorld : EcsWorld
|
||||
{
|
||||
public EcsDefaultWorld(EcsWorldConfig config, short worldID = -1) : base(config, worldID) { }
|
||||
public EcsDefaultWorld(IConfigContainer configs = null, short worldID = -1) : base(configs, worldID) { }
|
||||
}
|
||||
[DebuggerTypeProxy(typeof(DebuggerProxy))]
|
||||
public sealed class EcsEventWorld : EcsWorld
|
||||
{
|
||||
public EcsEventWorld(EcsWorldConfig config, short worldID = -1) : base(config, worldID) { }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using DCFApixels.DragonECS.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@ -23,6 +24,7 @@ namespace DCFApixels.DragonECS
|
||||
PoolRecycledComponentsCapacity = poolRecycledComponentsCapacity;
|
||||
}
|
||||
}
|
||||
[DebuggerTypeProxy(typeof(DebuggerProxy))]
|
||||
public partial class EcsWorld : IEntityStorage
|
||||
{
|
||||
public readonly short id;
|
||||
@ -544,6 +546,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
_entityDispenser.Upsize(minSize);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private int CalcEntityComponentMaskLastIndex()
|
||||
{
|
||||
int result = _pools.Length / COMPONENT_MASK_CHUNK_SIZE;
|
||||
@ -734,6 +737,34 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DebuggerProxy
|
||||
private EcsSpan GetSpan_Debug()
|
||||
{
|
||||
return _entityDispenser.UsedToEcsSpan(id);
|
||||
}
|
||||
protected class DebuggerProxy
|
||||
{
|
||||
private EcsWorld _world;
|
||||
public EntitySlotInfo[] Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
EntitySlotInfo[] result = new EntitySlotInfo[_world.Count];
|
||||
int i = 0;
|
||||
foreach (var e in _world.ToSpan())
|
||||
{
|
||||
result[i++] = _world.GetEntitySlotInfoDebug(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public DebuggerProxy(EcsWorld world)
|
||||
{
|
||||
_world = world;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class EcsWorldExtenssions
|
||||
|
Loading…
Reference in New Issue
Block a user