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.

ImageStyle.cs 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. namespace XCharts.Runtime
  4. {
  5. [System.Serializable]
  6. public class ImageStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
  7. {
  8. [SerializeField] private bool m_Show = true;
  9. [SerializeField] private Sprite m_Sprite;
  10. [SerializeField] private Image.Type m_Type;
  11. [SerializeField] private bool m_AutoColor;
  12. [SerializeField] private Color m_Color = Color.clear;
  13. [SerializeField] private float m_Width = 0;
  14. [SerializeField] private float m_Height = 0;
  15. public void Reset()
  16. {
  17. m_Show = false;
  18. m_Type = Image.Type.Simple;
  19. m_Sprite = null;
  20. m_AutoColor = false;
  21. m_Color = Color.white;
  22. m_Width = 0;
  23. m_Height = 0;
  24. }
  25. /// <summary>
  26. /// Whether the data icon is show.
  27. /// |是否显示图标。
  28. /// </summary>
  29. public bool show { get { return m_Show; } set { m_Show = value; } }
  30. /// <summary>
  31. /// The image of icon.
  32. /// |图标的图片。
  33. /// </summary>
  34. public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
  35. /// <summary>
  36. /// How to display the image.
  37. /// |图片的显示类型。
  38. /// </summary>
  39. public Image.Type type { get { return m_Type; } set { m_Type = value; } }
  40. /// <summary>
  41. /// 是否自动颜色。
  42. /// </summary>
  43. public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
  44. /// <summary>
  45. /// 图标颜色。
  46. /// </summary>
  47. public Color color { get { return m_Color; } set { m_Color = value; } }
  48. /// <summary>
  49. /// 图标宽。
  50. /// </summary>
  51. public float width { get { return m_Width; } set { m_Width = value; } }
  52. /// <summary>
  53. /// 图标高。
  54. /// </summary>
  55. public float height { get { return m_Height; } set { m_Height = value; } }
  56. public ImageStyle Clone()
  57. {
  58. var imageStyle = new ImageStyle();
  59. imageStyle.type = type;
  60. imageStyle.sprite = sprite;
  61. imageStyle.autoColor = autoColor;
  62. imageStyle.color = color;
  63. imageStyle.width = width;
  64. imageStyle.height = height;
  65. return imageStyle;
  66. }
  67. public void Copy(ImageStyle imageStyle)
  68. {
  69. type = imageStyle.type;
  70. sprite = imageStyle.sprite;
  71. autoColor = imageStyle.autoColor;
  72. color = imageStyle.color;
  73. width = imageStyle.width;
  74. height = imageStyle.height;
  75. }
  76. }
  77. }