mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
add but not implement SystemDebugMonitor
This commit is contained in:
parent
6f3011270a
commit
23478b5734
@ -1,4 +1,5 @@
|
||||
using DCFApixels.DragonECS.Unity.Debug;
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using DCFApixels.DragonECS.Unity.Debug;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
@ -16,14 +17,21 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
void IEcsPreInitSystem.PreInit(EcsPipeline pipeline)
|
||||
{
|
||||
SystemsDebugMonitor monitor = new GameObject(EcsConsts.DEBUG_PREFIX + _monitorName).AddComponent<SystemsDebugMonitor>();
|
||||
PipelineDebugMonitor monitor = new GameObject(EcsConsts.DEBUG_PREFIX + _monitorName).AddComponent<PipelineDebugMonitor>();
|
||||
monitor.source = this;
|
||||
monitor.pipeline = pipeline;
|
||||
monitor.monitorName = _monitorName;
|
||||
|
||||
//foreach (var item in pipeline.AllSystems) //Вырезано пока не сделаю TODO в SystemDebugMonitor
|
||||
//{
|
||||
// DebugNameAttribute debugName = item.GetType().GetCustomAttribute<DebugNameAttribute>();
|
||||
// string name = debugName == null ? item.GetType().Name : debugName.name;
|
||||
// SystemDebugMonitor.CreateMonitor(monitor.transform, item, name);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public class SystemsDebugMonitor : DebugMonitorBase
|
||||
public class PipelineDebugMonitor : DebugMonitorBase
|
||||
{
|
||||
internal PipelineDebugSystem source;
|
||||
internal EcsPipeline pipeline;
|
||||
@ -36,7 +44,7 @@ namespace DCFApixels.DragonECS
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(SystemsDebugMonitor))]
|
||||
[CustomEditor(typeof(PipelineDebugMonitor))]
|
||||
public class PipelineDebugMonitorEditor : Editor
|
||||
{
|
||||
private DebugColorAttribute _fakeDebugColorAttribute = new DebugColorAttribute(DebugColor.White);
|
||||
@ -44,7 +52,7 @@ namespace DCFApixels.DragonECS
|
||||
private GUIStyle _headerStyle;
|
||||
private GUIStyle _interfacesStyle;
|
||||
private Color _interfaceColor = new Color(0.96f, 1f, 0.16f);
|
||||
private SystemsDebugMonitor Target => (SystemsDebugMonitor)target;
|
||||
private PipelineDebugMonitor Target => (PipelineDebugMonitor)target;
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (Target.source == null)
|
||||
|
29
src/Debug/Systems/SystemDebugMonitor.cs
Normal file
29
src/Debug/Systems/SystemDebugMonitor.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using DCFApixels.DragonECS.Unity.Debug;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
public class SystemDebugMonitor :MonoBehaviour
|
||||
{
|
||||
[SerializeReference]
|
||||
private IEcsSystem _target; //TODO переделать подручнуюотрисовку, потому как [SerializeReference] не работает с generic-ами
|
||||
|
||||
public static SystemDebugMonitor CreateMonitor(Transform parent, IEcsSystem system, string name)
|
||||
{
|
||||
GameObject go = new GameObject(name);
|
||||
go.transform.parent = parent;
|
||||
go.transform.position = Vector3.zero;
|
||||
go.transform.rotation = Quaternion.identity;
|
||||
|
||||
go.SetActive(false);
|
||||
|
||||
SystemDebugMonitor result = go.AddComponent<SystemDebugMonitor>();
|
||||
|
||||
result._target = system;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
11
src/Debug/Systems/SystemDebugMonitor.cs.meta
Normal file
11
src/Debug/Systems/SystemDebugMonitor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf4cdc68b5b89a14c81a53b600078536
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user