2024-03-10 04:56:29 +08:00
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
using DCFApixels.DragonECS.Unity.Internal;
|
|
|
|
|
using UnityEditor;
|
2024-05-13 19:27:53 +08:00
|
|
|
|
using UnityEngine;
|
2024-03-10 04:56:29 +08:00
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS.Unity.Editors
|
|
|
|
|
{
|
|
|
|
|
[CustomEditor(typeof(EntityMonitor))]
|
2024-09-14 23:30:11 +08:00
|
|
|
|
internal class EntityMonitorEditor : ExtendedEditor<EntityMonitor>
|
2024-03-10 04:56:29 +08:00
|
|
|
|
{
|
2024-09-14 23:30:11 +08:00
|
|
|
|
protected override void DrawCustom()
|
2024-03-10 04:56:29 +08:00
|
|
|
|
{
|
2025-03-10 13:08:18 +08:00
|
|
|
|
var entity = Target.Entity;
|
|
|
|
|
bool isAlive = entity.TryUnpackForUnityEditor(out int id, out short gen, out short worldID, out EcsWorld world);
|
2024-09-14 23:30:11 +08:00
|
|
|
|
using (EcsGUI.SetEnable(isAlive))
|
2024-05-13 19:27:53 +08:00
|
|
|
|
{
|
2024-05-16 19:03:03 +08:00
|
|
|
|
if (GUILayout.Button("Delete Entity", GUILayout.Height(36f)))
|
2024-05-13 19:27:53 +08:00
|
|
|
|
{
|
|
|
|
|
world.DelEntity(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-16 09:36:51 +08:00
|
|
|
|
//EcsGUI.Layout.EntityBarForAlive(isAlive ? EcsGUI.EntityStatus.Alive : EcsGUI.EntityStatus.NotAlive, id, gen, worldID);
|
|
|
|
|
EcsGUI.Layout.EntityField(entity);
|
2025-03-10 13:08:18 +08:00
|
|
|
|
|
|
|
|
|
var drawers = UnityEditorUtility._entityEditorBlockDrawers;
|
|
|
|
|
if (drawers.Length > 0)
|
|
|
|
|
{
|
2025-03-10 17:56:18 +08:00
|
|
|
|
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
2025-03-10 13:08:18 +08:00
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-10 17:56:18 +08:00
|
|
|
|
|
2025-03-10 13:08:18 +08:00
|
|
|
|
}
|
2025-03-10 17:56:18 +08:00
|
|
|
|
|
2025-03-10 13:08:18 +08:00
|
|
|
|
EcsGUI.Layout.DrawRuntimeComponents(entity, false);
|
2024-03-10 04:56:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|