private static bool OpenText(OpenAssetSetting.TextEditor textEditor , string path , int line , int column) { if (textEditor.ChangeSetting) { if (UnityEditorInternal.ScriptEditorUtility.GetExternalScriptEditor() != textEditor.Path) { #if UNITY_2019_1_OR_NEWER CodeEditor.SetExternalScriptEditor(textEditor.Path); #else UnityEditorInternal.ScriptEditorUtility.SetExternalScriptEditor(textEditor.Path); #endif } return(false); } else { Process process = new Process { StartInfo = new ProcessStartInfo { FileName = textEditor.Path, #if UNITY_2019_1_OR_NEWER Arguments = CodeEditor.ParseArgument(textEditor.Arguments, path, line, column), #else Arguments = ParseArgument(textEditor.Arguments, path, line, column), #endif WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, UseShellExecute = true, } }; return(process.Start()); } }
private void DoGUI_TextEditor(OpenAssetSetting.TextEditor textEditor, string label) { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); textEditor.Foldout.Set(EditorGUILayout.Foldout(textEditor.Foldout, label)); EditorGUILayout.EndHorizontal(); if (!textEditor.Foldout) { return; } EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); textEditor.Path.Set(EditorGUILayout.DelayedTextField(label, textEditor.Path)); if (GUILayout.Button("使用当前编辑器", GUILayout.Width(100))) { textEditor.Path.Set(UnityEditorInternal.ScriptEditorUtility.GetExternalScriptEditor()); } EditorGUILayout.EndHorizontal(); textEditor.ChangeSetting.Set(EGLUtility.Toggle("更改Unity设置", textEditor.ChangeSetting)); if (!textEditor.ChangeSetting) { textEditor.Arguments.Set(EditorGUILayout.DelayedTextField("启动参数", textEditor.Arguments)); } EditorGUI.indentLevel--; }