protected virtual void  OnGUI()
        {
            ProfilesManager.OnProfilesBarGUI();
            if (ProfilesManager.IsReady == false)
            {
                return;
            }

            if (this.textStyle == null)
            {
                this.textStyle            = new GUIStyle(GUI.skin.textField);
                this.textStyle.alignment  = TextAnchor.MiddleLeft;
                this.labelStyle           = new GUIStyle(GUI.skin.label);
                this.labelStyle.alignment = TextAnchor.MiddleLeft;
            }

            this.scrollPosition = EditorGUILayout.BeginScrollView(this.scrollPosition);
            {
                EditorGUI.BeginChangeCheck();
                ProfilesManager.Profile.packagePath = EditorGUILayout.TextField(this.packageFolderContent, ProfilesManager.Profile.packagePath);
                Rect r2 = GUILayoutUtility.GetLastRect();
                r2.x += 107F;
                GUI.Label(r2, "Assets/");
                if (EditorGUI.EndChangeCheck() == true || this.packageFolderError == null)
                {
                    if (string.IsNullOrEmpty(ProfilesManager.Profile.packagePath) == true || Directory.Exists("Assets/" + ProfilesManager.Profile.packagePath) == false)
                    {
                        this.packageFolderError = "Package at \"Assets/" + ProfilesManager.Profile.packagePath + "\" was not found.";
                    }
                    else
                    {
                        this.packageFolderError = string.Empty;
                    }

                    ProfilesManager.Save();
                }

                if (this.packageFolderError != string.Empty)
                {
                    EditorGUILayout.HelpBox(this.packageFolderError, MessageType.Warning);
                }

                EditorGUI.BeginChangeCheck();
                ProfilesManager.Profile.deployMeta = EditorGUILayout.Toggle("Copy Meta", ProfilesManager.Profile.deployMeta);
                if (EditorGUI.EndChangeCheck() == true)
                {
                    ProfilesManager.Save();
                }

                GUILayout.Space(10F);

                EditorGUILayout.LabelField("Unity Projects:");
                EditorGUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Detect Projects") == true)
                    {
                        string path = EditorUtility.OpenFolderPanel("Folder with Unity Projects ending by A.B.C[abfpx]NN", string.Empty, string.Empty);

                        if (string.IsNullOrEmpty(path) == false)
                        {
                            this.DetectProjects(path);
                        }
                    }

                    if (GUILayout.Button("Generate Projects") == true)
                    {
                        GenerateProjectsWindow window = EditorWindow.GetWindow <GenerateProjectsWindow>(true, GenerateProjectsWindow.Title, true);

                        window.packagePath           = ProfilesManager.Profile.packagePath;
                        window.projects              = ProfilesManager.Profile.projects;
                        window.unityInstallsDetected = this.unityInstalls;
                    }

                    EditorGUI.BeginDisabledGroup(this.packageFolderError != string.Empty);
                    if (GUILayout.Button("Deploy All") == true && EditorUtility.DisplayDialog("Deploy All", "Package is gonna be erased before deploying in all projects. May takes few minutes.", "Yes", "No") == true)
                    {
                        this.AsyncDeployAll();
                    }
                    EditorGUI.EndDisabledGroup();
                }
                EditorGUILayout.EndHorizontal();

                if (ProfilesManager.Profile.projects.Count == 0)
                {
                    EditorGUILayout.HelpBox("Path must be \"C:\\Path\\To\\Your\\Project A.B.C[abfpx]NN\" with A.B.C[abfpx]NN the Unity version. (e.g. 4.5.0f2, 5.3.5b14)", MessageType.Info);
                }

                this.list.DoLayoutList();

                if (this.unityProcessesDetected.Count >= 2)
                {
                    EditorGUILayout.LabelField("Unity processes:");
                    for (int i = 0; i < this.unityProcessesDetected.Count; i++)
                    {
                        EditorGUILayout.LabelField(this.unityProcessesDetected[i]);
                    }
                }
            }
            EditorGUILayout.EndScrollView();

            if (this.unityProcessesDetected.Count >= 2)
            {
                EditorGUILayout.HelpBox("Many Unity processes detected. You should not launch more than one Unity Editor when deploying, to avoid log collision, since they all share the same editor.log.", MessageType.Warning);
            }
        }
Beispiel #2
0
        protected virtual void  OnGUI()
        {
            ProfilesManager.OnProfilesBarGUI();
            if (ProfilesManager.IsReady == false)
            {
                return;
            }

            using (LabelWidthRestorer.Get(143F))
            {
                EditorGUI.BeginChangeCheck();
                ProfilesManager.Profile.packagePath = EditorGUILayout.TextField("Package Path", ProfilesManager.Profile.packagePath);
                Rect r = GUILayoutUtility.GetLastRect();
                r.x += 100F;
                GUI.Label(r, "Assets/");

                if (Directory.Exists("Assets/" + ProfilesManager.Profile.packagePath) == false)
                {
                    EditorGUILayout.HelpBox("Package at \"Assets/" + ProfilesManager.Profile.packagePath + "\" was not found.", MessageType.Warning);
                }
            }

            using (LabelWidthRestorer.Get(100F))
            {
                this.version = EditorGUILayout.TextField("Version", this.version);

                EditorGUILayout.BeginHorizontal();
                {
                    ProfilesManager.Profile.exportPath = EditorGUILayout.TextField("Export Path", ProfilesManager.Profile.exportPath);
                    if (GUILayout.Button("Browse", "ButtonLeft", GUILayout.Width(60F)) == true)
                    {
                        string exportPath = EditorUtility.OpenFolderPanel("Export folder", ProfilesManager.Profile.exportPath, string.Empty);

                        if (string.IsNullOrEmpty(exportPath) == false)
                        {
                            ProfilesManager.Profile.exportPath = exportPath;
                            GUI.FocusControl(null);
                        }
                    }

                    if (GUILayout.Button("Open", "ButtonRight", GUILayout.Width(50F)) == true)
                    {
                        Utility.ShowExplorer(ProfilesManager.Profile.exportPath);
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (Directory.Exists(ProfilesManager.Profile.exportPath) == false)
                {
                    EditorGUILayout.HelpBox("Export path is not a folder.", MessageType.Warning);
                }

                ProfilesManager.Profile.devPrefix  = EditorGUILayout.TextField("Full Export Prefix", ProfilesManager.Profile.devPrefix);
                ProfilesManager.Profile.nameFormat = EditorGUILayout.TextField("Name Format", ProfilesManager.Profile.nameFormat);
                EditorGUILayout.HelpBox("{0} = Date of the day, {1} = Version", MessageType.Info);

                EditorGUILayout.BeginHorizontal();
                {
                    this.finalExportPath = EditorGUILayout.TextField(this.finalExportPath);
                    if (EditorGUI.EndChangeCheck() == true || string.IsNullOrEmpty(this.finalExportPath) == true)
                    {
                        this.finalExportPath = Path.Combine(ProfilesManager.Profile.exportPath, this.GetExportName());
                    }

                    if (File.Exists(this.finalExportPath) == true && GUILayout.Button("Show", GUILayout.Width(50F)) == true)
                    {
                        Utility.ShowExplorer(this.finalExportPath);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Export Package") == true)
                {
                    this.Export();
                }

                if (GUILayout.Button("Full Export Package") == true)
                {
                    this.ExportForDev();
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        protected virtual void  OnGUI()
        {
            ProfilesManager.OnProfilesBarGUI();
            if (ProfilesManager.IsReady == false)
            {
                return;
            }

            EditorGUILayout.LabelField("Default keywords:");
            EditorGUI.BeginDisabledGroup(true);
            for (int i = 0; i < NGPackageExcluderWindow.DefaultKeywords.Length; i++)
            {
                EditorGUILayout.TextField(NGPackageExcluderWindow.DefaultKeywords[i]);
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.LabelField("Excluded keywords:");
            for (int i = 0; i < ProfilesManager.Profile.excludeKeywords.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                {
                    ProfilesManager.Profile.excludeKeywords[i] = EditorGUILayout.TextField(ProfilesManager.Profile.excludeKeywords[i]);
                    if (GUILayout.Button("X", GUILayout.Width(20F)) == true)
                    {
                        ProfilesManager.Profile.excludeKeywords.RemoveAt(i);
                        ProfilesManager.Save();
                        break;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Add") == true)
                {
                    ProfilesManager.Profile.excludeKeywords.Add(string.Empty);
                    ProfilesManager.Save();
                }

                if (GUILayout.Button("Save") == true)
                {
                    StringBuilder buffer = Utility.GetBuffer();

                    for (int i = 0; i < ProfilesManager.Profile.excludeKeywords.Count; i++)
                    {
                        if (ProfilesManager.Profile.excludeKeywords[i] != string.Empty)
                        {
                            buffer.Append(ProfilesManager.Profile.excludeKeywords[i]);
                            buffer.Append(NGPackageExcluderWindow.KeywordSeparator);
                        }
                    }

                    if (buffer.Length > 0)
                    {
                        --buffer.Length;
                    }

                    ProfilesManager.Save();
                }
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10F);

            EditorGUILayout.LabelField("Include keywords:");
            for (int i = 0; i < ProfilesManager.Profile.includeKeywords.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                {
                    ProfilesManager.Profile.includeKeywords[i] = EditorGUILayout.TextField(ProfilesManager.Profile.includeKeywords[i]);
                    if (GUILayout.Button("X", GUILayout.Width(20F)) == true)
                    {
                        ProfilesManager.Profile.includeKeywords.RemoveAt(i);
                        ProfilesManager.Save();
                        break;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Add") == true)
                {
                    ProfilesManager.Profile.includeKeywords.Add(string.Empty);
                    ProfilesManager.Save();
                }

                if (GUILayout.Button("Save") == true)
                {
                    StringBuilder buffer = Utility.GetBuffer();

                    for (int i = 0; i < ProfilesManager.Profile.includeKeywords.Count; i++)
                    {
                        if (ProfilesManager.Profile.includeKeywords[i] != string.Empty)
                        {
                            buffer.Append(ProfilesManager.Profile.includeKeywords[i]);
                            buffer.Append(NGPackageExcluderWindow.KeywordSeparator);
                        }
                    }

                    if (buffer.Length > 0)
                    {
                        --buffer.Length;
                    }

                    ProfilesManager.Save();
                }
            }
            EditorGUILayout.EndHorizontal();
        }