暫無描述
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.

SymbolStyleDrawer.cs 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections.Generic;
  2. using UnityEditor;
  3. using UnityEngine;
  4. using XCharts.Runtime;
  5. namespace XCharts.Editor
  6. {
  7. [CustomPropertyDrawer(typeof(SymbolStyle), true)]
  8. public class SymbolStyleDrawer : BasePropertyDrawer
  9. {
  10. public override string ClassName { get { return "Symbol"; } }
  11. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  12. {
  13. base.OnGUI(pos, prop, label);
  14. if (MakeComponentFoldout(prop, "m_Show", true))
  15. {
  16. ++EditorGUI.indentLevel;
  17. var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex;
  18. PropertyField(prop, "m_Type");
  19. if (type == SymbolType.Custom)
  20. {
  21. PropertyField(prop, "m_Image");
  22. PropertyField(prop, "m_ImageType");
  23. PropertyField(prop, "m_Width");
  24. PropertyField(prop, "m_Height");
  25. }
  26. PropertyField(prop, "m_Color");
  27. PropertyField(prop, "m_Size");
  28. PropertyField(prop, "m_Gap");
  29. PropertyField(prop, "m_Offset");
  30. --EditorGUI.indentLevel;
  31. }
  32. }
  33. }
  34. }