2024-05-13 18:21:51 +08:00
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
using DCFApixels.DragonECS.Unity.Internal;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS.Unity.Editors
|
|
|
|
|
{
|
|
|
|
|
[CustomPropertyDrawer(typeof(entlong))]
|
2024-09-14 23:30:11 +08:00
|
|
|
|
internal class EntlongDrawer : ExtendedPropertyDrawer
|
2024-05-13 18:21:51 +08:00
|
|
|
|
{
|
2024-09-14 23:30:11 +08:00
|
|
|
|
protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
2024-05-13 18:21:51 +08:00
|
|
|
|
{
|
2024-09-14 23:30:11 +08:00
|
|
|
|
using (EcsGUI.Disable)
|
2024-05-13 18:21:51 +08:00
|
|
|
|
{
|
|
|
|
|
EntitySlotInfo slotInfo = new EntitySlotInfo(property.FindPropertyRelative("_full").longValue);
|
2024-09-14 23:30:11 +08:00
|
|
|
|
var (labelRect, barRect) = position.HorizontalSliceLeft(EditorGUIUtility.labelWidth * 0.65f);
|
2024-05-13 18:21:51 +08:00
|
|
|
|
|
|
|
|
|
EditorGUI.LabelField(labelRect, label);
|
2024-05-13 19:20:07 +08:00
|
|
|
|
bool isAlive = EcsWorld.GetWorld(slotInfo.world).IsAlive(slotInfo.id, slotInfo.gen);
|
|
|
|
|
EcsGUI.EntityBar(barRect, false, isAlive ? EcsGUI.EntityStatus.Alive : EcsGUI.EntityStatus.NotAlive, slotInfo.id, slotInfo.gen, slotInfo.world);
|
2024-05-13 18:21:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|