mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
Compare commits
2 Commits
8418c81e34
...
c08be8e883
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c08be8e883 | ||
![]() |
173ba244b1 |
@ -1,5 +1,6 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using DCFApixels.DragonECS.Unity.Internal;
|
using DCFApixels.DragonECS.Unity.Internal;
|
||||||
|
using System.Reflection;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -90,6 +91,17 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
ent = monitor.Entity;
|
ent = monitor.Entity;
|
||||||
isValide = true;
|
isValide = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var beh in go.GetComponents<MonoBehaviour>())
|
||||||
|
{
|
||||||
|
if(TryFindEntlong(beh, out ent))
|
||||||
|
{
|
||||||
|
isValide = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -103,8 +115,17 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
ent = monitor.Entity;
|
ent = monitor.Entity;
|
||||||
isValide = true;
|
isValide = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (TryFindEntlong(dragged, out ent))
|
||||||
|
{
|
||||||
|
isValide = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isValide)
|
if (isValide)
|
||||||
{
|
{
|
||||||
long entityLong = *(long*)&ent;
|
long entityLong = *(long*)&ent;
|
||||||
@ -124,6 +145,34 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
//Event.current.Use();
|
//Event.current.Use();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool TryFindEntlong(Object uniObj, out entlong ent)
|
||||||
|
{
|
||||||
|
var fields = uniObj.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||||
|
foreach (var field in fields)
|
||||||
|
{
|
||||||
|
if(field.FieldType == typeof(entlong))
|
||||||
|
{
|
||||||
|
ent = (entlong)field.GetValue(uniObj);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var iterator = new SerializedObject(uniObj).GetIterator();
|
||||||
|
iterator.NextVisible(true);
|
||||||
|
while (iterator.Next(true))
|
||||||
|
{
|
||||||
|
if (iterator.propertyType == SerializedPropertyType.Integer &&
|
||||||
|
iterator.propertyPath.Contains(nameof(entlong)))
|
||||||
|
{
|
||||||
|
var l = iterator.longValue;
|
||||||
|
ent = *(entlong*)&l;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ent = entlong.NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||||
{
|
{
|
||||||
const float UNITY_HEIGHT_CONSTANT = 18f;
|
const float UNITY_HEIGHT_CONSTANT = 18f;
|
||||||
|
@ -277,7 +277,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
public static LabelWidthScope SetLabelWidth(float value) => new LabelWidthScope(value);
|
public static LabelWidthScope SetLabelWidth(float value) => new LabelWidthScope(value);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private static readonly BindingFlags fieldFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
//private static readonly BindingFlags fieldFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||||
|
|
||||||
internal readonly static Color GrayColor = new Color32(100, 100, 100, 255);
|
internal readonly static Color GrayColor = new Color32(100, 100, 100, 255);
|
||||||
internal readonly static Color GreenColor = new Color32(75, 255, 0, 255);
|
internal readonly static Color GreenColor = new Color32(75, 255, 0, 255);
|
||||||
|
Loading…
Reference in New Issue
Block a user