Exemple #1
0
        private static void CheckName(BaseChart chart, StringBuilder sb)
        {
            if (string.IsNullOrEmpty(chart.chartName))
            {
                return;
            }
            var list = XChartsMgr.GetCharts(chart.chartName);

            if (list.Count > 1)
            {
                sb.AppendFormat("warning:chart name is repeated: {0}\n", chart.chartName);
            }
        }
 protected override void Awake()
 {
     if (m_Settings == null)
     {
         m_Settings = Settings.DefaultSettings;
     }
     CheckTheme();
     base.Awake();
     InitComponentHandlers();
     InitSerieHandlers();
     AnimationReset();
     AnimationFadeIn();
     XChartsMgr.AddChart(this);
 }
Exemple #3
0
        public static void ShowPackageImporterWindow()
        {
            var packagePath = XChartsMgr.GetPackageFullPath();

            if (packagePath != null)
            {
                if (m_ImporterWindow == null)
                {
                    m_ImporterWindow = GetWindow <XCResourceImporterWindow>();
                    m_ImporterWindow.titleContent = new GUIContent("XCharts Importer");
                }
                m_ImporterWindow.Focus();
            }
        }
Exemple #4
0
        public void OnGUI()
        {
            m_EssentialResourcesImported = Resources.Load <XCSettings>("XCSettings") != null;

            GUILayout.BeginVertical();
            {
                GUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    GUILayout.Label("XCharts Essentials", EditorStyles.boldLabel);
                    GUILayout.Label("This appears to be the first time you access XCharts, as such we need to add resources to your project that are essential for using XCharts. These new resources will be placed at the root of your project in the \"XCharts\" folder.", new GUIStyle(EditorStyles.label)
                    {
                        wordWrap = true
                    });
                    GUILayout.Space(5f);

                    GUI.enabled = !m_EssentialResourcesImported;
                    GUI.enabled = true;
                    if (GUILayout.Button("Import XCharts Essentials"))
                    {
                        string packageFullPath = XChartsMgr.GetPackageFullPath();
                        if (packageFullPath != null)
                        {
                            var sourPath = Path.Combine(packageFullPath, "Resources");
                            var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
                            if (CopyFolder(sourPath, destPath))
                            {
                                AssetDatabase.SaveAssets();
                                AssetDatabase.Refresh();
                            }
                        }
                    }
                    GUILayout.Space(5f);
                    GUI.enabled = true;
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
            GUILayout.Space(5f);
        }