示例#1
0
        private void OnGUI()
        {
            if (target == null)
            {
                Close();
                return;
            }
            GUILayout.Space(10);
            GUILayout.Label("Input a new name for theme:");
            m_ChartName = GUILayout.TextField(m_ChartName);

            GUILayout.Space(10);
            GUILayout.Label("Export path:");
            if (string.IsNullOrEmpty(m_ChartName))
            {
                GUILayout.Label("Need input a new name.");
            }
            else
            {
                GUILayout.Label(XChartsMgr.GetThemeAssetPath(m_ChartName));
            }

            GUILayout.Space(20);
            if (GUILayout.Button("Export"))
            {
                if (string.IsNullOrEmpty(m_ChartName))
                {
                    ShowNotification(new GUIContent("ERROR:Need input a new name!"));
                }
                else if (XChartsMgr.ContainsTheme(m_ChartName))
                {
                    ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
                }
                else if (IsAssetsExist(XChartsMgr.GetThemeAssetPath(m_ChartName)))
                {
                    ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
                                                    + XChartsMgr.GetThemeAssetPath(m_ChartName)), 5);
                }
                else
                {
                    XChartsMgr.ExportTheme(target.theme, m_ChartName);
                    ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
                                                    + XChartsMgr.GetThemeAssetPath(m_ChartName)), 5);
                }
            }
        }