mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-17 17:34:34 +08:00
55 lines
1.9 KiB
C#
55 lines
1.9 KiB
C#
#if UNITY_EDITOR
|
|
using DCFApixels.DragonECS.Unity.Internal;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace DCFApixels.DragonECS.Unity.Editors
|
|
{
|
|
[CustomEditor(typeof(EntityMonitor))]
|
|
internal class EntityMonitorEditor : ExtendedEditor<EntityMonitor>
|
|
{
|
|
protected override void DrawCustom()
|
|
{
|
|
var entity = Target.Entity;
|
|
bool isAlive = entity.TryUnpackForUnityEditor(out int id, out short gen, out short worldID, out EcsWorld world);
|
|
using (EcsGUI.SetEnable(isAlive))
|
|
{
|
|
if (GUILayout.Button("Delete Entity", GUILayout.Height(36f)))
|
|
{
|
|
world.DelEntity(id);
|
|
}
|
|
}
|
|
//EcsGUI.Layout.EntityBarForAlive(isAlive ? EcsGUI.EntityStatus.Alive : EcsGUI.EntityStatus.NotAlive, id, gen, worldID);
|
|
EcsGUI.Layout.EntityField(entity);
|
|
|
|
var drawers = UnityEditorUtility._entityEditorBlockDrawers;
|
|
if (drawers.Length > 0)
|
|
{
|
|
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
|
{
|
|
bool isExpand = false;
|
|
using (EcsGUI.CheckChanged())
|
|
{
|
|
isExpand = EditorGUILayout.Foldout(UserSettingsPrefs.instance.IsShowEntityOtherData, "Other data");
|
|
if (EcsGUI.Changed)
|
|
{
|
|
UserSettingsPrefs.instance.IsShowEntityOtherData = isExpand;
|
|
}
|
|
}
|
|
|
|
if (isExpand)
|
|
{
|
|
foreach (var drawer in drawers)
|
|
{
|
|
drawer.Draw(entity);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
EcsGUI.Layout.DrawRuntimeComponents(entity, false);
|
|
}
|
|
}
|
|
}
|
|
#endif |