mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
update debug tools
This commit is contained in:
parent
b6db1dfe3f
commit
171bdb429c
@ -133,7 +133,8 @@ namespace DCFApixels.DragonECS
|
||||
return;
|
||||
|
||||
string name = EcsEditor.GetGenericName(type);
|
||||
Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
//Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
Color color = EcsDebugUtility.GetColorRGB(type).ToUnityColor();
|
||||
|
||||
GUILayout.BeginVertical(EcsEditor.GetStyle(color, 0.2f));
|
||||
if (DebugMonitorPrefs.instance.IsShowInterfaces)
|
||||
@ -150,7 +151,9 @@ namespace DCFApixels.DragonECS
|
||||
if (CheckIsHidden(type))
|
||||
return;
|
||||
|
||||
Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
//Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
Color color = EcsDebugUtility.GetColorRGB(type).ToUnityColor();
|
||||
|
||||
GUILayout.BeginVertical(EcsEditor.GetStyle(color, 0.2f));
|
||||
GUILayout.Label(EcsEditor.GetGenericName(type), EditorStyles.boldLabel);
|
||||
GUILayout.Label(string.Join(", ", runner.Targets.Cast<object>().Select(o => o.GetType().Name)), systemsListStyle);
|
||||
|
@ -169,8 +169,9 @@ namespace DCFApixels.DragonECS
|
||||
Type type = browsable.GetType();
|
||||
string name = browsableName == null ? type.Name : GetLastPathComponent(browsableName.Name);
|
||||
string description = customInitializer != null ? customInitializer.Description : initializerType.GetCustomAttribute<DebugDescriptionAttribute>()?.description;
|
||||
Color panelColor = customInitializer != null ? customInitializer.Color : initializerType.GetCustomAttribute<DebugColorAttribute>()?.GetUnityColor() ?? Color.black;
|
||||
|
||||
// Color panelColor = customInitializer != null ? customInitializer.Color : initializerType.GetCustomAttribute<DebugColorAttribute>()?.GetUnityColor() ?? Color.black;
|
||||
Color panelColor = customInitializer != null ? customInitializer.Color : EcsDebugUtility.GetColorRGB(initializerType).ToUnityColor();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.BeginVertical(EcsEditor.GetStyle(panelColor, 0.2f));
|
||||
|
@ -38,9 +38,10 @@ namespace DCFApixels.DragonECS
|
||||
#region Get meta
|
||||
internal static Color GetColor(Type type)
|
||||
{
|
||||
var atr = type.GetCustomAttribute<DebugColorAttribute>();
|
||||
if (atr == null) return Color.black;
|
||||
return atr.GetUnityColor();
|
||||
//var atr = type.GetCustomAttribute<DebugColorAttribute>();
|
||||
//if (atr == null) return Color.black;
|
||||
//return atr.GetUnityColor();
|
||||
return EcsDebugUtility.GetColorRGB(type).ToUnityColor();
|
||||
}
|
||||
internal static string GetName(Type type)
|
||||
{
|
||||
|
@ -2,6 +2,18 @@
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsGizmosProcess : IEcsProcess
|
||||
{
|
||||
public void DrawGizmos(EcsPipeline pipeline);
|
||||
}
|
||||
public static class IEcsGizmosProcessExtensions
|
||||
{
|
||||
public static void DrawGizmos(this EcsPipeline systems)
|
||||
{
|
||||
systems.GetRunner<IEcsGizmosProcess>().DrawGizmos(systems);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IEcsLateRunProcess : IEcsProcess
|
||||
{
|
||||
public void LateRun(EcsPipeline pipeline);
|
||||
@ -27,6 +39,37 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
namespace Internal
|
||||
{
|
||||
[DebugColor(DebugColor.Orange)]
|
||||
public class EcsLateGizmosSystemRunner : EcsRunner<IEcsGizmosProcess>, IEcsGizmosProcess
|
||||
{
|
||||
#if DEBUG && !DISABLE_DEBUG
|
||||
private EcsProfilerMarker[] _markers;
|
||||
#endif
|
||||
public void DrawGizmos(EcsPipeline pipeline)
|
||||
{
|
||||
#if DEBUG && !DISABLE_DEBUG
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
using (_markers[i].Auto())
|
||||
targets[i].DrawGizmos(pipeline);
|
||||
}
|
||||
#else
|
||||
foreach (var item in targets) item.DrawGizmos(pipeline);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG && !DISABLE_DEBUG
|
||||
protected override void OnSetup()
|
||||
{
|
||||
_markers = new EcsProfilerMarker[targets.Length];
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
_markers[i] = new EcsProfilerMarker($"{targets[i].GetType().Name}.{nameof(DrawGizmos)}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[DebugColor(DebugColor.Orange)]
|
||||
public class EcsLateRunSystemRunner : EcsRunner<IEcsLateRunProcess>, IEcsLateRunProcess
|
||||
{
|
||||
|
@ -12,5 +12,14 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
return new Color32(self.r, self.g, self.b, 255);
|
||||
}
|
||||
|
||||
public static Color ToUnityColor(this (byte, byte, byte) self)
|
||||
{
|
||||
return new Color(self.Item1 / 255f, self.Item2 / 255f, self.Item3 / 255f);
|
||||
}
|
||||
public static Color32 ToUnityColor32(this (byte, byte, byte) self)
|
||||
{
|
||||
return new Color32(self.Item1, self.Item2, self.Item3, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user