using System; using UnityEngine; namespace XCharts.Runtime { /// /// 标签的引导线 /// [System.Serializable] public class LabelLine : ChildComponent, ISerieExtraComponent, ISerieDataComponent { /// /// 标签视觉引导线类型 /// public enum LineType { /// /// 折线 /// BrokenLine, /// /// 曲线 /// Curves, /// /// 水平线 /// HorizontalLine } [SerializeField] private bool m_Show = true; [SerializeField] private LineType m_LineType = LineType.BrokenLine; [SerializeField] private Color32 m_LineColor = ChartConst.clearColor32; [SerializeField] private float m_LineAngle = 0; [SerializeField] private float m_LineWidth = 1.0f; [SerializeField] private float m_LineGap = 1.0f; [SerializeField] private float m_LineLength1 = 25f; [SerializeField] private float m_LineLength2 = 15f; [SerializeField] private SymbolStyle m_StartSymbol = new SymbolStyle() { type = SymbolType.Circle, size = 3 }; [SerializeField] private SymbolStyle m_EndSymbol = new SymbolStyle() { type = SymbolType.Circle, size = 3 }; public void Reset() { m_Show = false; m_LineType = LineType.BrokenLine; m_LineColor = Color.clear; m_LineAngle = 0; m_LineWidth = 1.0f; m_LineGap = 1.0f; m_LineLength1 = 25f; m_LineLength2 = 15f; } /// /// Whether the label line is showed. /// |是否显示视觉引导线。 /// public bool show { get { return m_Show; } set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetAllDirty(); } } /// /// the type of visual guide line. /// |视觉引导线类型。 /// public LineType lineType { get { return m_LineType; } set { if (PropertyUtil.SetStruct(ref m_LineType, value)) SetVerticesDirty(); } } /// /// the color of visual guild line. /// |视觉引导线颜色。默认和serie一致取自调色板。 /// public Color32 lineColor { get { return m_LineColor; } set { if (PropertyUtil.SetStruct(ref m_LineColor, value)) SetVerticesDirty(); } } /// /// the angle of visual guild line. /// |视觉引导线的固定角度。对折线和曲线有效。 /// public float lineAngle { get { return m_LineAngle; } set { if (PropertyUtil.SetStruct(ref m_LineAngle, value)) SetVerticesDirty(); } } /// /// the width of visual guild line. /// |视觉引导线的宽度。 /// public float lineWidth { get { return m_LineWidth; } set { if (PropertyUtil.SetStruct(ref m_LineWidth, value)) SetVerticesDirty(); } } /// /// the gap of container and guild line. /// |视觉引导线和容器的间距。 /// public float lineGap { get { return m_LineGap; } set { if (PropertyUtil.SetStruct(ref m_LineGap, value)) SetVerticesDirty(); } } /// /// The length of the first segment of visual guide line. /// |视觉引导线第一段的长度。 /// public float lineLength1 { get { return m_LineLength1; } set { if (PropertyUtil.SetStruct(ref m_LineLength1, value)) SetVerticesDirty(); } } /// /// The length of the second segment of visual guide line. /// |视觉引导线第二段的长度。 /// public float lineLength2 { get { return m_LineLength2; } set { if (PropertyUtil.SetStruct(ref m_LineLength2, value)) SetVerticesDirty(); } } /// /// The symbol of the start point of labelline. /// |起始点的图形标记。 /// public SymbolStyle startSymbol { get { return m_StartSymbol; } set { if (PropertyUtil.SetClass(ref m_StartSymbol, value)) SetVerticesDirty(); } } /// /// The symbol of the end point of labelline. /// |结束点的图形标记。 /// public SymbolStyle endSymbol { get { return m_EndSymbol; } set { if (PropertyUtil.SetClass(ref m_EndSymbol, value)) SetVerticesDirty(); } } } }