private void OnGUI() { verticalScrollPosition = GUILayout.BeginScrollView(verticalScrollPosition, false, false, GUIStyle.none, GUI.skin.verticalScrollbar); GUILayout.BeginHorizontal(); EditorGUILayout.Space(); GUILayout.BeginVertical(); EditorGUILayout.Space(); EditorGUILayout.HelpBox("一键快速导出可以按一定流程快速地执行多个导出任务。", MessageType.Info); // 全局配置 EditorGUILayout.Space(); { EditorGUILayout.BeginHorizontal(); GUIStyle sceneStyle = new GUIStyle(EditorStyles.foldout); sceneStyle.fixedWidth = 10; expandGlobalConfig = EditorGUILayout.Foldout(expandGlobalConfig, "==== 全局配置", true, sceneStyle); GUILayout.Label("", GUILayout.ExpandWidth(true)); EditorGUILayout.EndHorizontal(); if (expandGlobalConfig) { EditorGUI.indentLevel++; globalConfigEditor.OnInspectorGUI(); EditorGUI.indentLevel--; } } // 插件 EditorGUILayout.Space(); int PluginCodeFold = EditorHelper.FoldableTitleline("导出插件代码", expandPluginCodeConfig, checkPluginCodeConfig); expandPluginCodeConfig = (PluginCodeFold & 0x10) == 0x10; checkPluginCodeConfig = (PluginCodeFold & 0x1) == 0x1; if (expandPluginCodeConfig) { EditorGUI.indentLevel++; unityPluginConfigEditor.OnInspectorGUI(); EditorGUI.indentLevel--; } // 工程 EditorGUILayout.Space(); int PluginProjectFold = EditorHelper.FoldableTitleline("导出工程代码", expandProjectCodeConfig, checkProjectCodeConfig); expandProjectCodeConfig = (PluginProjectFold & 0x10) == 0x10; checkProjectCodeConfig = (PluginProjectFold & 0x1) == 0x1; if (expandProjectCodeConfig) { EditorGUI.indentLevel++; // globalConfigEditor.OnInspectorGUI(); projectScriptExportConfigEditor.OnInspectorGUI(); EditorGUI.indentLevel--; } // 场景 EditorGUILayout.Space(); int sceneFold = EditorHelper.FoldableTitleline("导出所有场景", expandSceneConfig, checkSceneConfig); expandSceneConfig = (sceneFold & 0x10) == 0x10; checkSceneConfig = (sceneFold & 0x1) == 0x1; if (expandSceneConfig) { EditorGUI.indentLevel++; hierarchyExportConfigEditor.OnInspectorGUI(); sceneExportEditor.OnInspectorGUI(); EditorGUI.indentLevel--; } // prefab EditorGUILayout.Space(); int prefabFold = EditorHelper.FoldableTitleline("导出目录下的 prefab", expandPrefabConfig, checkPrefabConfig); expandPrefabConfig = (prefabFold & 0x10) == 0x10; checkPrefabConfig = (prefabFold & 0x1) == 0x1; if (expandPrefabConfig) { EditorGUI.indentLevel++; directoryExportEditor.OnInspectorGUI(); EditorGUI.indentLevel--; } // 原始资源 EditorGUILayout.Space(); int rawFold = EditorHelper.FoldableTitleline("导出原始资源", expandRawResourceConfig, checkRawResourceConfig); expandRawResourceConfig = (rawFold & 0x10) == 0x10; checkRawResourceConfig = (rawFold & 0x1) == 0x1; if (expandRawResourceConfig) { EditorGUI.indentLevel++; rawResourceExportConfigEditor.OnInspectorGUI(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); EditorGUILayout.Space(); GUIStyle exportButtonStyle = new GUIStyle(GUI.skin.button); exportButtonStyle.fontSize = 14; var isExportBtnPressed = GUILayout.Button("导出", exportButtonStyle, GUILayout.Height(40), GUILayout.Width(EditorGUIUtility.currentViewWidth - 20)); GUILayout.EndVertical(); EditorGUILayout.Space(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.EndScrollView(); if (isExportBtnPressed) { if (checkPluginCodeConfig) { Debug.Log("导出插件代码..."); ExportPreset.GetExportPreset("plugins-script").Export(); } if (checkProjectCodeConfig) { Debug.Log("导出工程代码..."); ExportPreset.GetExportPreset("project-script").Export(); } if (checkSceneConfig) { Debug.Log("导出全部游戏场景..."); ExportAllScenes(); } if (checkPrefabConfig) { Debug.Log("导出资源文件夹..."); ExportAllResourcesDirectories(); } if (checkRawResourceConfig) { Debug.Log("导出裸资源文件..."); ExportPreset.GetExportPreset("rawres").Export(); } } }