LabelStyleDrawer.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnityEditor;
  2. using UnityEngine;
  3. using XCharts.Runtime;
  4. namespace XCharts.Editor
  5. {
  6. [CustomPropertyDrawer(typeof(LabelStyle), true)]
  7. public class LabelStyleDrawer : BasePropertyDrawer
  8. {
  9. public override string ClassName { get { return "Label"; } }
  10. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  11. {
  12. base.OnGUI(pos, prop, label);
  13. if (MakeComponentFoldout(prop, "m_Show", true))
  14. {
  15. ++EditorGUI.indentLevel;
  16. PropertyField(prop, "m_Position");
  17. PropertyField(prop, "m_Formatter");
  18. PropertyField(prop, "m_NumericFormatter");
  19. PropertyField(prop, "m_AutoOffset");
  20. PropertyField(prop, "m_Offset");
  21. PropertyField(prop, "m_Distance");
  22. PropertyField(prop, "m_AutoRotate");
  23. PropertyField(prop, "m_Rotate");
  24. PropertyField(prop, "m_Width");
  25. PropertyField(prop, "m_Height");
  26. PropertyField(prop, "m_Icon");
  27. PropertyField(prop, "m_Background");
  28. PropertyField(prop, "m_TextStyle");
  29. PropertyField(prop, "m_TextPadding");
  30. --EditorGUI.indentLevel;
  31. }
  32. }
  33. }
  34. [CustomPropertyDrawer(typeof(EndLabelStyle), true)]
  35. public class EndLabelStyleDrawer : LabelStyleDrawer
  36. {
  37. public override string ClassName { get { return "End Label"; } }
  38. }
  39. }