mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2026-04-21 20:15:56 +08:00
update namespaces
This commit is contained in:
parent
8f7b8e0c2f
commit
5230bcdc1d
@ -746,6 +746,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
if (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.CloseButtonClicked))
|
if (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.CloseButtonClicked))
|
||||||
{
|
{
|
||||||
rootProperty.ResetValues();
|
rootProperty.ResetValues();
|
||||||
|
rootProperty.DeleteCommand();
|
||||||
}
|
}
|
||||||
return (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.DropExpanded), result.optionsWidth);
|
return (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.DropExpanded), result.optionsWidth);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUG
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Unity;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using DCFApixels.DragonECS.Unity.Internal;
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS.Unity
|
||||||
{
|
{
|
||||||
public sealed class ReferenceDropDownAttribute : PropertyAttribute
|
public sealed class ReferenceDropDownAttribute : PropertyAttribute
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
#region Init
|
#region Init
|
||||||
protected override void OnStaticInit()
|
protected override void OnStaticInit()
|
||||||
{
|
{
|
||||||
if(_unrecursiveLabel == null)
|
if (_unrecursiveLabel == null)
|
||||||
{
|
{
|
||||||
_unrecursiveLabel = new GUIContent();
|
_unrecursiveLabel = new GUIContent();
|
||||||
}
|
}
|
||||||
@ -153,13 +153,22 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private bool CheckSkip()
|
||||||
|
{
|
||||||
|
if(ReferenceDropDownAttribute == null || TypeMetaBlockAttribute == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(attribute is DragonMetaBlockAttribute)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(_unrecursiveLabel, label)) { return EditorGUI.GetPropertyHeight(property, label); }
|
if (CheckSkip()) { return EditorGUI.GetPropertyHeight(property, label); }
|
||||||
_unrecursiveLabel.text = label.text;
|
|
||||||
_unrecursiveLabel.tooltip = label.tooltip;
|
|
||||||
label = _unrecursiveLabel;
|
|
||||||
//if (CheckSkip()) { return EditorGUI.GetPropertyHeight(property, label); }
|
|
||||||
bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
||||||
|
|
||||||
SerializedProperty componentProp = property;
|
SerializedProperty componentProp = property;
|
||||||
@ -178,7 +187,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(DragonFieldCahce.RuntimeDict.TryGetValue(instance.GetType(), out var info) && info.HasWrappedFieldName)
|
if (DragonFieldCahce.RuntimeDict.TryGetValue(instance.GetType(), out var info) && info.HasWrappedFieldName)
|
||||||
{
|
{
|
||||||
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
||||||
}
|
}
|
||||||
@ -204,6 +213,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
{
|
{
|
||||||
componentProp = property;
|
componentProp = property;
|
||||||
}
|
}
|
||||||
|
if (componentProp != property && property.isExpanded == false)
|
||||||
|
{
|
||||||
|
property.isExpanded = true;
|
||||||
|
property.serializedObject.ApplyModifiedProperties();
|
||||||
|
DragonGUI.Changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
float result = EditorGUIUtility.singleLineHeight;
|
float result = EditorGUIUtility.singleLineHeight;
|
||||||
@ -221,11 +236,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
protected override void DrawCustom(Rect rect, SerializedProperty property, GUIContent label)
|
protected override void DrawCustom(Rect rect, SerializedProperty property, GUIContent label)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(_unrecursiveLabel, label)) { EditorGUI.PropertyField(rect, property, label, true); return; }
|
if (CheckSkip()) { EditorGUI.PropertyField(rect, property, label, true); return; }
|
||||||
_unrecursiveLabel.text = label.text;
|
|
||||||
_unrecursiveLabel.tooltip = label.tooltip;
|
|
||||||
label = _unrecursiveLabel;
|
|
||||||
//if (CheckSkip()) { EditorGUI.PropertyField(rect, property, label, true); return; }
|
|
||||||
bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
||||||
|
|
||||||
var e = Event.current;
|
var e = Event.current;
|
||||||
@ -240,21 +251,24 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
if (isSerializeReference)
|
if (isSerializeReference)
|
||||||
{
|
{
|
||||||
var instance = property.managedReferenceValue;
|
var instance = property.managedReferenceValue;
|
||||||
if (DragonFieldCahce.TryGetInfoFor(instance.GetType(), out var info) && info.HasWrappedFieldName)
|
DragonFieldCahce info = null;
|
||||||
|
if (instance == null)
|
||||||
{
|
{
|
||||||
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
isDrawProperty = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DragonFieldCahce.TryGetInfoFor(instance.GetType(), out info) && info.HasWrappedFieldName)
|
||||||
|
{
|
||||||
|
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (componentProp == null)
|
if (componentProp == null)
|
||||||
{
|
{
|
||||||
DrawDamagedComponent(rect, "Damaged component template.");
|
DrawDamagedComponent(rect, "Damaged component template.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
isDrawProperty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//meta = template as ITypeMeta;
|
|
||||||
if (meta == null)
|
if (meta == null)
|
||||||
{
|
{
|
||||||
if (info != null)
|
if (info != null)
|
||||||
@ -267,8 +281,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EcsDebug.PrintJson(meta);
|
|
||||||
|
|
||||||
if (isDrawDropDown && instance != null && ReferenceDropDownAttribute.IsHideButtonIfNotNull)
|
if (isDrawDropDown && instance != null && ReferenceDropDownAttribute.IsHideButtonIfNotNull)
|
||||||
{
|
{
|
||||||
isDrawDropDown = false;
|
isDrawDropDown = false;
|
||||||
@ -319,7 +331,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
var fieldRect = rect;
|
var fieldRect = rect;
|
||||||
|
|
||||||
if (property != componentProp &&
|
if (ReferenceEquals(property, componentProp) &&
|
||||||
componentProp.propertyType != SerializedPropertyType.Generic &&
|
componentProp.propertyType != SerializedPropertyType.Generic &&
|
||||||
componentProp.propertyType != SerializedPropertyType.ManagedReference)
|
componentProp.propertyType != SerializedPropertyType.ManagedReference)
|
||||||
{
|
{
|
||||||
@ -331,6 +343,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
if (_hasSerializableData)
|
if (_hasSerializableData)
|
||||||
{
|
{
|
||||||
|
if (componentProp != property && property.isExpanded == false)
|
||||||
|
{
|
||||||
|
property.isExpanded = true;
|
||||||
|
property.serializedObject.ApplyModifiedProperties();
|
||||||
|
DragonGUI.Changed = true;
|
||||||
|
}
|
||||||
EditorGUI.PropertyField(fieldRect, componentProp, label, true);
|
EditorGUI.PropertyField(fieldRect, componentProp, label, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -339,9 +357,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
|
|
||||||
var labelRect = rect;
|
var labelRect = rect;
|
||||||
labelRect.width = EditorGUIUtility.labelWidth;
|
labelRect.height = EditorGUIUtility.singleLineHeight;
|
||||||
labelRect.xMin -= 20f;
|
labelRect.xMin += EditorGUIUtility.labelWidth;
|
||||||
if (e.type == EventType.Used && DragonGUI.HitTest(labelRect, e) == false)
|
//EditorGUI.DrawRect(labelRect, Color.black);
|
||||||
|
if (e.type == EventType.Used && DragonGUI.HitTest(labelRect, e))
|
||||||
{
|
{
|
||||||
e.type = et;
|
e.type = et;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS.Unity
|
||||||
{
|
{
|
||||||
public static class MetaColorExstensions
|
public static class MetaColorExtensions
|
||||||
{
|
{
|
||||||
public static Color ToUnityColor<T>(this T self) where T : IMetaColor
|
public static Color ToUnityColor<T>(this T self) where T : IMetaColor
|
||||||
{
|
{
|
||||||
Loading…
Reference in New Issue
Block a user