mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 10:04:36 +08:00
add debug into runners / simple refactoring
This commit is contained in:
parent
a14b058977
commit
980d7b0f6a
@ -124,7 +124,7 @@ namespace DCFApixels.DragonECS
|
||||
Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
GUILayout.BeginVertical(EcsEditor.GetStyle(color, 0.2f));
|
||||
GUILayout.Label(type.Name, EditorStyles.boldLabel);
|
||||
GUILayout.Label(string.Join(", ", runner.Targets.Cast<object>().Select(o => o.GetType().Name)));
|
||||
GUILayout.Label(string.Join(", ", runner.Targets.Cast<object>().Select(o => o.GetType().Name)), EditorStyles.miniLabel);
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ namespace DCFApixels.DragonECS
|
||||
_ecsWorld = ecsWorld;
|
||||
WorldDebugMonitor monitor = new GameObject(EcsConsts.DEBUG_PREFIX + _monitorName).AddComponent<WorldDebugMonitor>();
|
||||
WorldPoolsMonitor poolsmonitor = new GameObject(EcsConsts.DEBUG_PREFIX + _monitorName).AddComponent<WorldPoolsMonitor>();
|
||||
poolsmonitor.transform.SetParent(monitor.transform);
|
||||
|
||||
monitor.source = this;
|
||||
monitor.world = _ecsWorld;
|
||||
@ -23,7 +24,7 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
poolsmonitor.source = this;
|
||||
poolsmonitor.world = _ecsWorld;
|
||||
poolsmonitor.monitorName = _monitorName;
|
||||
poolsmonitor.monitorName = "Pools";
|
||||
}
|
||||
|
||||
public void Run(EcsPipeline pipeline)
|
||||
@ -147,7 +148,7 @@ namespace DCFApixels.DragonECS
|
||||
GUI.contentColor = defaultContentColor;
|
||||
GUIStyle textStyle2 = EditorStyles.miniBoldLabel;
|
||||
textStyle2.alignment = TextAnchor.LowerCenter;
|
||||
GUI.Label(AddMargin(position, 3f, 3f), pool.DataType.Name, textStyle2);
|
||||
GUI.Label(AddMargin(position, -10f, 3f), pool.DataType.Name, textStyle2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsFixedRunSystem : IEcsSystem
|
||||
{
|
||||
public void FixedRun(EcsPipeline pipeline);
|
||||
}
|
||||
|
||||
public class EcsFixedRunSystemRunner : EcsRunner<IEcsFixedRunSystem>, IEcsFixedRunSystem
|
||||
{
|
||||
void IEcsFixedRunSystem.FixedRun(EcsPipeline pipeline)
|
||||
{
|
||||
foreach (var item in targets) item.FixedRun(pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
public static class IEcsFixedRunSystemExtensions
|
||||
{
|
||||
public static void FixedRun(this EcsPipeline pipeline)
|
||||
{
|
||||
pipeline.GetRunner<IEcsFixedRunSystem>().FixedRun(pipeline);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aff69967c9d73594283178ea5530cf71
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,23 +0,0 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsLateRunSystem : IEcsSystem
|
||||
{
|
||||
public void LateRun(EcsPipeline systems);
|
||||
}
|
||||
|
||||
public class EcsLateRunSystemRunner : EcsRunner<IEcsLateRunSystem>, IEcsLateRunSystem
|
||||
{
|
||||
void IEcsLateRunSystem.LateRun(EcsPipeline systems)
|
||||
{
|
||||
foreach (var item in targets) item.LateRun(systems);
|
||||
}
|
||||
}
|
||||
|
||||
public static class IEcsLateRunSystemExtensions
|
||||
{
|
||||
public static void LateRun(this EcsPipeline systems)
|
||||
{
|
||||
systems.GetRunner<IEcsLateRunSystem>().LateRun(systems);
|
||||
}
|
||||
}
|
||||
}
|
89
src/Runners/Runners.cs
Normal file
89
src/Runners/Runners.cs
Normal file
@ -0,0 +1,89 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsLateRunSystem : IEcsSystem
|
||||
{
|
||||
public void LateRun(EcsPipeline pipeline);
|
||||
}
|
||||
|
||||
public class EcsLateRunSystemRunner : EcsRunner<IEcsLateRunSystem>, IEcsLateRunSystem
|
||||
{
|
||||
#if DEBUG
|
||||
private EcsProfilerMarker[] _markers;
|
||||
#endif
|
||||
public void LateRun(EcsPipeline pipeline)
|
||||
{
|
||||
#if DEBUG
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
using (_markers[i].Auto())
|
||||
targets[i].LateRun(pipeline);
|
||||
}
|
||||
#else
|
||||
foreach (var item in targets) item.LateRun(systems);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
protected override void OnSetup()
|
||||
{
|
||||
_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(LateRun)}"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public static class IEcsLateRunSystemExtensions
|
||||
{
|
||||
public static void LateRun(this EcsPipeline systems)
|
||||
{
|
||||
systems.GetRunner<IEcsLateRunSystem>().LateRun(systems);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public interface IEcsFixedRunSystem : IEcsSystem
|
||||
{
|
||||
public void FixedRun(EcsPipeline pipeline);
|
||||
}
|
||||
public class EcsFixedRunSystemRunner : EcsRunner<IEcsFixedRunSystem>, IEcsFixedRunSystem
|
||||
{
|
||||
#if DEBUG
|
||||
private EcsProfilerMarker[] _markers;
|
||||
#endif
|
||||
public void FixedRun(EcsPipeline pipeline)
|
||||
{
|
||||
#if DEBUG
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
using (_markers[i].Auto())
|
||||
targets[i].FixedRun(pipeline);
|
||||
}
|
||||
#else
|
||||
foreach (var item in targets) item.FixedRun(pipeline);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
protected override void OnSetup()
|
||||
{
|
||||
_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(FixedRun)}"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public static class IEcsFixedRunSystemExtensions
|
||||
{
|
||||
public static void FixedRun(this EcsPipeline pipeline)
|
||||
{
|
||||
pipeline.GetRunner<IEcsFixedRunSystem>().FixedRun(pipeline);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user