diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser.meta b/Assets/YooAsset/Editor/AssetBundleReporter.meta similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleBrowser.meta rename to Assets/YooAsset/Editor/AssetBundleReporter.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporter.uxml similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml rename to Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporter.uxml diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml.meta b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporter.uxml.meta similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml.meta rename to Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporter.uxml.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs similarity index 68% rename from Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs rename to Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs index ffbfd71..f2b4fb8 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs @@ -1,7 +1,4 @@ #if UNITY_2019_4_OR_NEWER -using System.IO; -using System.Linq; -using System.Collections.Generic; using UnityEditor; using UnityEngine; using UnityEditor.UIElements; @@ -9,14 +6,14 @@ using UnityEngine.UIElements; namespace YooAsset.Editor { - public class AssetBundleBrowserWindow : EditorWindow + public class AssetBundleReporterWindow : EditorWindow { - [MenuItem("YooAsset/AssetBundle Browser", false, 103)] + [MenuItem("YooAsset/AssetBundle Reporter", false, 103)] public static void ShowExample() { - AssetBundleBrowserWindow wnd = GetWindow(); - wnd.titleContent = new GUIContent("资源包浏览工具"); - wnd.minSize = new Vector2(800, 600); + AssetBundleReporterWindow window = GetWindow(); + window.titleContent = new GUIContent("资源包报告工具"); + window.minSize = new Vector2(800, 600); } /// @@ -36,12 +33,12 @@ namespace YooAsset.Editor } private ToolbarMenu _showModeMenu; - private AssetListBrowserViewer _assetListViewer; - private BundleListBrowserViewer _bundleListViewer; + private AssetListReporterViewer _assetListViewer; + private BundleListReporterViewer _bundleListViewer; private EShowMode _showMode; private string _searchKeyWord; - private PatchManifest _manifest; + private BuildReport _buildReport; public void CreateGUI() @@ -50,11 +47,11 @@ namespace YooAsset.Editor // 加载布局文件 string rootPath = EditorTools.GetYooAssetPath(); - string uxml = $"{rootPath}/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml"; + string uxml = $"{rootPath}/Editor/AssetBundleReporter/AssetBundleReporter.uxml"; var visualAsset = AssetDatabase.LoadAssetAtPath(uxml); if (visualAsset == null) { - Debug.LogError($"Not found AssetBundleBrowser.uxml : {uxml}"); + Debug.LogError($"Not found AssetBundleReporter.uxml : {uxml}"); return; } visualAsset.CloneTree(root); @@ -73,11 +70,11 @@ namespace YooAsset.Editor searchField.RegisterValueChangedCallback(OnSearchKeyWordChange); // 加载页面 - _assetListViewer = new AssetListBrowserViewer(); + _assetListViewer = new AssetListReporterViewer(); _assetListViewer.InitViewer(); // 加载页面 - _bundleListViewer = new BundleListBrowserViewer(); + _bundleListViewer = new BundleListReporterViewer(); _bundleListViewer.InitViewer(); // 初始页面 @@ -88,22 +85,22 @@ namespace YooAsset.Editor private void ImportBtn_onClick() { - string selectFilePath = EditorUtility.OpenFilePanel("导入补丁清单", EditorTools.GetProjectPath(), "bytes"); + string selectFilePath = EditorUtility.OpenFilePanel("导入报告", EditorTools.GetProjectPath(), "json"); if (string.IsNullOrEmpty(selectFilePath)) return; string jsonData = FileUtility.ReadFile(selectFilePath); - _manifest = PatchManifest.Deserialize(jsonData); - _assetListViewer.FillViewData(_manifest, _searchKeyWord); - _bundleListViewer.FillViewData(_manifest, _searchKeyWord); + _buildReport = BuildReport.Deserialize(jsonData); + _assetListViewer.FillViewData(_buildReport, _searchKeyWord); + _bundleListViewer.FillViewData(_buildReport, _searchKeyWord); } private void OnSearchKeyWordChange(ChangeEvent e) { _searchKeyWord = e.newValue; - if(_manifest != null) + if(_buildReport != null) { - _assetListViewer.FillViewData(_manifest, _searchKeyWord); - _bundleListViewer.FillViewData(_manifest, _searchKeyWord); + _assetListViewer.FillViewData(_buildReport, _searchKeyWord); + _bundleListViewer.FillViewData(_buildReport, _searchKeyWord); } } private void ShowModeMenuAction1(DropdownMenuAction action) diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs.meta b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs.meta similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs.meta rename to Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers.meta b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers.meta similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers.meta rename to Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs similarity index 76% rename from Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs rename to Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs index ec58287..866f2c5 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs @@ -9,7 +9,7 @@ using UnityEngine.UIElements; namespace YooAsset.Editor { - internal class AssetListBrowserViewer + internal class AssetListReporterViewer { private VisualTreeAsset _visualAsset; private TemplateContainer _root; @@ -22,7 +22,7 @@ namespace YooAsset.Editor private ToolbarButton _bottomBar3; private ListView _assetListView; private ListView _dependListView; - private PatchManifest _manifest; + private BuildReport _buildReport; /// /// 初始化页面 @@ -31,11 +31,11 @@ namespace YooAsset.Editor { // 加载布局文件 string rootPath = EditorTools.GetYooAssetPath(); - string uxml = $"{rootPath}/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.uxml"; + string uxml = $"{rootPath}/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.uxml"; _visualAsset = AssetDatabase.LoadAssetAtPath(uxml); if (_visualAsset == null) { - Debug.LogError($"Not found {nameof(AssetListBrowserViewer)}.uxml : {uxml}"); + Debug.LogError($"Not found {nameof(AssetListReporterViewer)}.uxml : {uxml}"); return; } _root = _visualAsset.CloneTree(); @@ -73,24 +73,24 @@ namespace YooAsset.Editor /// /// 填充页面数据 /// - public void FillViewData(PatchManifest manifest, string searchKeyWord) + public void FillViewData(BuildReport buildReport, string searchKeyWord) { - _manifest = manifest; + _buildReport = buildReport; _assetListView.Clear(); - _assetListView.itemsSource = FilterViewItems(manifest, searchKeyWord); + _assetListView.itemsSource = FilterViewItems(buildReport, searchKeyWord); _topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})"; } - private List FilterViewItems(PatchManifest manifest, string searchKeyWord) + private List FilterViewItems(BuildReport buildReport, string searchKeyWord) { - List result = new List(manifest.AssetList.Count); - foreach (var patchAsset in manifest.AssetList) + List result = new List(buildReport.AssetInfos.Count); + foreach (var assetInfo in buildReport.AssetInfos) { if(string.IsNullOrEmpty(searchKeyWord) == false) { - if (patchAsset.AssetPath.Contains(searchKeyWord) == false) + if (assetInfo.AssetPath.Contains(searchKeyWord) == false) continue; } - result.Add(patchAsset); + result.Add(assetInfo); } return result; } @@ -152,28 +152,28 @@ namespace YooAsset.Editor } private void BindAssetListViewItem(VisualElement element, int index) { - var sourceData = _assetListView.itemsSource as List; - var patchAsset = sourceData[index]; - var patchBundle = _manifest.BundleList[patchAsset.BundleID]; + var sourceData = _assetListView.itemsSource as List; + var assetInfo = sourceData[index]; + var bundleInfo = _buildReport.GetBundleInfo(assetInfo.MainBundle); // Asset Path var label1 = element.Q