From 8049d1141b117623a2a14fc492fac9bd3f64a6d6 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 2 Sep 2019 09:46:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AC=9B=E5=8D=A1=E5=B0=94?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E7=B3=BB=E5=BC=80=E5=90=AF=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E6=97=B6=E7=BB=98=E5=88=B6=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/UI/Internal/Animation.cs | 12 +++--------- Scripts/UI/LineChart.cs | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Scripts/UI/Internal/Animation.cs b/Scripts/UI/Internal/Animation.cs index 9e03ab79..d1a1d0d6 100644 --- a/Scripts/UI/Internal/Animation.cs +++ b/Scripts/UI/Internal/Animation.cs @@ -87,6 +87,7 @@ namespace XCharts { if (m_IsEnd) return; m_ActualDuration = (int)((Time.time - startTime) * 1000) - delay; + m_CurrDataProgress = m_DestDataProgress + 1; m_IsEnd = true; } @@ -108,7 +109,7 @@ namespace XCharts public void SetDataFinish(int dataIndex) { - if (dataIndex < dataState.Count && !dataState[dataIndex]) + if (!m_IsEnd && dataIndex < dataState.Count && !dataState[dataIndex]) { dataState[dataIndex] = true; m_CurrDataProgress = dataIndex + 1; @@ -120,14 +121,7 @@ namespace XCharts #if UNITY_EDITOR if (!Application.isPlaying) return true; #endif - return !enable || (m_CurrDataProgress>m_DestDataProgress && m_CurrDetailProgress > m_DestDetailProgress); - } - - public bool IsFinishData(int dataIndex) - { - if (!m_Enable) return true; - if (dataIndex < dataState.Count) return dataState[dataIndex]; - return true; + return !enable || (m_CurrDataProgress > m_DestDataProgress && m_CurrDetailProgress > m_DestDetailProgress); } public bool IsInDelay() diff --git a/Scripts/UI/LineChart.cs b/Scripts/UI/LineChart.cs index ea4743c2..8bb3d951 100644 --- a/Scripts/UI/LineChart.cs +++ b/Scripts/UI/LineChart.cs @@ -392,7 +392,7 @@ namespace XCharts bool isStart = false; for (int i = 1; i < segment; i++) { - var cp = lp + dist * i / segment * dir1; + var cp = lp + dir1 *(dist * i / segment); if (serie.animation.CheckDetailBreak(cp, isYAxis)) isBreak = true; var tp1 = cp - dir1v * serie.lineStyle.width; var tp2 = cp + dir1v * serie.lineStyle.width; @@ -402,7 +402,7 @@ namespace XCharts { if (!isStart) { - if ((isYAxis && tp1.y > lastDnPos.y) || (!isYAxis && tp1.x > lastDnPos.x) || dataIndex == 1) + if ((isYAxis && tp1.y > lastDnPos.y) || (!isYAxis && tp1.x > lastDnPos.x) || dataIndex == 1 || IsValue()) { isStart = true; ChartHelper.DrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor); @@ -421,7 +421,7 @@ namespace XCharts } else { - if ((isYAxis && tp2.y < dnPos.y) || (!isYAxis && tp2.x < dnPos.x)) + if ((isYAxis && tp2.y < dnPos.y) || (!isYAxis && tp2.x < dnPos.x) || IsValue()) { ChartHelper.DrawLine(vh, start, cp, serie.lineStyle.width, lineColor); } @@ -437,13 +437,13 @@ namespace XCharts if (isYAxis) { - if (tp1.y > lastDnPos.y || dataIndex == 1) smoothPoints.Add(tp1); - if (tp2.y < dnPos.y) smoothDownPoints.Add(tp2); + if (tp1.y > lastDnPos.y || dataIndex == 1 || IsValue()) smoothPoints.Add(tp1); + if (tp2.y < dnPos.y|| IsValue()) smoothDownPoints.Add(tp2); } else { - if (tp1.x > lastDnPos.x || dataIndex == 1) smoothPoints.Add(tp1); - if (tp2.x < dnPos.x || dataIndex == 1) smoothDownPoints.Add(tp2); + if (tp1.x > lastDnPos.x || dataIndex == 1|| IsValue()) smoothPoints.Add(tp1); + if (tp2.x < dnPos.x || dataIndex == 1|| IsValue()) smoothDownPoints.Add(tp2); } } else @@ -452,7 +452,7 @@ namespace XCharts { if (!isStart) { - if ((isYAxis && tp2.y > lastDnPos.y) || (!isYAxis && tp2.x > lastDnPos.x) || dataIndex == 1) + if ((isYAxis && tp2.y > lastDnPos.y) || (!isYAxis && tp2.x > lastDnPos.x) || dataIndex == 1|| IsValue()) { isStart = true; ChartHelper.DrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor); @@ -471,7 +471,7 @@ namespace XCharts } else { - if ((isYAxis && tp1.y < dnPos.y) || (!isYAxis && tp1.x < dnPos.x)) + if ((isYAxis && tp1.y < dnPos.y) || (!isYAxis && tp1.x < dnPos.x)|| IsValue()) ChartHelper.DrawLine(vh, start, cp, serie.lineStyle.width, lineColor); else { @@ -485,13 +485,13 @@ namespace XCharts if (isYAxis) { - if (tp1.y < dnPos.y) smoothPoints.Add(tp1); - if (tp2.y > lastDnPos.y || dataIndex == 1) smoothDownPoints.Add(tp2); + if (tp1.y < dnPos.y|| IsValue()) smoothPoints.Add(tp1); + if (tp2.y > lastDnPos.y || dataIndex == 1|| IsValue()) smoothDownPoints.Add(tp2); } else { - if (tp1.x < dnPos.x) smoothPoints.Add(tp1); - if (tp2.x > lastDnPos.x || dataIndex == 1) smoothDownPoints.Add(tp2); + if (tp1.x < dnPos.x|| IsValue()) smoothPoints.Add(tp1); + if (tp2.x > lastDnPos.x || dataIndex == 1|| IsValue()) smoothDownPoints.Add(tp2); } } start = cp;