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.

ArrowStyle.cs 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. /// <summary>
  6. /// </summary>
  7. [Serializable]
  8. public class ArrowStyle : ChildComponent
  9. {
  10. [SerializeField] private float m_Width = 10;
  11. [SerializeField] private float m_Height = 15;
  12. [SerializeField] private float m_Offset = 0;
  13. [SerializeField] private float m_Dent = 3;
  14. [SerializeField] private Color32 m_Color = Color.clear;
  15. /// <summary>
  16. /// The widht of arrow.
  17. /// |箭头宽。
  18. /// </summary>
  19. public float width
  20. {
  21. get { return m_Width; }
  22. set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetVerticesDirty(); }
  23. }
  24. /// <summary>
  25. /// The height of arrow.
  26. /// |箭头高。
  27. /// </summary>
  28. public float height
  29. {
  30. get { return m_Height; }
  31. set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetVerticesDirty(); }
  32. }
  33. /// <summary>
  34. /// The offset of arrow.
  35. /// |箭头偏移。
  36. /// </summary>
  37. public float offset
  38. {
  39. get { return m_Offset; }
  40. set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetVerticesDirty(); }
  41. }
  42. /// <summary>
  43. /// The dent of arrow.
  44. /// |箭头的凹度。
  45. /// </summary>
  46. public float dent
  47. {
  48. get { return m_Dent; }
  49. set { if (PropertyUtil.SetStruct(ref m_Dent, value)) SetVerticesDirty(); }
  50. }
  51. /// <summary>
  52. /// the color of arrow.
  53. /// |箭头颜色。
  54. /// </summary>
  55. public Color32 color
  56. {
  57. get { return m_Color; }
  58. set { if (PropertyUtil.SetColor(ref m_Color, value)) SetVerticesDirty(); }
  59. }
  60. public ArrowStyle Clone()
  61. {
  62. var arrow = new ArrowStyle();
  63. arrow.width = width;
  64. arrow.height = height;
  65. arrow.offset = offset;
  66. arrow.dent = dent;
  67. arrow.color = color;
  68. return arrow;
  69. }
  70. public void Copy(ArrowStyle arrow)
  71. {
  72. width = arrow.width;
  73. height = arrow.height;
  74. offset = arrow.offset;
  75. dent = arrow.dent;
  76. color = arrow.color;
  77. }
  78. public Color32 GetColor(Color32 defaultColor)
  79. {
  80. if (ChartHelper.IsClearColor(color))
  81. return defaultColor;
  82. else
  83. return color;
  84. }
  85. }
  86. }