protected void OnInit() { RemoveAllChartComponent(); OnBeforeSerialize(); AddChartComponentWhenNoExist <Title>(); AddChartComponentWhenNoExist <Tooltip>(); GetChartComponent <Title>().text = GetType().Name; if (m_Theme.sharedTheme != null) { m_Theme.sharedTheme.CopyTheme(ThemeType.Default); } else { m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default); } var sizeDelta = rectTransform.sizeDelta; if (sizeDelta.x < 580 && sizeDelta.y < 300) { rectTransform.sizeDelta = new Vector2(580, 300); } ChartHelper.HideAllObject(transform); if (m_OnInit != null) { m_OnInit(); } }
static XChartsMgr() { SerieLabelPool.ClearAll(); chartList.Clear(); if (Resources.Load <XCSettings>("XCSettings")) { XCThemeMgr.ReloadThemeList(); } SceneManager.sceneUnloaded += OnSceneLoaded; }
/// <summary> /// Update chart theme. /// |切换内置主题。 /// </summary> /// <param name="theme">theme</param> public bool UpdateTheme(ThemeType theme) { if (theme == ThemeType.Custom) { Debug.LogError("UpdateTheme: not support switch to Custom theme."); return(false); } if (m_Theme.sharedTheme == null) { m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default); } m_Theme.sharedTheme.CopyTheme(theme); return(true); }
protected virtual void CheckTheme() { if (m_Theme.sharedTheme == null) { m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default); } if (m_Theme.sharedTheme != null && m_CheckTheme != m_Theme.themeType) { m_CheckTheme = m_Theme.themeType; m_Theme.sharedTheme.CopyTheme(m_CheckTheme); #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(this); #endif SetAllComponentDirty(); OnThemeChanged(); } }