Files
ZHGD_Web/SelfPackages/XCharts/Editor/ChildComponents/SymbolStyleDrawer.cs
2025-07-13 23:16:20 +08:00

36 lines
1.3 KiB
C#

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SymbolStyle), true)]
public class SymbolStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
PropertyField(prop, "m_Type");
if (type == SymbolType.Custom)
{
AddHelpBox("Custom Symbol only work in PictorialBar serie", MessageType.Warning);
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
}
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Size");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_Offset");
--EditorGUI.indentLevel;
}
}
}
}