#if UNITY_2019_4_OR_NEWER using System.IO; using System.Linq; using System.Collections.Generic; using UnityEditor; using UnityEngine; using UnityEditor.UIElements; using UnityEngine.UIElements; namespace YooAsset.Editor { public class AssetBundleCollectorWindow : EditorWindow { [MenuItem("YooAsset/AssetBundle Collector", false, 101)] public static void OpenWindow() { AssetBundleCollectorWindow window = GetWindow("资源包收集工具", true, WindowsDefine.DockedWindowTypes); window.minSize = new Vector2(800, 600); } private Button _saveButton; private List _collectorTypeList; private List _activeRuleList; private List _addressRuleList; private List _packRuleList; private List _filterRuleList; private Button _settingsButton; private VisualElement _setting1Container; private VisualElement _setting2Container; private Toggle _showPackageToogle; private Toggle _enableAddressableToogle; private Toggle _locationToLowerToogle; private Toggle _includeAssetGUIDToogle; private Toggle _uniqueBundleNameToogle; private Toggle _showEditorAliasToggle; private VisualElement _packageContainer; private ListView _packageListView; private TextField _packageNameTxt; private TextField _packageDescTxt; private VisualElement _groupContainer; private ListView _groupListView; private TextField _groupNameTxt; private TextField _groupDescTxt; private TextField _groupAssetTagsTxt; private VisualElement _collectorContainer; private ScrollView _collectorScrollView; private PopupField _activeRulePopupField; private int _lastModifyPackageIndex = 0; private int _lastModifyGroupIndex = 0; private bool _showSettings = false; public void CreateGUI() { Undo.undoRedoPerformed -= RefreshWindow; Undo.undoRedoPerformed += RefreshWindow; try { _collectorTypeList = new List() { $"{nameof(ECollectorType.MainAssetCollector)}", $"{nameof(ECollectorType.StaticAssetCollector)}", $"{nameof(ECollectorType.DependAssetCollector)}" }; _activeRuleList = AssetBundleCollectorSettingData.GetActiveRuleNames(); _addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames(); _packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames(); _filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames(); VisualElement root = this.rootVisualElement; // 加载布局文件 var visualAsset = UxmlLoader.LoadWindowUXML(); if (visualAsset == null) return; visualAsset.CloneTree(root); // 公共设置相关 _settingsButton = root.Q