diff --git a/Assets/YooAsset/Editor/AssetArtReporter.meta b/Assets/YooAsset/Editor/AssetArtReporter.meta new file mode 100644 index 00000000..152a582c --- /dev/null +++ b/Assets/YooAsset/Editor/AssetArtReporter.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bdbb4647038dcc842802f546c2fedc83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Editor/AssetArtReporter/AssetArtReporterWindow.cs b/Assets/YooAsset/Editor/AssetArtReporter/AssetArtReporterWindow.cs new file mode 100644 index 00000000..7ac77b5a --- /dev/null +++ b/Assets/YooAsset/Editor/AssetArtReporter/AssetArtReporterWindow.cs @@ -0,0 +1,577 @@ +#if UNITY_2019_4_OR_NEWER +using System; +using System.IO; +using System.Linq; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEditor.UIElements; +using UnityEngine.UIElements; +using UnityEngine.Tilemaps; + +namespace YooAsset.Editor +{ + public class AssetArtReporterWindow : EditorWindow + { + [MenuItem("YooAsset/AssetArt Reporter", false, 302)] + public static AssetArtReporterWindow OpenWindow() + { + AssetArtReporterWindow window = GetWindow("资源扫描报告", true, WindowsDefine.DockedWindowTypes); + window.minSize = new Vector2(800, 600); + return window; + } + + private class ElementTableData : DefaultTableData + { + public ReportElement Element; + } + private class PassesBtnCell : ITableCell, IComparable + { + public object CellValue { set; get; } + public string SearchTag { private set; get; } + public ReportElement Element + { + get + { + return (ReportElement)CellValue; + } + } + + public PassesBtnCell(string searchTag, ReportElement element) + { + SearchTag = searchTag; + CellValue = element; + } + public object GetDisplayObject() + { + return string.Empty; + } + public int CompareTo(object other) + { + if (other is PassesBtnCell cell) + { + return this.Element.Passes.CompareTo(cell.Element.Passes); + } + else + { + return 0; + } + } + } + private class WhiteListBtnCell : ITableCell, IComparable + { + public object CellValue { set; get; } + public string SearchTag { private set; get; } + public ReportElement Element + { + get + { + return (ReportElement)CellValue; + } + } + + public WhiteListBtnCell(string searchTag, ReportElement element) + { + SearchTag = searchTag; + CellValue = element; + } + public object GetDisplayObject() + { + return string.Empty; + } + public int CompareTo(object other) + { + if (other is PassesBtnCell cell) + { + return this.Element.IsWhiteList.CompareTo(cell.Element.IsWhiteList); + } + else + { + return 0; + } + } + } + + private ToolbarSearchField _searchField; + private Button _whiteVisibleBtn; + private Button _stateVisibleBtn; + private Label _titleLabel; + private Label _descLabel; + private TableView _elementTableView; + + private ScanReportCombiner _reportCombiner; + private string _lastestOpenFolder; + private List _sourceDatas; + private bool _showWhiteElements = true; + private bool _showPassesElements = true; + + + public void CreateGUI() + { + try + { + VisualElement root = this.rootVisualElement; + + // 加载布局文件 + var visualAsset = UxmlLoader.LoadWindowUXML(); + if (visualAsset == null) + return; + + visualAsset.CloneTree(root); + + // 导入按钮 + var singleImportBtn = root.Q