From 529c784ee2e049b9fa96768cc766ecb87c28a0aa Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Thu, 4 May 2023 08:14:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`Theme`=E5=9C=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=BB=98=E8=AE=A4=E4=B8=BB=E9=A2=98=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=90=8E=E8=BF=90=E8=A1=8C=E8=A2=AB=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Internal/BaseChart.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 7bb48b80..3529010b 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -66,6 +66,7 @@ slug: /changelog ## master +* (2023.05.04) 修复`Theme`在修改默认主题的参数后运行被重置的问题 * (2023.05.04) 增加`Symbol`选择`Custom`类型时的`Warning`提示 * (2023.04.15) 修复`DataZoom`在多个图表时可能异常的问题 (#252) * (2023.04.14) 修复`Tooltip`在只有一个数据时可能异常的问题 diff --git a/Runtime/Internal/BaseChart.cs b/Runtime/Internal/BaseChart.cs index 46b3d4f9..80964be9 100644 --- a/Runtime/Internal/BaseChart.cs +++ b/Runtime/Internal/BaseChart.cs @@ -11,7 +11,7 @@ namespace XCharts.Runtime { [AddComponentMenu("XCharts/EmptyChart", 10)] [ExecuteInEditMode] - [RequireComponent(typeof(RectTransform),typeof(CanvasRenderer))] + [RequireComponent(typeof(RectTransform), typeof(CanvasRenderer))] [DisallowMultipleComponent] public partial class BaseChart : BaseGraph, ISerializationCallbackReceiver { @@ -131,7 +131,7 @@ namespace XCharts.Runtime { if (m_Settings == null) m_Settings = Settings.DefaultSettings; - CheckTheme(); + CheckTheme(true); base.Awake(); InitComponentHandlers(); InitSerieHandlers(); @@ -244,12 +244,16 @@ namespace XCharts.Runtime painter.SetActive(flag, m_DebugInfo.showAllChartObject); } - protected virtual void CheckTheme() + protected virtual void CheckTheme(bool firstInit = false) { if (m_Theme.sharedTheme == null) { m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default); } + if (firstInit) + { + m_CheckTheme = m_Theme.themeType; + } if (m_Theme.sharedTheme != null && m_CheckTheme != m_Theme.themeType) { m_CheckTheme = m_Theme.themeType;