using UnityEngine; using UnityEngine.UI; namespace XCharts.Runtime { [System.Serializable] public class ImageStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent { [SerializeField] private bool m_Show = true; [SerializeField] private Sprite m_Sprite; [SerializeField] private Image.Type m_Type; [SerializeField] private bool m_AutoColor; [SerializeField] private Color m_Color = Color.clear; [SerializeField] private float m_Width = 0; [SerializeField] private float m_Height = 0; public void Reset() { m_Show = false; m_Type = Image.Type.Simple; m_Sprite = null; m_AutoColor = false; m_Color = Color.white; m_Width = 0; m_Height = 0; } /// /// Whether the data icon is show. /// |是否显示图标。 /// public bool show { get { return m_Show; } set { m_Show = value; } } /// /// The image of icon. /// |图标的图片。 /// public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } } /// /// How to display the image. /// |图片的显示类型。 /// public Image.Type type { get { return m_Type; } set { m_Type = value; } } /// /// 是否自动颜色。 /// public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } } /// /// 图标颜色。 /// public Color color { get { return m_Color; } set { m_Color = value; } } /// /// 图标宽。 /// public float width { get { return m_Width; } set { m_Width = value; } } /// /// 图标高。 /// public float height { get { return m_Height; } set { m_Height = value; } } public ImageStyle Clone() { var imageStyle = new ImageStyle(); imageStyle.type = type; imageStyle.sprite = sprite; imageStyle.autoColor = autoColor; imageStyle.color = color; imageStyle.width = width; imageStyle.height = height; return imageStyle; } public void Copy(ImageStyle imageStyle) { type = imageStyle.type; sprite = imageStyle.sprite; autoColor = imageStyle.autoColor; color = imageStyle.color; width = imageStyle.width; height = imageStyle.height; } } }