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

DataZoomTheme.cs 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. [Serializable]
  6. public class DataZoomTheme : ComponentTheme
  7. {
  8. [SerializeField] protected float m_BorderWidth;
  9. [SerializeField] protected float m_DataLineWidth;
  10. [SerializeField] protected Color32 m_FillerColor;
  11. [SerializeField] protected Color32 m_BorderColor;
  12. [SerializeField] protected Color32 m_DataLineColor;
  13. [SerializeField] protected Color32 m_DataAreaColor;
  14. [SerializeField] protected Color32 m_BackgroundColor;
  15. /// <summary>
  16. /// the width of border line.
  17. /// |边框线宽。
  18. /// </summary>
  19. public float borderWidth
  20. {
  21. get { return m_BorderWidth; }
  22. set { if (PropertyUtil.SetStruct(ref m_BorderWidth, value)) SetVerticesDirty(); }
  23. }
  24. /// <summary>
  25. /// the width of data line.
  26. /// |数据阴影线宽。
  27. /// </summary>
  28. public float dataLineWidth
  29. {
  30. get { return m_DataLineWidth; }
  31. set { if (PropertyUtil.SetStruct(ref m_DataLineWidth, value)) SetVerticesDirty(); }
  32. }
  33. /// <summary>
  34. /// the color of dataZoom data area.
  35. /// |数据区域颜色。
  36. /// </summary>
  37. public Color32 fillerColor
  38. {
  39. get { return m_FillerColor; }
  40. set { if (PropertyUtil.SetColor(ref m_FillerColor, value)) SetVerticesDirty(); }
  41. }
  42. /// <summary>
  43. /// the color of dataZoom border.
  44. /// |边框颜色。
  45. /// </summary>
  46. public Color32 borderColor
  47. {
  48. get { return m_BorderColor; }
  49. set { if (PropertyUtil.SetColor(ref m_BorderColor, value)) SetComponentDirty(); }
  50. }
  51. /// <summary>
  52. /// the color of data area line.
  53. /// |数据阴影的线条颜色。
  54. /// </summary>
  55. public Color32 dataLineColor
  56. {
  57. get { return m_DataLineColor; }
  58. set { if (PropertyUtil.SetColor(ref m_DataLineColor, value)) SetComponentDirty(); }
  59. }
  60. /// <summary>
  61. /// the color of data area line.
  62. /// |数据阴影的填充颜色。
  63. /// </summary>
  64. public Color32 dataAreaColor
  65. {
  66. get { return m_DataAreaColor; }
  67. set { if (PropertyUtil.SetColor(ref m_DataAreaColor, value)) SetComponentDirty(); }
  68. }
  69. /// <summary>
  70. /// the background color of datazoom.
  71. /// |背景颜色。
  72. /// </summary>
  73. public Color32 backgroundColor
  74. {
  75. get { return m_BackgroundColor; }
  76. set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetComponentDirty(); }
  77. }
  78. public DataZoomTheme(ThemeType theme) : base(theme)
  79. {
  80. m_BorderWidth = XCSettings.dataZoomBorderWidth;
  81. m_DataLineWidth = XCSettings.dataZoomDataLineWidth;
  82. m_BackgroundColor = Color.clear;
  83. switch (theme)
  84. {
  85. case ThemeType.Default:
  86. m_TextColor = ColorUtil.GetColor("#333");
  87. m_FillerColor = new Color32(167, 183, 204, 110);
  88. m_BorderColor = ColorUtil.GetColor("#ddd");
  89. m_DataLineColor = ColorUtil.GetColor("#2f4554");
  90. m_DataAreaColor = new Color32(47, 69, 84, 85);
  91. break;
  92. case ThemeType.Light:
  93. m_TextColor = ColorUtil.GetColor("#333");
  94. m_FillerColor = new Color32(167, 183, 204, 110);
  95. m_BorderColor = ColorUtil.GetColor("#ddd");
  96. m_DataLineColor = ColorUtil.GetColor("#2f4554");
  97. m_DataAreaColor = new Color32(47, 69, 84, 85);
  98. break;
  99. case ThemeType.Dark:
  100. m_TextColor = ColorUtil.GetColor("#B9B8CE");
  101. m_FillerColor = new Color32(135, 163, 206, (byte) (0.2f * 255));
  102. m_BorderColor = ColorUtil.GetColor("#71708A");
  103. m_DataLineColor = ColorUtil.GetColor("#71708A");
  104. m_DataAreaColor = ColorUtil.GetColor("#71708A");
  105. break;
  106. }
  107. }
  108. public void Copy(DataZoomTheme theme)
  109. {
  110. base.Copy(theme);
  111. m_BorderWidth = theme.borderWidth;
  112. m_DataLineWidth = theme.dataLineWidth;
  113. m_FillerColor = theme.fillerColor;
  114. m_BorderColor = theme.borderColor;
  115. m_DataLineColor = theme.dataLineColor;
  116. m_DataAreaColor = theme.dataAreaColor;
  117. m_BackgroundColor = theme.backgroundColor;
  118. }
  119. }
  120. }