mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
update
This commit is contained in:
parent
2dd92d3dc6
commit
24ac089d1e
@ -188,18 +188,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
if (propCount <= 0)
|
if (propCount <= 0)
|
||||||
{
|
{
|
||||||
label.text = $"{label.text} ({name})";
|
label.text = $"{label.text} ({name})";
|
||||||
EditorGUI.LabelField(paddingPosition, label);
|
EcsGUI.DrawEmptyComponentProperty(paddingPosition, componentRefProp, label.text, isEmpty);
|
||||||
Rect emptyPos = paddingPosition;
|
|
||||||
emptyPos.xMin += EditorGUIUtility.labelWidth;
|
|
||||||
if (isEmpty)
|
|
||||||
{
|
|
||||||
using (new EcsGUI.ContentColorScope(1f, 1f, 1f, 0.4f))
|
|
||||||
{
|
|
||||||
GUI.Label(emptyPos, "empty");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EditorGUI.BeginProperty(paddingPosition, label, componentRefProp);
|
|
||||||
EditorGUI.EndProperty();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -194,19 +194,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
if (propCount <= 0)
|
if (propCount <= 0)
|
||||||
{
|
{
|
||||||
GUIContent label = UnityEditorUtility.GetLabel(name);
|
EcsGUI.Layout.DrawEmptyComponentProperty(componentRefProp, name, isEmpty);
|
||||||
EditorGUILayout.LabelField(name);
|
|
||||||
Rect emptyPos = GUILayoutUtility.GetLastRect();
|
|
||||||
emptyPos.xMin += EditorGUIUtility.labelWidth;
|
|
||||||
if (isEmpty)
|
|
||||||
{
|
|
||||||
using (new EcsGUI.ContentColorScope(1f, 1f, 1f, 0.4f))
|
|
||||||
{
|
|
||||||
GUI.Label(emptyPos, "empty");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EditorGUI.BeginProperty(GUILayoutUtility.GetLastRect(), label, componentRefProp);
|
|
||||||
EditorGUI.EndProperty();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -335,11 +335,33 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
return AddClearComponentButton.None;
|
return AddClearComponentButton.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DrawEmptyComponentProperty(Rect position, SerializedProperty property, string name, bool isDisplayEmpty)
|
||||||
|
{
|
||||||
|
DrawEmptyComponentProperty(position, property, UnityEditorUtility.GetLabel(name), isDisplayEmpty);
|
||||||
|
}
|
||||||
|
public static void DrawEmptyComponentProperty(Rect position, SerializedProperty property, GUIContent label, bool isDisplayEmpty)
|
||||||
|
{
|
||||||
|
EditorGUI.LabelField(position, label);
|
||||||
|
if (isDisplayEmpty)
|
||||||
|
{
|
||||||
|
using (SetContentColor(1f, 1f, 1f, 0.4f))
|
||||||
|
{
|
||||||
|
GUI.Label(position.AddPadding(EditorGUIUtility.labelWidth, 0, 0, 0), "empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EditorGUI.BeginProperty(position, label, property);
|
||||||
|
EditorGUI.EndProperty();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Layout
|
public static class Layout
|
||||||
{
|
{
|
||||||
public static void DrawEmptyComponentProperty(bool isDisplayEmpty)
|
public static void DrawEmptyComponentProperty(SerializedProperty property, string name, bool isDisplayEmpty)
|
||||||
{
|
{
|
||||||
|
EcsGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabel(name), EditorStyles.label), property, name, isDisplayEmpty);
|
||||||
|
}
|
||||||
|
public static void DrawEmptyComponentProperty(SerializedProperty property, GUIContent label, bool isDisplayEmpty)
|
||||||
|
{
|
||||||
|
EcsGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(label, EditorStyles.label), property, label, isDisplayEmpty);
|
||||||
}
|
}
|
||||||
public static void DrawWorldBaseInfo(EcsWorld world)
|
public static void DrawWorldBaseInfo(EcsWorld world)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user