mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-17 17:34:34 +08:00
add EntityDrawer
This commit is contained in:
parent
2b216bedb1
commit
5dfe28e87d
26
src/Debug/Editor/EntlongDrawer.cs
Normal file
26
src/Debug/Editor/EntlongDrawer.cs
Normal file
@ -0,0 +1,26 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using static UnityEditor.EditorGUI;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(entlong))]
|
||||
internal class EntlongDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
//base.OnGUI(position, property, label);
|
||||
using (new DisabledScope(false))
|
||||
{
|
||||
EntitySlotInfo slotInfo = new EntitySlotInfo(property.FindPropertyRelative("_full").longValue);
|
||||
var (labelRect, barRect) = RectUtility.HorizontalSliceLeft(position, EditorGUIUtility.labelWidth * 0.65f);
|
||||
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
EcsGUI.EntityBar(barRect, EcsGUI.EntityStatus.Alive, slotInfo.id, slotInfo.gen, slotInfo.world);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
11
src/Debug/Editor/EntlongDrawer.cs.meta
Normal file
11
src/Debug/Editor/EntlongDrawer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 614e6caafa5d5724fbb3324ea3a60194
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user