mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-19 02:24:37 +08:00
refactoring
This commit is contained in:
parent
94f572a421
commit
cc39522279
@ -48,7 +48,7 @@ namespace DCFApixels.DragonECS
|
||||
_markers = new EcsProfilerMarker[targets.Length];
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(PreInit)}"));
|
||||
_markers[i] = new EcsProfilerMarker($"EcsRunner.{targets[i].GetType().Name}.{nameof(PreInit)}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -77,7 +77,7 @@ namespace DCFApixels.DragonECS
|
||||
_markers = new EcsProfilerMarker[targets.Length];
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Init)}"));
|
||||
_markers[i] = new EcsProfilerMarker($"EcsRunner.{targets[i].GetType().Name}.{nameof(Init)}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -107,7 +107,7 @@ namespace DCFApixels.DragonECS
|
||||
_markers = new EcsProfilerMarker[targets.Length];
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Run)}"));
|
||||
_markers[i] = new EcsProfilerMarker($"EcsRunner.{targets[i].GetType().Name}.{nameof(Run)}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -136,7 +136,7 @@ namespace DCFApixels.DragonECS
|
||||
_markers = new EcsProfilerMarker[targets.Length];
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Destroy)}"));
|
||||
_markers[i] = new EcsProfilerMarker($"EcsRunner.{targets[i].GetType().Name}.{nameof(Destroy)}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -9,12 +9,12 @@ namespace DCFApixels.DragonECS
|
||||
public readonly struct EcsProfilerMarker
|
||||
{
|
||||
public readonly int id;
|
||||
public EcsProfilerMarker(int id) => this.id = id;
|
||||
public EcsProfilerMarker(string name) => id = EcsDebug.RegisterMark(name);
|
||||
internal EcsProfilerMarker(int id) => this.id = id;
|
||||
public EcsProfilerMarker(string name) => id = DebugService.Instance.RegisterMark(name);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Begin() => EcsDebug.ProfileMarkBegin(id);
|
||||
public void Begin() => DebugService.Instance.ProfileMarkBegin(id);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void End() => EcsDebug.ProfileMarkEnd(id);
|
||||
public void End() => DebugService.Instance.ProfileMarkEnd(id);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public AutoScope Auto() => new AutoScope(id);
|
||||
public readonly ref struct AutoScope
|
||||
@ -23,9 +23,9 @@ namespace DCFApixels.DragonECS
|
||||
public AutoScope(int id)
|
||||
{
|
||||
_id = id;
|
||||
EcsDebug.ProfileMarkBegin(id);
|
||||
DebugService.Instance.ProfileMarkBegin(id);
|
||||
}
|
||||
public void Dispose() => EcsDebug.ProfileMarkEnd(_id);
|
||||
public void Dispose() => DebugService.Instance.ProfileMarkEnd(_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,36 +48,6 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.Print(tag, v);
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int RegisterMark(string name)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
return DebugService.Instance.RegisterMark(name);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void DeleteMark(string name)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.DeleteMark(name);
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ProfileMarkBegin(int id)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.ProfileMarkBegin(id);
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ProfileMarkEnd(int id)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.ProfileMarkEnd(id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,9 @@ namespace DCFApixels.DragonECS
|
||||
private const short DEATH_GEN_BIT = short.MinValue;
|
||||
private const int DEL_ENT_BUFFER_SIZE_OFFSET = 2;
|
||||
|
||||
public static EcsWorld[] Worlds = new EcsWorld[8];
|
||||
internal static EcsWorld[] Worlds = new EcsWorld[8];
|
||||
private static IntDispenser _worldIdDispenser = new IntDispenser(0);
|
||||
public static EcsWorld GetWorld(int index) => Worlds[index];
|
||||
|
||||
public readonly short uniqueID;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user