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

TextStyleDrawer.cs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnityEditor;
  2. using UnityEngine;
  3. #if dUI_TextMeshPro
  4. using TMPro;
  5. #endif
  6. using XCharts.Runtime;
  7. namespace XCharts.Editor
  8. {
  9. [CustomPropertyDrawer(typeof(TextStyle), true)]
  10. public class TextStyleDrawer : BasePropertyDrawer
  11. {
  12. public override string ClassName { get { return "TextStyle"; } }
  13. public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
  14. {
  15. base.OnGUI(pos, prop, label);
  16. if (MakeComponentFoldout(prop, "m_Show", true))
  17. {
  18. ++EditorGUI.indentLevel;
  19. #if dUI_TextMeshPro
  20. PropertyField(prop, "m_TMPFont");
  21. #else
  22. PropertyField(prop, "m_Font");
  23. #endif
  24. PropertyField(prop, "m_Rotate");
  25. PropertyField(prop, "m_AutoColor");
  26. PropertyField(prop, "m_Color");
  27. PropertyField(prop, "m_FontSize");
  28. PropertyField(prop, "m_LineSpacing");
  29. #if dUI_TextMeshPro
  30. PropertyField(prop, "m_TMPFontStyle");
  31. PropertyField(prop, "m_TMPSpriteAsset");
  32. PropertyField(prop, "m_TMPAlignment");
  33. #else
  34. PropertyField(prop, "m_FontStyle");
  35. PropertyField(prop, "m_Alignment");
  36. PropertyField(prop, "m_AutoAlign");
  37. PropertyField(prop, "m_AutoWrap");
  38. #endif
  39. --EditorGUI.indentLevel;
  40. }
  41. }
  42. }
  43. }