Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

VisualMapTheme.cs 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. [Serializable]
  6. public class VisualMapTheme : ComponentTheme
  7. {
  8. [SerializeField] protected float m_BorderWidth;
  9. [SerializeField] protected Color32 m_BorderColor;
  10. [SerializeField] protected Color32 m_BackgroundColor;
  11. [SerializeField][Range(10, 50)] protected float m_TriangeLen = 20f;
  12. /// <summary>
  13. /// the width of border.
  14. /// |边框线宽。
  15. /// </summary>
  16. public float borderWidth
  17. {
  18. get { return m_BorderWidth; }
  19. set { if (PropertyUtil.SetStruct(ref m_BorderWidth, value)) SetVerticesDirty(); }
  20. }
  21. /// <summary>
  22. /// the color of dataZoom border.
  23. /// |边框颜色。
  24. /// </summary>
  25. public Color32 borderColor
  26. {
  27. get { return m_BorderColor; }
  28. set { if (PropertyUtil.SetColor(ref m_BorderColor, value)) SetComponentDirty(); }
  29. }
  30. /// <summary>
  31. /// the background color of visualmap.
  32. /// |背景颜色。
  33. /// </summary>
  34. public Color32 backgroundColor
  35. {
  36. get { return m_BackgroundColor; }
  37. set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetComponentDirty(); }
  38. }
  39. /// <summary>
  40. /// 可视化组件的调节三角形边长。
  41. /// </summary>
  42. /// <value></value>
  43. public float triangeLen
  44. {
  45. get { return m_TriangeLen; }
  46. set { if (PropertyUtil.SetStruct(ref m_TriangeLen, value < 0 ? 1f : value)) SetVerticesDirty(); }
  47. }
  48. public VisualMapTheme(ThemeType theme) : base(theme)
  49. {
  50. m_BorderWidth = XCSettings.visualMapBorderWidth;
  51. m_TriangeLen = XCSettings.visualMapTriangeLen;
  52. m_FontSize = XCSettings.fontSizeLv4;
  53. switch (theme)
  54. {
  55. case ThemeType.Default:
  56. m_TextColor = ColorUtil.GetColor("#333");
  57. m_BorderColor = ColorUtil.GetColor("#ccc");
  58. m_BackgroundColor = ColorUtil.clearColor32;
  59. break;
  60. case ThemeType.Light:
  61. m_TextColor = ColorUtil.GetColor("#333");
  62. m_BorderColor = ColorUtil.GetColor("#ccc");
  63. m_BackgroundColor = ColorUtil.clearColor32;
  64. break;
  65. case ThemeType.Dark:
  66. m_TextColor = ColorUtil.GetColor("#B9B8CE");
  67. m_BorderColor = ColorUtil.GetColor("#ccc");
  68. m_BackgroundColor = ColorUtil.clearColor32;
  69. break;
  70. }
  71. }
  72. public void Copy(VisualMapTheme theme)
  73. {
  74. base.Copy(theme);
  75. m_TriangeLen = theme.triangeLen;
  76. m_BorderWidth = theme.borderWidth;
  77. m_BorderColor = theme.borderColor;
  78. m_BackgroundColor = theme.backgroundColor;
  79. }
  80. }
  81. }