mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 10:04:36 +08:00
Update SystemsDebugSystem
This commit is contained in:
parent
c10b70016a
commit
70e7c8a80d
8
src/Debug/DebugService.meta
Normal file
8
src/Debug/DebugService.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a124aa9f464ff79439c89b52281215d3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
src/Debug/Systems.meta
Normal file
8
src/Debug/Systems.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91478d75aea56d14283e3a4fac691ae0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
src/Debug/Systems/DebugMonitorPrefs.cs
Normal file
17
src/Debug/Systems/DebugMonitorPrefs.cs
Normal file
@ -0,0 +1,17 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
[FilePath("DragonECS/DebugMonitorPrefs.prefs", FilePathAttribute.Location.ProjectFolder)]
|
||||
public class DebugMonitorPrefs : ScriptableSingleton<DebugMonitorPrefs>
|
||||
{
|
||||
public bool isShowHidden = false;
|
||||
public bool isShowInterfaces = false;
|
||||
}
|
||||
}
|
||||
#endif
|
11
src/Debug/Systems/DebugMonitorPrefs.cs.meta
Normal file
11
src/Debug/Systems/DebugMonitorPrefs.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe2cd9539e4c704459b688f17ced2563
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,10 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
[DebugHide, DebugColor(DebugColor.Gray)]
|
||||
public class SystemsDebugSystem : IEcsPreInitSystem
|
||||
{
|
||||
private string _name;
|
||||
@ -28,7 +30,6 @@ namespace DCFApixels.DragonECS.Unity
|
||||
internal SystemsDebugSystem source;
|
||||
internal EcsSystems systems;
|
||||
internal string systemsName;
|
||||
internal bool showInterfaces = false;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
@ -55,7 +56,7 @@ namespace DCFApixels.DragonECS.Unity
|
||||
if (_headerStyle == null)
|
||||
{
|
||||
_headerStyle = new GUIStyle(EditorStyles.boldLabel);
|
||||
_interfacesStyle = new GUIStyle(EditorStyles.helpBox);
|
||||
_interfacesStyle = new GUIStyle(EditorStyles.miniLabel);
|
||||
_interfacesStyle.hover.textColor = _interfaceColor;
|
||||
_interfacesStyle.focused.textColor = _interfaceColor;
|
||||
_interfacesStyle.active.textColor = _interfaceColor;
|
||||
@ -65,7 +66,8 @@ namespace DCFApixels.DragonECS.Unity
|
||||
|
||||
GUILayout.Label("[Systems]", _headerStyle);
|
||||
|
||||
Target.showInterfaces = EditorGUILayout.Toggle("Show Interfaces", Target.showInterfaces);
|
||||
DebugMonitorPrefs.instance.isShowInterfaces = EditorGUILayout.Toggle("Show Interfaces", DebugMonitorPrefs.instance.isShowInterfaces);
|
||||
DebugMonitorPrefs.instance.isShowHidden = EditorGUILayout.Toggle("Show Hidden", DebugMonitorPrefs.instance.isShowHidden);
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
foreach (var item in Target.systems.AllSystems)
|
||||
@ -74,12 +76,15 @@ namespace DCFApixels.DragonECS.Unity
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
|
||||
GUILayout.Label("[Runners]", _headerStyle);
|
||||
|
||||
GUILayout.BeginVertical(EcsEditor.GetStyle(Color.black));
|
||||
foreach (var item in Target.systems.AllRunners)
|
||||
{
|
||||
DrawRunner(item.Value);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void DrawSystem(IEcsSystem system)
|
||||
@ -98,13 +103,17 @@ namespace DCFApixels.DragonECS.Unity
|
||||
}
|
||||
|
||||
Type type = system.GetType();
|
||||
|
||||
if (CheckIsHidden(type))
|
||||
return;
|
||||
|
||||
string name = type.Name;
|
||||
Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
|
||||
//Color defaultBackgroundColor = GUI.backgroundColor;
|
||||
//GUI.backgroundColor = color;
|
||||
GUILayout.BeginVertical(EcsEditor.GetStyle(color));
|
||||
if (Target.showInterfaces)
|
||||
if (DebugMonitorPrefs.instance.isShowInterfaces)
|
||||
{
|
||||
GUILayout.Label(string.Join(", ", type.GetInterfaces().Select(o => o.Name)), _interfacesStyle);
|
||||
}
|
||||
@ -116,6 +125,9 @@ namespace DCFApixels.DragonECS.Unity
|
||||
private void DrawRunner(IEcsRunner runner)
|
||||
{
|
||||
Type type = runner.GetType();
|
||||
if (CheckIsHidden(type))
|
||||
return;
|
||||
|
||||
Color color = (GetAttribute<DebugColorAttribute>(type) ?? _fakeDebugColorAttribute).GetUnityColor();
|
||||
//Color defaultBackgroundColor = GUI.backgroundColor;
|
||||
//GUI.backgroundColor = color;
|
||||
@ -134,6 +146,14 @@ namespace DCFApixels.DragonECS.Unity
|
||||
return (TAttribute)result[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool CheckIsHidden(Type target)
|
||||
{
|
||||
if (DebugMonitorPrefs.instance.isShowHidden)
|
||||
return false;
|
||||
|
||||
return target.GetCustomAttribute<DebugHideAttribute>() != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c0c879077450ac479afb5b86efc5a93
|
||||
guid: 1caa902906afea3409fc63ed94cbbc11
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
20
src/Debug/Systems/WorldDebugSystem.cs
Normal file
20
src/Debug/Systems/WorldDebugSystem.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
public class WorldDebugSystem : IEcsRunSystem
|
||||
{
|
||||
private IEcsWorld _ecsWorld;
|
||||
|
||||
public WorldDebugSystem(IEcsWorld ecsWorld)
|
||||
{
|
||||
_ecsWorld = ecsWorld;
|
||||
}
|
||||
|
||||
public void Run(EcsSystems systems)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45a14256c767cab49879fb8aa88ec193
|
||||
guid: d36835beef2392f40854af962ff47472
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -1,11 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
public class WorldDebugSystem : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user