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);
|
||||
|
||||
//GUIContent label = new GUIContent(name);
|
||||
GUIContent label = UnityEditorUtility.GetLabel(name);
|
||||
bool isEmpty = componentType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Length <= 0;
|
||||
float padding = EditorGUIUtility.standardVerticalSpacing;
|
||||
Color alphaPanelColor = panelColor;
|
||||
@ -172,6 +171,8 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(alphaPanelColor));
|
||||
|
||||
|
||||
|
||||
#region Draw Component Block
|
||||
bool isRemoveComponent = false;
|
||||
removeButtonRect.yMin = removeButtonRect.yMax;
|
||||
@ -186,12 +187,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
if (isEmpty)
|
||||
{
|
||||
GUIContent label = UnityEditorUtility.GetLabel(name);
|
||||
GUILayout.Label(label);
|
||||
EditorGUI.BeginProperty(GUILayoutUtility.GetLastRect(), label, componentRefProp);
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIContent label = UnityEditorUtility.GetLabel(name);
|
||||
EditorGUILayout.PropertyField(componentProperty, label, true);
|
||||
}
|
||||
if (isRemoveComponent)
|
||||
|
@ -110,6 +110,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
colorBoxeStyles = new SparseArray<GUIStyle>();
|
||||
}
|
||||
private static SparseArray<GUIStyle> colorBoxeStyles = new SparseArray<GUIStyle>();
|
||||
private static GUIContent _singletonIconContent = null;
|
||||
private static GUIContent _singletonContent = null;
|
||||
|
||||
|
||||
@ -135,14 +136,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
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;
|
||||
_singletonContent.image = image;
|
||||
_singletonContent.tooltip = tooltip;
|
||||
return _singletonContent;
|
||||
_singletonIconContent.text = string.Empty;
|
||||
_singletonIconContent.image = image;
|
||||
_singletonIconContent.tooltip = tooltip;
|
||||
return _singletonIconContent;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user