Ei kuvausta
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.

CommentItem.cs 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. /// <summary>
  6. /// comment of chart.
  7. /// |注解项。
  8. /// </summary>
  9. [Serializable]
  10. public class CommentItem : ChildComponent
  11. {
  12. [SerializeField] private bool m_Show = true;
  13. [SerializeField] private string m_Content = "comment";
  14. [SerializeField] private Rect m_MarkRect;
  15. [SerializeField] private CommentMarkStyle m_MarkStyle = new CommentMarkStyle() { show = false };
  16. [SerializeField] private LabelStyle m_LabelStyle = new LabelStyle() { show = false };
  17. [SerializeField] [Since("v3.5.0")]private Location m_Location = new Location() { align = Location.Align.TopLeft, top = 0.125f };
  18. /// <summary>
  19. /// Set this to false to prevent this comment item from showing.
  20. /// |是否显示当前注解项。
  21. /// </summary>
  22. public bool show { get { return m_Show; } set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } }
  23. /// <summary>
  24. /// content of comment.
  25. /// |注解的文本内容。支持模板参数,可以参考Tooltip的itemFormatter。
  26. /// </summary>
  27. public string content { get { return m_Content; } set { if (PropertyUtil.SetClass(ref m_Content, value)) SetComponentDirty(); } }
  28. /// <summary>
  29. /// the mark rect of comment.
  30. /// |注解区域。
  31. /// </summary>
  32. public Rect markRect { get { return m_MarkRect; } set { if (PropertyUtil.SetStruct(ref m_MarkRect, value)) SetVerticesDirty(); } }
  33. /// <summary>
  34. /// the mark rect style.
  35. /// |注解标记区域样式。
  36. /// </summary>
  37. public CommentMarkStyle markStyle { get { return m_MarkStyle; } set { if (PropertyUtil.SetClass(ref m_MarkStyle, value)) SetVerticesDirty(); } }
  38. /// <summary>
  39. /// The text style of all comments.
  40. /// |注解项的文本样式。
  41. /// </summary>
  42. public LabelStyle labelStyle
  43. {
  44. get { return m_LabelStyle; }
  45. set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
  46. }
  47. /// <summary>
  48. /// The location of comment.
  49. /// |Comment显示的位置。
  50. /// </summary>
  51. public Location location
  52. {
  53. get { return m_Location; }
  54. set { if (PropertyUtil.SetClass(ref m_Location, value)) SetComponentDirty(); }
  55. }
  56. }
  57. }