LevelStyleDrawer.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEditor;
  2. using UnityEngine;
  3. using XCharts.Runtime;
  4. namespace XCharts.Editor
  5. {
  6. [CustomPropertyDrawer(typeof(LevelStyle), true)]
  7. public class LevelStyleDrawer : BasePropertyDrawer
  8. {
  9. public override string ClassName { get { return "LevelStyle"; } }
  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. PropertyListField(prop, "m_Levels");
  17. --EditorGUI.indentLevel;
  18. }
  19. }
  20. }
  21. [CustomPropertyDrawer(typeof(Level), true)]
  22. public class LevelDrawer : BasePropertyDrawer
  23. {
  24. public override string ClassName { get { return "Level"; } }
  25. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  26. {
  27. base.OnGUI(pos, prop, label);
  28. if (MakeComponentFoldout(prop, "m_Depth", true))
  29. {
  30. ++EditorGUI.indentLevel;
  31. PropertyField(prop, "m_Depth");
  32. PropertyField(prop, "m_Label");
  33. PropertyField(prop, "m_UpperLabel");
  34. PropertyField(prop, "m_LineStyle");
  35. PropertyField(prop, "m_ItemStyle");
  36. --EditorGUI.indentLevel;
  37. }
  38. }
  39. }
  40. }