SymbolStyleDrawer.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections.Generic;
  2. using UnityEditor;
  3. using UnityEngine;
  4. using XCharts.Runtime;
  5. namespace XCharts.Editor
  6. {
  7. [CustomPropertyDrawer(typeof(SymbolStyle), true)]
  8. public class SymbolStyleDrawer : BasePropertyDrawer
  9. {
  10. public override string ClassName { get { return "Symbol"; } }
  11. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  12. {
  13. base.OnGUI(pos, prop, label);
  14. if (MakeComponentFoldout(prop, "m_Show", true))
  15. {
  16. ++EditorGUI.indentLevel;
  17. var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
  18. PropertyField(prop, "m_Type");
  19. if (type == SymbolType.Custom)
  20. {
  21. AddHelpBox("Custom Symbol only work in PictorialBar serie", MessageType.Warning);
  22. PropertyField(prop, "m_Image");
  23. PropertyField(prop, "m_ImageType");
  24. PropertyField(prop, "m_Width");
  25. PropertyField(prop, "m_Height");
  26. }
  27. PropertyField(prop, "m_Color");
  28. PropertyField(prop, "m_Size");
  29. PropertyField(prop, "m_Gap");
  30. PropertyField(prop, "m_Offset");
  31. --EditorGUI.indentLevel;
  32. }
  33. }
  34. }
  35. }