增加LabelStyleshowCondition,showFilter,showThreshold可控制label显示和隐藏

This commit is contained in:
monitor1394
2026-05-23 17:07:00 +08:00
parent f7ccec87d9
commit 4ad2b3268f
6 changed files with 185 additions and 7 deletions

View File

@@ -113,6 +113,15 @@ namespace XCharts.Editor
}
}
protected void PropertyFlagsField(SerializedProperty prop, string relativePropName, System.Type enumType)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFlagsField(ref m_DrawRect, m_Heights, m_KeyName, prop, relativePropName, enumType))
{
Debug.LogError("PropertyFlagsField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMin(SerializedProperty prop, string relativePropName, float minValue)
{
if (IngorePropertys.Contains(relativePropName)) return;

View File

@@ -26,7 +26,10 @@ namespace XCharts.Editor
PropertyField(prop, "m_Height");
PropertyField(prop, "m_FixedX");
PropertyField(prop, "m_FixedY");
PropertyField(prop, "m_MinGap");
PropertyField(prop, "m_ShowCondition");
PropertyField(prop, "m_ShowFilter");
PropertyField(prop, "m_ShowThreshold");
PropertyField(prop, "m_ShowMinGap");
PropertyField(prop, "m_Icon");
PropertyField(prop, "m_Background");
PropertyField(prop, "m_TextStyle");

View File

@@ -507,6 +507,28 @@ namespace XCharts.Editor
{
return PropertyField(ref drawRect, heights, key, parentProp.FindPropertyRelative(relativeName));
}
public static bool PropertyFlagsField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName, System.Type enumType)
{
return PropertyFlagsField(ref drawRect, heights, key, parentProp.FindPropertyRelative(relativeName), enumType);
}
public static bool PropertyFlagsField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop, System.Type enumType)
{
if (prop == null) return false;
var label = GetContent(prop.displayName);
var enumValue = (System.Enum)System.Enum.ToObject(enumType, prop.intValue);
EditorGUI.BeginChangeCheck();
var newValue = EditorGUI.EnumFlagsField(drawRect, label, enumValue);
if (EditorGUI.EndChangeCheck())
prop.intValue = (int)(object)newValue;
var hig = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyFieldWithMinValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName, float minValue)
{