mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
屏蔽Chart的Init()接口,动态创建图表不再需要调用
This commit is contained in:
@@ -19,7 +19,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected ThemeStyle m_Theme = new ThemeStyle();
|
||||
[SerializeField] protected Settings m_Settings;
|
||||
[SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo();
|
||||
[SerializeField] protected bool m_DefaultChartInited = false;
|
||||
[SerializeField] protected bool m_ChartInited = false;
|
||||
|
||||
#pragma warning disable 0414
|
||||
[SerializeField][ListForComponent(typeof(AngleAxis))] private List<AngleAxis> m_AngleAxes = new List<AngleAxis>();
|
||||
@@ -136,6 +136,7 @@ namespace XCharts.Runtime
|
||||
m_Settings = Settings.DefaultSettings;
|
||||
CheckTheme(true);
|
||||
base.Awake();
|
||||
CheckChartInit();
|
||||
InitComponentHandlers();
|
||||
InitSerieHandlers();
|
||||
AnimationReset();
|
||||
@@ -171,17 +172,26 @@ namespace XCharts.Runtime
|
||||
rectTransform.sizeDelta = new Vector2(m_ChartWidth, m_ChartHeight);
|
||||
}
|
||||
ChartHelper.HideAllObject(transform);
|
||||
m_ChartInited = true;
|
||||
if (m_OnInit != null)
|
||||
m_OnInit();
|
||||
}
|
||||
|
||||
protected void CheckChartInit()
|
||||
{
|
||||
if (!m_ChartInited)
|
||||
{
|
||||
OnInit();
|
||||
DefaultChart();
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
OnInit();
|
||||
DefaultChart();
|
||||
m_DefaultChartInited = true;
|
||||
Awake();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user