LineDrawer.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using UnityEditor;
  2. using UnityEngine;
  3. using XCharts.Runtime;
  4. namespace XCharts.Editor
  5. {
  6. [CustomPropertyDrawer(typeof(BaseLine), true)]
  7. public class BaseLineDrawer : BasePropertyDrawer
  8. {
  9. public override string ClassName { get { return "Line"; } }
  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. DrawExtendeds(prop);
  17. PropertyField(prop, "m_LineStyle");
  18. --EditorGUI.indentLevel;
  19. }
  20. }
  21. }
  22. [CustomPropertyDrawer(typeof(AxisLine), true)]
  23. public class AxisLineDrawer : BaseLineDrawer
  24. {
  25. public override string ClassName { get { return "AxisLine"; } }
  26. protected override void DrawExtendeds(SerializedProperty prop)
  27. {
  28. base.DrawExtendeds(prop);
  29. PropertyField(prop, "m_OnZero");
  30. PropertyField(prop, "m_ShowArrow");
  31. PropertyField(prop, "m_Arrow");
  32. }
  33. }
  34. [CustomPropertyDrawer(typeof(AxisSplitLine), true)]
  35. public class AxisSplitLineDrawer : BaseLineDrawer
  36. {
  37. public override string ClassName { get { return "SplitLine"; } }
  38. protected override void DrawExtendeds(SerializedProperty prop)
  39. {
  40. base.DrawExtendeds(prop);
  41. PropertyField(prop, "m_Interval");
  42. PropertyField(prop, "m_Distance");
  43. PropertyField(prop, "m_AutoColor");
  44. PropertyField(prop, "m_ShowStartLine");
  45. PropertyField(prop, "m_ShowEndLine");
  46. PropertyField(prop, "m_ShowZLine");
  47. }
  48. }
  49. [CustomPropertyDrawer(typeof(AxisMinorSplitLine), true)]
  50. public class AxisMinorSplitLineDrawer : BaseLineDrawer
  51. {
  52. public override string ClassName { get { return "MinorSplitLine"; } }
  53. protected override void DrawExtendeds(SerializedProperty prop)
  54. {
  55. base.DrawExtendeds(prop);
  56. //PropertyField(prop, "m_Distance");
  57. //PropertyField(prop, "m_AutoColor");
  58. }
  59. }
  60. [CustomPropertyDrawer(typeof(AxisTick), true)]
  61. public class AxisTickDrawer : BaseLineDrawer
  62. {
  63. public override string ClassName { get { return "AxisTick"; } }
  64. protected override void DrawExtendeds(SerializedProperty prop)
  65. {
  66. base.DrawExtendeds(prop);
  67. PropertyField(prop, "m_AlignWithLabel");
  68. PropertyField(prop, "m_Inside");
  69. PropertyField(prop, "m_ShowStartTick");
  70. PropertyField(prop, "m_ShowEndTick");
  71. PropertyField(prop, "m_SplitNumber");
  72. PropertyField(prop, "m_Distance");
  73. PropertyField(prop, "m_AutoColor");
  74. }
  75. }
  76. [CustomPropertyDrawer(typeof(AxisMinorTick), true)]
  77. public class AxisMinorTickDrawer : BaseLineDrawer
  78. {
  79. public override string ClassName { get { return "MinorTick"; } }
  80. protected override void DrawExtendeds(SerializedProperty prop)
  81. {
  82. base.DrawExtendeds(prop);
  83. PropertyField(prop, "m_SplitNumber");
  84. //PropertyField(prop, "m_AutoColor");
  85. }
  86. }
  87. }