Exemple #1
0
        public static void SwitchTheme(BaseChart chart, string themeName)
        {
            Debug.Log("SwitchTheme:" + themeName);
#if UNITY_EDITOR
            if (XChartsMgr.Instance.m_ThemeDict.Count == 0)
            {
                ReloadThemeList();
            }
#endif
            if (!XChartsMgr.Instance.m_ThemeDict.ContainsKey(themeName))
            {
                Debug.LogError("SwitchTheme ERROR: not exist theme:" + themeName);
                return;
            }
            var target = XChartsMgr.Instance.m_ThemeDict[themeName];
            chart.theme.CopyTheme(target);
            chart.RefreshAllComponent();
        }
        private void OnGUI()
        {
            if (chart == null)
            {
                Close();
                return;
            }
            var iconRect = new Rect(5, 10, position.width - 10, EditorGUIUtility.singleLineHeight);

            serieType   = (SerieType)EditorGUI.EnumPopup(iconRect, "Serie Type", serieType);
            iconRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            serieName   = EditorGUI.TextField(iconRect, "Serie Name", serieName);
            iconRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            GUILayout.Space(iconRect.y + 5);
            if (GUILayout.Button("Add"))
            {
                SerieTemplate.AddDefaultSerie(chart, serieType, serieName);
                chart.RefreshAllComponent();
            }
        }
        public static void SwitchTheme(BaseChart chart, string themeName)
        {
            Debug.Log("SwitchTheme:" + themeName);
            if (chart.theme.themeName.Equals(themeName))
            {
                return;
            }
#if UNITY_EDITOR
            if (Instance.m_ThemeDict.Count == 0)
            {
                Instance.LoadThemesFromResources();
            }
#endif
            if (!Instance.m_ThemeDict.ContainsKey(themeName))
            {
                Debug.LogError("SwitchTheme ERROR: not exist theme:" + themeName);
                return;
            }
            var target = Instance.m_ThemeDict[themeName];
            chart.theme.CopyTheme(target);
            chart.RefreshAllComponent();
        }