Example #1
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();
            }
        }
Example #2
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);
        }