Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LineDrawer.cs 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. }
  47. }
  48. [CustomPropertyDrawer(typeof(AxisMinorSplitLine), true)]
  49. public class AxisMinorSplitLineDrawer : BaseLineDrawer
  50. {
  51. public override string ClassName { get { return "MinorSplitLine"; } }
  52. protected override void DrawExtendeds(SerializedProperty prop)
  53. {
  54. base.DrawExtendeds(prop);
  55. //PropertyField(prop, "m_Distance");
  56. //PropertyField(prop, "m_AutoColor");
  57. }
  58. }
  59. [CustomPropertyDrawer(typeof(AxisTick), true)]
  60. public class AxisTickDrawer : BaseLineDrawer
  61. {
  62. public override string ClassName { get { return "AxisTick"; } }
  63. protected override void DrawExtendeds(SerializedProperty prop)
  64. {
  65. base.DrawExtendeds(prop);
  66. PropertyField(prop, "m_AlignWithLabel");
  67. PropertyField(prop, "m_Inside");
  68. PropertyField(prop, "m_ShowStartTick");
  69. PropertyField(prop, "m_ShowEndTick");
  70. PropertyField(prop, "m_SplitNumber");
  71. PropertyField(prop, "m_Distance");
  72. PropertyField(prop, "m_AutoColor");
  73. }
  74. }
  75. [CustomPropertyDrawer(typeof(AxisMinorTick), true)]
  76. public class AxisMinorTickDrawer : BaseLineDrawer
  77. {
  78. public override string ClassName { get { return "MinorTick"; } }
  79. protected override void DrawExtendeds(SerializedProperty prop)
  80. {
  81. base.DrawExtendeds(prop);
  82. PropertyField(prop, "m_SplitNumber");
  83. //PropertyField(prop, "m_AutoColor");
  84. }
  85. }
  86. }