Пример #1
0
 public static void Modules()
 {
     if (CodeDocsSettings.IsProperlyConfigured() == false)
     {
         CodeDocsSettings.ShowConfiguration();
     }
     else
     {
         CodeDocsModulesPopup.Init();
     }
 }
Пример #2
0
        public static void GenerateAndOpenDocs()
        {
            if (CodeDocsSettings.IsProperlyConfigured() == false)
            {
                CodeDocsSettings.ShowConfiguration();
                return;
            }

            _shouldClosePopup = false;
            Process generateProcess = StartCommand(CodeDocsSettings.GenerateDocsExe, PlayerSettings.productName,
                                                   CodeDocsSettings.SourcesPath);

            CodeDocsInfoPopup.Show(out _updateTextAction, out _closePopup);

            EditorApplication.update += Update;
            new Thread(() =>
            {
                Log(LogType.Log, "thread started");

                if (generateProcess == null)
                {
                    Log(LogType.Error, "Could not start generate process");
                    _shouldClosePopup = true;
                    return;
                }

                Log(LogType.Log, "waiting for thread to finish");
                generateProcess.WaitForExit();

                Log(LogType.Log, "process finished");
                if (generateProcess.ExitCode == 0)
                {
                    EditorApplication.delayCall += OpenDocs;
                }

                _shouldClosePopup = true;
            }).Start();
        }
Пример #3
0
 public static void OpenConfig()
 {
     CodeDocsSettings.ShowConfiguration();
 }
Пример #4
0
 public static bool OpenDocs_Validate()
 {
     return(CodeDocsSettings.AreDocsGenerated());
 }
Пример #5
0
        private void OnGUI()
        {
            EditorGUILayout.BeginVertical();

            GUILayout.Label("path initialized from package cache");
            EditorGUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(true);

            // docs root path
            CodeDocsSettings.DocsRootPath = EditorGUILayout.TextField("DOCS ROOT:", CodeDocsSettings.DocsRootPath);

            // docs root validation
            Color currentColor = GUI.contentColor;
            bool  isValid      = CodeDocsSettings.IsProperRootPath;

            GUI.contentColor = isValid ? Color.green : Color.red;
            EditorGUILayout.LabelField(isValid ? "valid" : "INVALID", GUILayout.Width(50));
            GUI.contentColor = currentColor;

            EditorGUILayout.EndHorizontal();

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(CodeDocsSettings.IsSetFromCode);

            EditorGUILayout.BeginHorizontal();

            // sources path
            CodeDocsSettings.SourcesPath = EditorGUILayout.TextField("SOURCES:", CodeDocsSettings.SourcesPath);

            // sources validation
            currentColor     = GUI.contentColor;
            isValid          = CodeDocsSettings.IsProperSourcesPath;
            GUI.contentColor = isValid ? Color.green : Color.red;
            EditorGUILayout.LabelField(isValid ? "valid" : "INVALID", GUILayout.Width(50));
            GUI.contentColor = currentColor;

            EditorGUILayout.EndHorizontal();

            // sources selection
            if (GUILayout.Button("select", GUILayout.Width(50)))
            {
                CodeDocsSettings.SourcesPath =
                    EditorUtility.OpenFolderPanel("Sources Path", Path.Combine(Application.dataPath, ".."), "");
            }

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.Space();

            if (CodeDocsSettings.IsSetFromCode)
            {
                GUILayout.Label($"Cannot modify settings, it was set from code, find method {nameof(CodeDocsSettings.SetSourcesPath)}");
                if (GUILayout.Button("CLEAR ALL", GUILayout.Width(150)))
                {
                    CodeDocsSettings.ClearConfig();
                }
            }

            EditorGUILayout.EndVertical();
        }