mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
Update RuntimeComponentsDrawer.cs
This commit is contained in:
parent
6d0a572c80
commit
64bc896457
@ -16,7 +16,8 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
using static RuntimeComponentsDrawer.RuntimeComponentReflectionCache;
|
||||
internal class RuntimeComponentsDrawer
|
||||
{
|
||||
private static readonly BindingFlags fieldFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||
private const BindingFlags INSTANCE_FIELD_FLAGS = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void ResetRuntimeComponentReflectionCache()
|
||||
{
|
||||
@ -160,7 +161,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
|
||||
if (Drawer == DrawerType.UnityNotSerializableComposite)
|
||||
{
|
||||
var fieldInfos = type.GetFields(fieldFlags);
|
||||
var fieldInfos = type.GetFields(INSTANCE_FIELD_FLAGS);
|
||||
Fields = new FieldInfoData[fieldInfos.Length];
|
||||
for (int i = 0; i < fieldInfos.Length; i++)
|
||||
{
|
||||
@ -451,22 +452,22 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
#region draw data
|
||||
private bool DrawRuntimeData(ref RuntimeComponentReflectionCache.FieldInfoData fieldInfoData, GUIContent label, ExpandMatrix expandMatrix, object data, out object outData, int depth)
|
||||
{
|
||||
const int DEPTH_MAX = 16;
|
||||
const int DEPTH_MAX = 24;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
using (EcsGUI.CheckChanged())
|
||||
{
|
||||
|
||||
outData = data;
|
||||
object newData = data;
|
||||
Type type = data == null ? typeof(void) : data.GetType();
|
||||
|
||||
RuntimeComponentReflectionCache cache = fieldInfoData.GetReflectionCache(type);
|
||||
|
||||
bool isUnityObjectField = fieldInfoData.IsUnityObjectField;
|
||||
if (isUnityObjectField == false && data == null)
|
||||
{
|
||||
EditorGUILayout.TextField(label, "Null");
|
||||
return false;
|
||||
}
|
||||
|
||||
RuntimeComponentReflectionCache cache = fieldInfoData.GetReflectionCache(type);
|
||||
if (depth >= DEPTH_MAX || cache == null)
|
||||
{
|
||||
EditorGUILayout.TextField(label, "error");
|
||||
@ -710,13 +711,14 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
expandMatrix.Up();
|
||||
if (childElementChanged || EditorGUI.EndChangeCheck())
|
||||
if (childElementChanged || EcsGUI.Changed)
|
||||
{
|
||||
outData = newData;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user