using System; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEditor; using UnityEditor.Build.Reporting; using UnityEngine; using YooAsset; using YooAsset.Editor; public class AdvancedBuildWindow : EditorWindow { private Dictionary _tabs = new(); private int _selectedTab = -1; private string[] _tabLabels; private Vector2 _scrollPosition; private EditorWindowTabBase showTab; public static void ShowWindow() { GetWindow("Build Window", true); } private void CreateGUI() { _tabs.Add("AB包构建", new AssetBundleBuildTab()); _tabs.Add("整包构建", new AppBuildTab()); _tabLabels = _tabs.Keys.ToArray(); } private void OnDisable() { if (showTab != null) { showTab.OnDisable(); } } private void OnGUI() { var selectedTab = GUILayout.Toolbar(_selectedTab, _tabLabels); if (selectedTab != _selectedTab) { _selectedTab = selectedTab; if (showTab != null) { showTab.OnDisable(); } string tabKey = _tabLabels[_selectedTab]; _tabs.TryGetValue(tabKey, out showTab); showTab.OnEnable(); } _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); { if (showTab != null) showTab.OnGUI(); } EditorGUILayout.EndScrollView(); } }