No Description
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.

BaseLine.cs 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using UnityEngine;
  2. namespace XCharts.Runtime
  3. {
  4. /// <summary>
  5. /// Settings related to base line.
  6. /// |线条基础配置。
  7. /// </summary>
  8. [System.Serializable]
  9. public class BaseLine : ChildComponent
  10. {
  11. [SerializeField] protected bool m_Show;
  12. [SerializeField] protected LineStyle m_LineStyle = new LineStyle();
  13. /// <summary>
  14. /// Set this to false to prevent the axis line from showing.
  15. /// |是否显示坐标轴轴线。
  16. /// </summary>
  17. public bool show
  18. {
  19. get { return m_Show; }
  20. set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
  21. }
  22. /// <summary>
  23. /// 线条样式
  24. /// </summary>
  25. public LineStyle lineStyle
  26. {
  27. get { return m_LineStyle; }
  28. set { if (value != null) { m_LineStyle = value; SetVerticesDirty(); } }
  29. }
  30. public static BaseLine defaultBaseLine
  31. {
  32. get
  33. {
  34. var axisLine = new BaseLine
  35. {
  36. m_Show = true,
  37. m_LineStyle = new LineStyle()
  38. };
  39. return axisLine;
  40. }
  41. }
  42. public BaseLine()
  43. {
  44. lineStyle = new LineStyle();
  45. }
  46. public BaseLine(bool show) : base()
  47. {
  48. m_Show = show;
  49. }
  50. public void Copy(BaseLine axisLine)
  51. {
  52. show = axisLine.show;
  53. lineStyle.Copy(axisLine.lineStyle);
  54. }
  55. public LineStyle.Type GetType(LineStyle.Type themeType)
  56. {
  57. return lineStyle.GetType(themeType);
  58. }
  59. public float GetWidth(float themeWidth)
  60. {
  61. return lineStyle.GetWidth(themeWidth);
  62. }
  63. public float GetLength(float themeLength)
  64. {
  65. return lineStyle.GetLength(themeLength);
  66. }
  67. public Color32 GetColor(Color32 themeColor)
  68. {
  69. return lineStyle.GetColor(themeColor);
  70. }
  71. }
  72. }