mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
fix name display
This commit is contained in:
parent
bbefc2214f
commit
50b817126e
@ -161,7 +161,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
Color panelColor = meta.Color.ToUnityColor().Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE);
|
Color panelColor = meta.Color.ToUnityColor().Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE);
|
||||||
|
|
||||||
//GUIContent label = new GUIContent(name);
|
//GUIContent label = new GUIContent(name);
|
||||||
GUIContent label = UnityEditorUtility.GetLabel(name);
|
|
||||||
bool isEmpty = componentType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Length <= 0;
|
bool isEmpty = componentType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Length <= 0;
|
||||||
float padding = EditorGUIUtility.standardVerticalSpacing;
|
float padding = EditorGUIUtility.standardVerticalSpacing;
|
||||||
Color alphaPanelColor = panelColor;
|
Color alphaPanelColor = panelColor;
|
||||||
@ -172,6 +171,8 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(alphaPanelColor));
|
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(alphaPanelColor));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Draw Component Block
|
#region Draw Component Block
|
||||||
bool isRemoveComponent = false;
|
bool isRemoveComponent = false;
|
||||||
removeButtonRect.yMin = removeButtonRect.yMax;
|
removeButtonRect.yMin = removeButtonRect.yMax;
|
||||||
@ -186,12 +187,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
if (isEmpty)
|
if (isEmpty)
|
||||||
{
|
{
|
||||||
|
GUIContent label = UnityEditorUtility.GetLabel(name);
|
||||||
GUILayout.Label(label);
|
GUILayout.Label(label);
|
||||||
EditorGUI.BeginProperty(GUILayoutUtility.GetLastRect(), label, componentRefProp);
|
EditorGUI.BeginProperty(GUILayoutUtility.GetLastRect(), label, componentRefProp);
|
||||||
EditorGUI.EndProperty();
|
EditorGUI.EndProperty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GUIContent label = UnityEditorUtility.GetLabel(name);
|
||||||
EditorGUILayout.PropertyField(componentProperty, label, true);
|
EditorGUILayout.PropertyField(componentProperty, label, true);
|
||||||
}
|
}
|
||||||
if (isRemoveComponent)
|
if (isRemoveComponent)
|
||||||
|
@ -110,6 +110,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
colorBoxeStyles = new SparseArray<GUIStyle>();
|
colorBoxeStyles = new SparseArray<GUIStyle>();
|
||||||
}
|
}
|
||||||
private static SparseArray<GUIStyle> colorBoxeStyles = new SparseArray<GUIStyle>();
|
private static SparseArray<GUIStyle> colorBoxeStyles = new SparseArray<GUIStyle>();
|
||||||
|
private static GUIContent _singletonIconContent = null;
|
||||||
private static GUIContent _singletonContent = null;
|
private static GUIContent _singletonContent = null;
|
||||||
|
|
||||||
|
|
||||||
@ -135,14 +136,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
public static GUIContent GetLabel(Texture image, string tooltip = null)
|
public static GUIContent GetLabel(Texture image, string tooltip = null)
|
||||||
{
|
{
|
||||||
if (_singletonContent == null)
|
if (_singletonIconContent == null)
|
||||||
{
|
{
|
||||||
_singletonContent = new GUIContent();
|
_singletonIconContent = new GUIContent();
|
||||||
}
|
}
|
||||||
_singletonContent.text = string.Empty;
|
_singletonIconContent.text = string.Empty;
|
||||||
_singletonContent.image = image;
|
_singletonIconContent.image = image;
|
||||||
_singletonContent.tooltip = tooltip;
|
_singletonIconContent.tooltip = tooltip;
|
||||||
return _singletonContent;
|
return _singletonIconContent;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user