private void OnDrawCollector() { // 列表显示 EditorGUILayout.Space(); EditorGUILayout.LabelField($"[ Collector ]"); for (int i = 0; i < AssetBundleCollectorSettingData.Setting.Collectors.Count; i++) { var collector = AssetBundleCollectorSettingData.Setting.Collectors[i]; string directory = collector.CollectDirectory; string labelClassName = collector.LabelClassName; string filterClassName = collector.FilterClassName; EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(directory); // 标签类 { int index = LabelClassNameToIndex(labelClassName); int newIndex = EditorGUILayout.Popup(index, _labelClassArray, GUILayout.MaxWidth(150)); if (newIndex != index) { labelClassName = IndexToLabelClassName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, labelClassName, filterClassName); } } // 过滤类 { int index = FilterClassNameToIndex(filterClassName); int newIndex = EditorGUILayout.Popup(index, _filterClassArray, GUILayout.MaxWidth(150)); if (newIndex != index) { filterClassName = IndexToFilterClassName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, labelClassName, filterClassName); } } if (GUILayout.Button("-", GUILayout.MaxWidth(40))) { AssetBundleCollectorSettingData.RemoveCollector(directory); break; } } EditorGUILayout.EndHorizontal(); } // 添加按钮 if (GUILayout.Button("+")) { string resultPath = EditorTools.OpenFolderPanel("Select Folder", _lastOpenFolderPath); if (resultPath != null) { _lastOpenFolderPath = EditorTools.AbsolutePathToAssetPath(resultPath); AssetBundleCollectorSettingData.AddCollector(_lastOpenFolderPath); } } }
private void OnDrawElement() { // 列表显示 EditorGUILayout.Space(); EditorGUILayout.LabelField($"Collector"); for (int i = 0; i < AssetBundleCollectorSettingData.Setting.Collectors.Count; i++) { string directory = AssetBundleCollectorSettingData.Setting.Collectors[i].CollectDirectory; AssetBundleCollectorSetting.ECollectRule packRule = AssetBundleCollectorSettingData.Setting.Collectors[i].CollectRule; string collectorName = AssetBundleCollectorSettingData.Setting.Collectors[i].CollectorName; EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(directory); AssetBundleCollectorSetting.ECollectRule newPackRule = (AssetBundleCollectorSetting.ECollectRule)EditorGUILayout.EnumPopup(packRule, GUILayout.MaxWidth(150)); if (newPackRule != packRule) { packRule = newPackRule; AssetBundleCollectorSettingData.ModifyCollector(directory, packRule, collectorName); } int index = NameToIndex(collectorName); int newIndex = EditorGUILayout.Popup(index, _collectorClassArray, GUILayout.MaxWidth(150)); if (newIndex != index) { string newCollectorName = IndexToName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, packRule, newCollectorName); } if (GUILayout.Button("-", GUILayout.MaxWidth(40))) { AssetBundleCollectorSettingData.RemoveCollector(directory); break; } } EditorGUILayout.EndHorizontal(); } // 添加按钮 if (GUILayout.Button("+")) { string resultPath = EditorTools.OpenFolderPanel("Select Folder", _lastOpenFolderPath); if (resultPath != null) { _lastOpenFolderPath = EditorTools.AbsolutePathToAssetPath(resultPath); AssetBundleCollectorSettingData.AddCollector(_lastOpenFolderPath); } } }
private void OnDrawCollector() { // 着色器选项 EditorGUILayout.Space(); bool isCollectAllShader = EditorGUILayout.Toggle("收集所有着色器", AssetBundleCollectorSettingData.Setting.IsCollectAllShaders); if (isCollectAllShader != AssetBundleCollectorSettingData.Setting.IsCollectAllShaders) { AssetBundleCollectorSettingData.ModifyShader(isCollectAllShader, AssetBundleCollectorSettingData.Setting.ShadersBundleName); } if (isCollectAllShader) { string shadersBundleName = EditorGUILayout.TextField("AssetBundle名称", AssetBundleCollectorSettingData.Setting.ShadersBundleName); if (shadersBundleName != AssetBundleCollectorSettingData.Setting.ShadersBundleName) { AssetBundleCollectorSettingData.ModifyShader(isCollectAllShader, shadersBundleName); } } // 列表显示 EditorGUILayout.Space(); EditorGUILayout.LabelField($"[ Collector ]"); _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); for (int i = 0; i < AssetBundleCollectorSettingData.Setting.Collectors.Count; i++) { var collector = AssetBundleCollectorSettingData.Setting.Collectors[i]; string directory = collector.CollectDirectory; string packRuleClassName = collector.PackRuleClassName; string filterRuleClassName = collector.FilterRuleClassName; EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(directory); // IPackRule { int index = PackRuleClassNameToIndex(packRuleClassName); int newIndex = EditorGUILayout.Popup(index, _packRuleClassArray, GUILayout.MaxWidth(200)); if (newIndex != index) { packRuleClassName = IndexToPackRuleClassName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, packRuleClassName, filterRuleClassName); } } // IFilterRule { int index = FilterRuleClassNameToIndex(filterRuleClassName); int newIndex = EditorGUILayout.Popup(index, _filterRuleClassArray, GUILayout.MaxWidth(150)); if (newIndex != index) { filterRuleClassName = IndexToFilterRuleClassName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, packRuleClassName, filterRuleClassName); } } if (GUILayout.Button("-", GUILayout.MaxWidth(40))) { AssetBundleCollectorSettingData.RemoveCollector(directory); break; } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); // 添加按钮 if (GUILayout.Button("+")) { string resultPath = EditorTools.OpenFolderPanel("Select Folder", _lastOpenFolderPath); if (resultPath != null) { _lastOpenFolderPath = EditorTools.AbsolutePathToAssetPath(resultPath); string defaultPackRuleClassName = nameof(PackExplicit); string defaultFilterRuleClassName = nameof(CollectAll); AssetBundleCollectorSettingData.AddCollector(_lastOpenFolderPath, defaultPackRuleClassName, defaultFilterRuleClassName); } } // 导入配置按钮 if (GUILayout.Button("Import Config")) { string resultPath = EditorTools.OpenFilePath("Select Folder", _lastOpenFolderPath); if (resultPath != null) { CollectorConfigImporter.ImportXmlConfig(resultPath); } } }
private void OnDrawCollector() { // 列表显示 EditorGUILayout.Space(); _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); for (int i = 0; i < AssetBundleCollectorSettingData.Setting.Collectors.Count; i++) { var collector = AssetBundleCollectorSettingData.Setting.Collectors[i]; string directory = collector.CollectDirectory; string packRuleName = collector.PackRuleName; string filterRuleName = collector.FilterRuleName; bool dontWriteAssetPath = collector.DontWriteAssetPath; string assetTags = collector.AssetTags; EditorGUILayout.BeginHorizontal(); { // Directory EditorGUILayout.LabelField(directory, GUILayout.MinWidth(GuiDirecotryMinSize), GUILayout.MaxWidth(GuiDirecotryMaxSize)); // IPackRule { int index = PackRuleNameToIndex(packRuleName); int newIndex = EditorGUILayout.Popup(index, _packRuleArray, GUILayout.MinWidth(GuiPackRuleSize), GUILayout.MaxWidth(GuiPackRuleSize)); if (newIndex != index) { packRuleName = IndexToPackRuleName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, packRuleName, filterRuleName, dontWriteAssetPath, assetTags); } } // IFilterRule { int index = FilterRuleNameToIndex(filterRuleName); int newIndex = EditorGUILayout.Popup(index, _filterRuleArray, GUILayout.MinWidth(GuiFilterRuleSize), GUILayout.MaxWidth(GuiFilterRuleSize)); if (newIndex != index) { filterRuleName = IndexToFilterRuleName(newIndex); AssetBundleCollectorSettingData.ModifyCollector(directory, packRuleName, filterRuleName, dontWriteAssetPath, assetTags); } } // DontWriteAssetPath { bool newToggleValue = EditorGUILayout.Toggle(dontWriteAssetPath, GUILayout.MinWidth(GuiDontWriteAssetPathSize), GUILayout.MaxWidth(GuiDontWriteAssetPathSize)); if (newToggleValue != dontWriteAssetPath) { dontWriteAssetPath = newToggleValue; AssetBundleCollectorSettingData.ModifyCollector(directory, packRuleName, filterRuleName, dontWriteAssetPath, assetTags); } } // AssetTags { string newTextValue = EditorGUILayout.TextField(assetTags, GUILayout.MinWidth(GuiAssetTagsMinSize), GUILayout.MaxWidth(GuiAssetTagsMaxSize)); if (newTextValue != assetTags) { assetTags = newTextValue; AssetBundleCollectorSettingData.ModifyCollector(directory, packRuleName, filterRuleName, dontWriteAssetPath, assetTags); } } if (GUILayout.Button("-", GUILayout.MinWidth(GuiBtnSize), GUILayout.MaxWidth(GuiBtnSize))) { AssetBundleCollectorSettingData.RemoveCollector(directory); break; } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); // 添加按钮 if (GUILayout.Button("+")) { string resultPath = EditorTools.OpenFolderPanel("Select Folder", _lastOpenFolderPath); if (resultPath != null) { _lastOpenFolderPath = EditorTools.AbsolutePathToAssetPath(resultPath); string defaultPackRuleName = nameof(PackExplicit); string defaultFilterRuleName = nameof(CollectAll); bool defaultDontWriteAssetPathValue = false; string defaultAssetTag = string.Empty; AssetBundleCollectorSettingData.AddCollector(_lastOpenFolderPath, defaultPackRuleName, defaultFilterRuleName, defaultDontWriteAssetPathValue, defaultAssetTag); } } // 导入配置按钮 if (GUILayout.Button("Import Config")) { string resultPath = EditorTools.OpenFilePath("Select File", "Assets/", "xml"); if (resultPath != null) { CollectorConfigImporter.ImportXmlConfig(resultPath); } } }