Пример #1
0
        private void OnGUI()
        {
            Instance         = this;
            selectedTabIndex = GUILayout.Toolbar(selectedTabIndex, tabs, EditorStyles.toolbarButton, GUILayout.MaxWidth(ToolbarWidth), GUILayout.Height(ToolbarHeight));
            switch (selectedTabIndex)
            {
            case 0:
                BuildGUI();
                break;

            case 1:
                SettingGUI();
                break;

            case 2:
                AboutGUI();
                break;
            }

            if (IDoc.Instance.IsRunning)
            {
                if (IDoc.Instance.Progression >= 1.0f)
                {
                    IDoc.Instance.Terminate();
                    EditorApplication.update -= Repaint;
                    ShowNotification(new GUIContent("Build Finished"));
                }
            }
        }
Пример #2
0
 private static void Resize(Event e)
 {
     if (isResizing)
     {
         sizeRatio = e.mousePosition.y / height;
         IDocEditor.Refresh();
     }
 }
Пример #3
0
        private static void OpenEditor()
        {
            var window = GetWindow <IDocEditor>();

            Instance            = window;
            window.titleContent = new GUIContent("IDoc Editor", Logo);
            window.minSize      = new Vector2(924, 500);
            window.maxSize      = new Vector2(924, 500);
            window.Show();
        }
        /// <summary>
        /// Draws thr editor
        /// </summary>
        public static void OnGUI()
        {
            Instance.scroll = GUILayout.BeginScrollView(Instance.scroll);
            GUILayout.Space(10);

            // SAVE
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Save", GUILayout.Width(100)))
            {
                Setting.SaveSettings();
                AssetDatabase.Refresh();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            GUILayout.Label("Options", EditorStyles.boldLabel);
            Setting.ExtractPublic              = EditorGUILayout.Toggle("Extract Public", Setting.ExtractPublic);
            Setting.ExtractProtected           = EditorGUILayout.Toggle("Extract Protected", Setting.ExtractProtected);
            Setting.ExtractPrivate             = EditorGUILayout.Toggle("Extract Private", Setting.ExtractPrivate);
            Setting.ExtractInternal            = EditorGUILayout.Toggle("Extract Internal", Setting.ExtractInternal);
            Setting.ExtractUndocumentedMembers = EditorGUILayout.Toggle("Extract Undocumented", Setting.ExtractUndocumentedMembers);

            GUILayout.Space(10);

            GUILayout.Label("Directories", EditorStyles.boldLabel);
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Output : ", Setting.OutputDirectory, EditorStyles.textField);
            if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
            {
                Setting.OutputDirectory = EditorUtility.OpenFolderPanel("Select the output folder", Setting.OutputDirectory, string.Empty);
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (IDocEditor.Drop(350, 20, "DRAG AND DROP MULTIPLE FOLDERS TO PROCESS", new Color(0, 0, 0, .1f)))
            {
                foreach (var folder in DragAndDrop.paths)
                {
                    if (IDocEditor.IsDirectory(folder) && !Setting.TryAddInputDirectory(folder))
                    {
                        IDocEditor.Toast($"The folder {folder} is already added");
                    }
                }
                GUILayout.EndScrollView();
                return;
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Or choose individual folders", GUILayout.Width(350)))
            {
                var folder = EditorUtility.OpenFolderPanel("Select a folder to process", string.Empty, string.Empty);
                if (!string.IsNullOrEmpty(folder) && !Setting.TryAddInputDirectory(folder))
                {
                    IDocEditor.Toast($"The folder {folder} is already added");
                }
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical();
            for (var i = 0; i < Setting.InputDirectories.Count; i++)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(Setting.InputDirectories[i], EditorStyles.boldLabel);
                if (GUILayout.Button("X", GUILayout.Width(20)))
                {
                    Setting.InputDirectories.RemoveAt(i);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();

            if (Setting.InputDirectories.Any())
            {
                GUI.color = new Color(1, 1, 1, .2f);
                GUI.Box(GUILayoutUtility.GetLastRect(), GUIContent.none);
                GUI.color = Color.white;
            }
            GUILayout.EndScrollView();
        }