LineArrowDrawer.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEditor;
  2. using UnityEngine;
  3. using XCharts.Runtime;
  4. namespace XCharts.Editor
  5. {
  6. [CustomPropertyDrawer(typeof(ArrowStyle), true)]
  7. public class ArrowDrawer : BasePropertyDrawer
  8. {
  9. public override string ClassName { get { return "Arrow"; } }
  10. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  11. {
  12. base.OnGUI(pos, prop, label);
  13. if (MakeComponentFoldout(prop, "", true))
  14. {
  15. ++EditorGUI.indentLevel;
  16. PropertyField(prop, "m_Width");
  17. PropertyField(prop, "m_Height");
  18. PropertyField(prop, "m_Offset");
  19. PropertyField(prop, "m_Dent");
  20. PropertyField(prop, "m_Color");
  21. --EditorGUI.indentLevel;
  22. }
  23. }
  24. }
  25. [CustomPropertyDrawer(typeof(LineArrow), true)]
  26. public class LineArrowStyleDrawer : BasePropertyDrawer
  27. {
  28. public override string ClassName { get { return "LineArrow"; } }
  29. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  30. {
  31. base.OnGUI(pos, prop, label);
  32. if (MakeComponentFoldout(prop, "m_Show", true))
  33. {
  34. ++EditorGUI.indentLevel;
  35. PropertyField(prop, "m_Position");
  36. PropertyField(prop, "m_Arrow");
  37. --EditorGUI.indentLevel;
  38. }
  39. }
  40. }
  41. }