From 1ed0ff377a791a9edaaff378b577320ff7ff7072 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Thu, 31 Mar 2022 21:54:34 +0800 Subject: [PATCH] fix add main component error --- Runtime/Component/Animation/AnimationStyle.cs | 2 +- Runtime/Component/Axis/AngleAxis/AngleAxis.cs | 1 + .../Component/Axis/RadiusAxis/RadiusAxis.cs | 1 + Runtime/Coord/Polar/PolarCoord.cs | 9 ++-- Runtime/Internal/BaseChart.Component.cs | 3 ++ Runtime/Serie/SerieContext.cs | 28 ++++++------ Runtime/Serie/SerieDataContext.cs | 43 +++++++++---------- 7 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Runtime/Component/Animation/AnimationStyle.cs b/Runtime/Component/Animation/AnimationStyle.cs index 52e0d0bc..0a860d18 100644 --- a/Runtime/Component/Animation/AnimationStyle.cs +++ b/Runtime/Component/Animation/AnimationStyle.cs @@ -543,7 +543,7 @@ internal float CheckItemProgress(int dataIndex, float destProgress, ref bool isE } } - internal void CheckSymbol(float dest) + public void CheckSymbol(float dest) { if (!enable || m_IsEnd || m_IsPause || !m_IsInit) return; diff --git a/Runtime/Component/Axis/AngleAxis/AngleAxis.cs b/Runtime/Component/Axis/AngleAxis/AngleAxis.cs index 220e2fe1..c0984d15 100644 --- a/Runtime/Component/Axis/AngleAxis/AngleAxis.cs +++ b/Runtime/Component/Axis/AngleAxis/AngleAxis.cs @@ -9,6 +9,7 @@ namespace XCharts.Runtime /// |极坐标系的角度轴。 /// [System.Serializable] + [RequireChartComponent(typeof(PolarCoord))] [ComponentHandler(typeof(AngleAxisHandler), true)] public class AngleAxis : Axis { diff --git a/Runtime/Component/Axis/RadiusAxis/RadiusAxis.cs b/Runtime/Component/Axis/RadiusAxis/RadiusAxis.cs index 8ce90dae..69ce3c11 100644 --- a/Runtime/Component/Axis/RadiusAxis/RadiusAxis.cs +++ b/Runtime/Component/Axis/RadiusAxis/RadiusAxis.cs @@ -8,6 +8,7 @@ namespace XCharts.Runtime /// |极坐标系的径向轴。 /// [System.Serializable] + [RequireChartComponent(typeof(PolarCoord))] [ComponentHandler(typeof(RadiusAxisHandler), true)] public class RadiusAxis : Axis { diff --git a/Runtime/Coord/Polar/PolarCoord.cs b/Runtime/Coord/Polar/PolarCoord.cs index 6236545d..f8dc0843 100644 --- a/Runtime/Coord/Polar/PolarCoord.cs +++ b/Runtime/Coord/Polar/PolarCoord.cs @@ -11,7 +11,6 @@ namespace XCharts.Runtime /// [Serializable] [ComponentHandler(typeof(PolarCoordHandler), true)] - [RequireChartComponent(typeof(AngleAxis), typeof(RadiusAxis))] public class PolarCoord : CoordSystem, ISerieContainer { [SerializeField] private bool m_Show = true; @@ -32,8 +31,8 @@ public bool show set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); } } /// - /// [default:[0.5f,0.45f]]The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate. - /// |When value between 0 and 1 represents a percentage relative to the chart. + /// The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate. + /// When value between 0 and 1 represents a percentage relative to the chart. /// |极坐标的中心点。数组的第一项是横坐标,第二项是纵坐标。 /// 当值为0-1之间时表示百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度。 /// @@ -43,7 +42,7 @@ public float[] center set { if (value != null) { m_Center = value; SetAllDirty(); } } } /// - /// [default:0.35f]the radius of polar. + /// the radius of polar. /// |极坐标的半径。 /// public float radius @@ -52,7 +51,7 @@ public float radius set { if (PropertyUtil.SetStruct(ref m_Radius, value)) SetAllDirty(); } } /// - /// [default:Color.clear]Background color of polar, which is transparent by default. + /// Background color of polar, which is transparent by default. /// |极坐标的背景色,默认透明。 /// public Color backgroundColor diff --git a/Runtime/Internal/BaseChart.Component.cs b/Runtime/Internal/BaseChart.Component.cs index c73a44a3..c5bcb874 100644 --- a/Runtime/Internal/BaseChart.Component.cs +++ b/Runtime/Internal/BaseChart.Component.cs @@ -71,6 +71,9 @@ public MainComponent AddChartComponent(Type type) AddComponent(component); m_Components.Sort(); CreateComponentHandler(component); +#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER + UnityEditor.EditorUtility.SetDirty(this); +#endif return component; } diff --git a/Runtime/Serie/SerieContext.cs b/Runtime/Serie/SerieContext.cs index c12438c3..98ad76ce 100644 --- a/Runtime/Serie/SerieContext.cs +++ b/Runtime/Serie/SerieContext.cs @@ -15,7 +15,7 @@ public PointInfo(Vector3 pos, bool ignore) this.isIgnoreBreak = ignore; } } - + public class SerieContext { /// @@ -31,52 +31,52 @@ public class SerieContext /// public List pointerAxisDataIndexs = new List(); public bool isTriggerByAxis = false; - + /// /// 中心点 /// - public Vector3 center { get; internal set; } + public Vector3 center; /// /// 内半径 /// - public float insideRadius { get; set; } + public float insideRadius; /// /// 外半径 /// - public float outsideRadius { get; set; } + public float outsideRadius; /// /// 最大值 /// - public double dataMax { get; internal set; } + public double dataMax; /// /// 最小值 /// - public double dataMin { get; internal set; } - public double checkValue { get; set; } + public double dataMin; + public double checkValue; /// /// 左下角坐标X /// - public float x { get; internal set; } + public float x; /// /// 左下角坐标Y /// - public float y { get; internal set; } + public float y; /// /// 宽 /// - public float width { get; internal set; } + public float width; /// /// 高 /// - public float height { get; internal set; } + public float height; /// /// 矩形区域 /// - public Rect rect { get; internal set; } + public Rect rect; /// /// 绘制顶点数 /// - public int vertCount { get; internal set; } + public int vertCount; /// /// 数据对应的位置坐标。 /// diff --git a/Runtime/Serie/SerieDataContext.cs b/Runtime/Serie/SerieDataContext.cs index a002751f..9299b176 100644 --- a/Runtime/Serie/SerieDataContext.cs +++ b/Runtime/Serie/SerieDataContext.cs @@ -7,57 +7,56 @@ namespace XCharts.Runtime { public class SerieDataContext { - public Vector3 labelPosition { get; set; } + public Vector3 labelPosition; /// /// 开始角度 /// - public float startAngle { get; internal set; } + public float startAngle; /// /// 结束角度 /// - public float toAngle { get; internal set; } + public float toAngle; /// /// 一半时的角度 /// - public float halfAngle { get; internal set; } + public float halfAngle; /// /// 当前角度 /// - public float currentAngle { get; internal set; } + public float currentAngle; /// /// 饼图数据项的内半径 /// - public float insideRadius { get; internal set; } + public float insideRadius; /// /// 饼图数据项的偏移半径 /// - public float offsetRadius { get; internal set; } - public float outsideRadius { get; set; } - public Vector3 position { get; set; } + public float offsetRadius; + public float outsideRadius; + public Vector3 position; public List dataPoints = new List(); public List children = new List(); /// /// 绘制区域。 /// - public Rect rect { get; set; } - public Rect subRect { get; set; } - public int level { get; set; } - public SerieData parent { get; set; } - public Color32 color { get; set; } - public double area { get; set; } - public float angle { get; set; } - public Vector3 offsetCenter { get; set; } - public float stackHeight { get; set; } - public bool isClip { get; set; } + public Rect rect; + public Rect subRect; + public int level; + public SerieData parent; + public Color32 color; + public double area; + public float angle; + public Vector3 offsetCenter; + public float stackHeight; + public bool isClip; public bool canShowLabel = true; - public Image symbol { get; set; } + public Image symbol; /// /// Whether the data item is highlighted. /// |该数据项是否被高亮,一般由鼠标悬停或图例悬停触发高亮。 /// - public bool highlight { get; set; } - + public bool highlight; } } \ No newline at end of file