using UnityEditor; using UnityEngine; using UnityEngine.UIElements; using System.Collections.Generic; namespace ProjectExporter { public class ProjectExporterWindow : EditorWindow { private ProjectExporterController _controller; private VisualElement _rootElement; private VisualElement _contentContainer; private Dictionary _assetTrees; private string _currentTab = "Scenes"; [MenuItem("Tools/Project Exporter")] public static void ShowWindow() { ProjectExporterWindow wnd = GetWindow(true, "Project Exporter"); wnd.minSize = new Vector2(400, 300); } private void OnEnable() { _controller = new ProjectExporterController(); _assetTrees = new Dictionary(); _rootElement = rootVisualElement; // Build the UI frame without loading asset data initially BuildUI(); // Trigger the first content refresh RefreshContent(_currentTab); } private void BuildUI() { _rootElement.Clear(); var tabContainer = new VisualElement { style = { flexDirection = FlexDirection.Row } }; tabContainer.Add(ProjectExporterUI.CreateTab("Scenes")); tabContainer.Add(ProjectExporterUI.CreateTab("Prefabs")); tabContainer.Add(ProjectExporterUI.CreateTab("Scriptable Objects")); tabContainer.Add(ProjectExporterUI.CreateTab("Meta Files")); tabContainer.Add(ProjectExporterUI.CreateTab("Settings")); _rootElement.Add(tabContainer); // Create a scrollable container for the main content var scrollView = new ScrollView(ScrollViewMode.Vertical); _rootElement.Add(scrollView); _contentContainer = ProjectExporterUI.CreateMainContainer(); scrollView.Add(_contentContainer); var generateButton = ProjectExporterUI.CreateGenerateButton(); _rootElement.Add(generateButton); generateButton.clicked += () => _controller.ExportAssets(_assetTrees[_currentTab]); var tabs = tabContainer.Query