Update AssetBundleReporter
parent
233e477bc8
commit
8ee06ccf76
|
@ -1,7 +1,4 @@
|
||||||
#if UNITY_2019_4_OR_NEWER
|
#if UNITY_2019_4_OR_NEWER
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor.UIElements;
|
using UnityEditor.UIElements;
|
||||||
|
@ -9,14 +6,14 @@ using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
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()
|
public static void ShowExample()
|
||||||
{
|
{
|
||||||
AssetBundleBrowserWindow wnd = GetWindow<AssetBundleBrowserWindow>();
|
AssetBundleReporterWindow window = GetWindow<AssetBundleReporterWindow>();
|
||||||
wnd.titleContent = new GUIContent("资源包浏览工具");
|
window.titleContent = new GUIContent("资源包报告工具");
|
||||||
wnd.minSize = new Vector2(800, 600);
|
window.minSize = new Vector2(800, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -36,12 +33,12 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToolbarMenu _showModeMenu;
|
private ToolbarMenu _showModeMenu;
|
||||||
private AssetListBrowserViewer _assetListViewer;
|
private AssetListReporterViewer _assetListViewer;
|
||||||
private BundleListBrowserViewer _bundleListViewer;
|
private BundleListReporterViewer _bundleListViewer;
|
||||||
|
|
||||||
private EShowMode _showMode;
|
private EShowMode _showMode;
|
||||||
private string _searchKeyWord;
|
private string _searchKeyWord;
|
||||||
private PatchManifest _manifest;
|
private BuildReport _buildReport;
|
||||||
|
|
||||||
|
|
||||||
public void CreateGUI()
|
public void CreateGUI()
|
||||||
|
@ -50,11 +47,11 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 加载布局文件
|
// 加载布局文件
|
||||||
string rootPath = EditorTools.GetYooAssetPath();
|
string rootPath = EditorTools.GetYooAssetPath();
|
||||||
string uxml = $"{rootPath}/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml";
|
string uxml = $"{rootPath}/Editor/AssetBundleReporter/AssetBundleReporter.uxml";
|
||||||
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||||
if (visualAsset == null)
|
if (visualAsset == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"Not found AssetBundleBrowser.uxml : {uxml}");
|
Debug.LogError($"Not found AssetBundleReporter.uxml : {uxml}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
visualAsset.CloneTree(root);
|
visualAsset.CloneTree(root);
|
||||||
|
@ -73,11 +70,11 @@ namespace YooAsset.Editor
|
||||||
searchField.RegisterValueChangedCallback(OnSearchKeyWordChange);
|
searchField.RegisterValueChangedCallback(OnSearchKeyWordChange);
|
||||||
|
|
||||||
// 加载页面
|
// 加载页面
|
||||||
_assetListViewer = new AssetListBrowserViewer();
|
_assetListViewer = new AssetListReporterViewer();
|
||||||
_assetListViewer.InitViewer();
|
_assetListViewer.InitViewer();
|
||||||
|
|
||||||
// 加载页面
|
// 加载页面
|
||||||
_bundleListViewer = new BundleListBrowserViewer();
|
_bundleListViewer = new BundleListReporterViewer();
|
||||||
_bundleListViewer.InitViewer();
|
_bundleListViewer.InitViewer();
|
||||||
|
|
||||||
// 初始页面
|
// 初始页面
|
||||||
|
@ -88,22 +85,22 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
private void ImportBtn_onClick()
|
private void ImportBtn_onClick()
|
||||||
{
|
{
|
||||||
string selectFilePath = EditorUtility.OpenFilePanel("导入补丁清单", EditorTools.GetProjectPath(), "bytes");
|
string selectFilePath = EditorUtility.OpenFilePanel("导入报告", EditorTools.GetProjectPath(), "json");
|
||||||
if (string.IsNullOrEmpty(selectFilePath))
|
if (string.IsNullOrEmpty(selectFilePath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string jsonData = FileUtility.ReadFile(selectFilePath);
|
string jsonData = FileUtility.ReadFile(selectFilePath);
|
||||||
_manifest = PatchManifest.Deserialize(jsonData);
|
_buildReport = BuildReport.Deserialize(jsonData);
|
||||||
_assetListViewer.FillViewData(_manifest, _searchKeyWord);
|
_assetListViewer.FillViewData(_buildReport, _searchKeyWord);
|
||||||
_bundleListViewer.FillViewData(_manifest, _searchKeyWord);
|
_bundleListViewer.FillViewData(_buildReport, _searchKeyWord);
|
||||||
}
|
}
|
||||||
private void OnSearchKeyWordChange(ChangeEvent<string> e)
|
private void OnSearchKeyWordChange(ChangeEvent<string> e)
|
||||||
{
|
{
|
||||||
_searchKeyWord = e.newValue;
|
_searchKeyWord = e.newValue;
|
||||||
if(_manifest != null)
|
if(_buildReport != null)
|
||||||
{
|
{
|
||||||
_assetListViewer.FillViewData(_manifest, _searchKeyWord);
|
_assetListViewer.FillViewData(_buildReport, _searchKeyWord);
|
||||||
_bundleListViewer.FillViewData(_manifest, _searchKeyWord);
|
_bundleListViewer.FillViewData(_buildReport, _searchKeyWord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ShowModeMenuAction1(DropdownMenuAction action)
|
private void ShowModeMenuAction1(DropdownMenuAction action)
|
|
@ -9,7 +9,7 @@ using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
internal class AssetListBrowserViewer
|
internal class AssetListReporterViewer
|
||||||
{
|
{
|
||||||
private VisualTreeAsset _visualAsset;
|
private VisualTreeAsset _visualAsset;
|
||||||
private TemplateContainer _root;
|
private TemplateContainer _root;
|
||||||
|
@ -22,7 +22,7 @@ namespace YooAsset.Editor
|
||||||
private ToolbarButton _bottomBar3;
|
private ToolbarButton _bottomBar3;
|
||||||
private ListView _assetListView;
|
private ListView _assetListView;
|
||||||
private ListView _dependListView;
|
private ListView _dependListView;
|
||||||
private PatchManifest _manifest;
|
private BuildReport _buildReport;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化页面
|
/// 初始化页面
|
||||||
|
@ -31,11 +31,11 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
// 加载布局文件
|
// 加载布局文件
|
||||||
string rootPath = EditorTools.GetYooAssetPath();
|
string rootPath = EditorTools.GetYooAssetPath();
|
||||||
string uxml = $"{rootPath}/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.uxml";
|
string uxml = $"{rootPath}/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.uxml";
|
||||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||||
if (_visualAsset == null)
|
if (_visualAsset == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"Not found {nameof(AssetListBrowserViewer)}.uxml : {uxml}");
|
Debug.LogError($"Not found {nameof(AssetListReporterViewer)}.uxml : {uxml}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_root = _visualAsset.CloneTree();
|
_root = _visualAsset.CloneTree();
|
||||||
|
@ -73,24 +73,24 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 填充页面数据
|
/// 填充页面数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void FillViewData(PatchManifest manifest, string searchKeyWord)
|
public void FillViewData(BuildReport buildReport, string searchKeyWord)
|
||||||
{
|
{
|
||||||
_manifest = manifest;
|
_buildReport = buildReport;
|
||||||
_assetListView.Clear();
|
_assetListView.Clear();
|
||||||
_assetListView.itemsSource = FilterViewItems(manifest, searchKeyWord);
|
_assetListView.itemsSource = FilterViewItems(buildReport, searchKeyWord);
|
||||||
_topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})";
|
_topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})";
|
||||||
}
|
}
|
||||||
private List<PatchAsset> FilterViewItems(PatchManifest manifest, string searchKeyWord)
|
private List<ReportAssetInfo> FilterViewItems(BuildReport buildReport, string searchKeyWord)
|
||||||
{
|
{
|
||||||
List<PatchAsset> result = new List<PatchAsset>(manifest.AssetList.Count);
|
List<ReportAssetInfo> result = new List<ReportAssetInfo>(buildReport.AssetInfos.Count);
|
||||||
foreach (var patchAsset in manifest.AssetList)
|
foreach (var assetInfo in buildReport.AssetInfos)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(searchKeyWord) == false)
|
if(string.IsNullOrEmpty(searchKeyWord) == false)
|
||||||
{
|
{
|
||||||
if (patchAsset.AssetPath.Contains(searchKeyWord) == false)
|
if (assetInfo.AssetPath.Contains(searchKeyWord) == false)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.Add(patchAsset);
|
result.Add(assetInfo);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -152,28 +152,28 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private void BindAssetListViewItem(VisualElement element, int index)
|
private void BindAssetListViewItem(VisualElement element, int index)
|
||||||
{
|
{
|
||||||
var sourceData = _assetListView.itemsSource as List<PatchAsset>;
|
var sourceData = _assetListView.itemsSource as List<ReportAssetInfo>;
|
||||||
var patchAsset = sourceData[index];
|
var assetInfo = sourceData[index];
|
||||||
var patchBundle = _manifest.BundleList[patchAsset.BundleID];
|
var bundleInfo = _buildReport.GetBundleInfo(assetInfo.MainBundle);
|
||||||
|
|
||||||
// Asset Path
|
// Asset Path
|
||||||
var label1 = element.Q<Label>("Label1");
|
var label1 = element.Q<Label>("Label1");
|
||||||
label1.text = patchAsset.AssetPath;
|
label1.text = assetInfo.AssetPath;
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
var label2 = element.Q<Label>("Label2");
|
var label2 = element.Q<Label>("Label2");
|
||||||
label2.text = GetAssetFileSize(patchAsset.AssetPath);
|
label2.text = GetAssetFileSize(assetInfo.AssetPath);
|
||||||
|
|
||||||
// Main Bundle
|
// Main Bundle
|
||||||
var label3 = element.Q<Label>("Label3");
|
var label3 = element.Q<Label>("Label3");
|
||||||
label3.text = patchBundle.BundleName;
|
label3.text = bundleInfo.BundleName;
|
||||||
}
|
}
|
||||||
private void AssetListView_onSelectionChange(IEnumerable<object> objs)
|
private void AssetListView_onSelectionChange(IEnumerable<object> objs)
|
||||||
{
|
{
|
||||||
foreach (var item in objs)
|
foreach (var item in objs)
|
||||||
{
|
{
|
||||||
PatchAsset patchAsset = item as PatchAsset;
|
ReportAssetInfo assetInfo = item as ReportAssetInfo;
|
||||||
FillDependListView(patchAsset);
|
FillDependListView(assetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void TopBar1_clicked()
|
private void TopBar1_clicked()
|
||||||
|
@ -187,6 +187,24 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
// 依赖列表相关
|
// 依赖列表相关
|
||||||
|
private void FillDependListView(ReportAssetInfo assetInfo)
|
||||||
|
{
|
||||||
|
List<ReportBundleInfo> bundles = new List<ReportBundleInfo>();
|
||||||
|
var mainBundle = _buildReport.GetBundleInfo(assetInfo.MainBundle);
|
||||||
|
bundles.Add(mainBundle);
|
||||||
|
foreach(string dependBundleName in assetInfo.DependBundles)
|
||||||
|
{
|
||||||
|
var dependBundle = _buildReport.GetBundleInfo(dependBundleName);
|
||||||
|
bundles.Add(dependBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
_dependListView.Clear();
|
||||||
|
#if UNITY_2020_1_OR_NEWER
|
||||||
|
_dependListView.ClearSelection();
|
||||||
|
#endif
|
||||||
|
_dependListView.itemsSource = bundles;
|
||||||
|
_bottomBar1.text = $"Depend Bundles ({bundles.Count})";
|
||||||
|
}
|
||||||
private VisualElement MakeDependListViewItem()
|
private VisualElement MakeDependListViewItem()
|
||||||
{
|
{
|
||||||
VisualElement element = new VisualElement();
|
VisualElement element = new VisualElement();
|
||||||
|
@ -226,39 +244,20 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private void BindDependListViewItem(VisualElement element, int index)
|
private void BindDependListViewItem(VisualElement element, int index)
|
||||||
{
|
{
|
||||||
List<PatchBundle> bundles = _dependListView.itemsSource as List<PatchBundle>;
|
List<ReportBundleInfo> bundles = _dependListView.itemsSource as List<ReportBundleInfo>;
|
||||||
PatchBundle patchBundle = bundles[index];
|
ReportBundleInfo bundleInfo = bundles[index];
|
||||||
|
|
||||||
// Bundle Name
|
// Bundle Name
|
||||||
var label1 = element.Q<Label>("Label1");
|
var label1 = element.Q<Label>("Label1");
|
||||||
label1.text = patchBundle.BundleName;
|
label1.text = bundleInfo.BundleName;
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
var label2 = element.Q<Label>("Label2");
|
var label2 = element.Q<Label>("Label2");
|
||||||
label2.text = (patchBundle.SizeBytes / 1024f).ToString("f1") + " KB";
|
label2.text = (bundleInfo.SizeBytes / 1024f).ToString("f1") + " KB";
|
||||||
|
|
||||||
// Hash
|
// Hash
|
||||||
var label3 = element.Q<Label>("Label3");
|
var label3 = element.Q<Label>("Label3");
|
||||||
label3.text = patchBundle.Hash;
|
label3.text = bundleInfo.Hash;
|
||||||
}
|
|
||||||
private void FillDependListView(PatchAsset patchAsset)
|
|
||||||
{
|
|
||||||
List<PatchBundle> bundles = new List<PatchBundle>();
|
|
||||||
var mainBundle = _manifest.BundleList[patchAsset.BundleID];
|
|
||||||
bundles.Add(mainBundle);
|
|
||||||
for (int i = 0; i < patchAsset.DependIDs.Length; i++)
|
|
||||||
{
|
|
||||||
int bundleID = patchAsset.DependIDs[i];
|
|
||||||
var dependBundle = _manifest.BundleList[bundleID];
|
|
||||||
bundles.Add(dependBundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
_dependListView.Clear();
|
|
||||||
#if UNITY_2020_1_OR_NEWER
|
|
||||||
_dependListView.ClearSelection();
|
|
||||||
#endif
|
|
||||||
_dependListView.itemsSource = bundles;
|
|
||||||
_bottomBar1.text = $"Depend Bundles ({bundles.Count})";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetAssetFileSize(string assetPath)
|
private string GetAssetFileSize(string assetPath)
|
|
@ -9,7 +9,7 @@ using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
internal class BundleListBrowserViewer
|
internal class BundleListReporterViewer
|
||||||
{
|
{
|
||||||
private VisualTreeAsset _visualAsset;
|
private VisualTreeAsset _visualAsset;
|
||||||
private TemplateContainer _root;
|
private TemplateContainer _root;
|
||||||
|
@ -24,7 +24,7 @@ namespace YooAsset.Editor
|
||||||
private ToolbarButton _bottomBar3;
|
private ToolbarButton _bottomBar3;
|
||||||
private ListView _bundleListView;
|
private ListView _bundleListView;
|
||||||
private ListView _includeListView;
|
private ListView _includeListView;
|
||||||
private PatchManifest _manifest;
|
private BuildReport _buildReport;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化页面
|
/// 初始化页面
|
||||||
|
@ -33,11 +33,11 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
// 加载布局文件
|
// 加载布局文件
|
||||||
string rootPath = EditorTools.GetYooAssetPath();
|
string rootPath = EditorTools.GetYooAssetPath();
|
||||||
string uxml = $"{rootPath}/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.uxml";
|
string uxml = $"{rootPath}/Editor/AssetBundleReporter/VisualViewers/BundleListReporterViewer.uxml";
|
||||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||||
if (_visualAsset == null)
|
if (_visualAsset == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"Not found {nameof(BundleListBrowserViewer)}.uxml : {uxml}");
|
Debug.LogError($"Not found {nameof(BundleListReporterViewer)}.uxml : {uxml}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_root = _visualAsset.CloneTree();
|
_root = _visualAsset.CloneTree();
|
||||||
|
@ -74,24 +74,24 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 填充页面数据
|
/// 填充页面数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void FillViewData(PatchManifest manifest, string searchKeyWord)
|
public void FillViewData(BuildReport buildReport, string searchKeyWord)
|
||||||
{
|
{
|
||||||
_manifest = manifest;
|
_buildReport = buildReport;
|
||||||
_bundleListView.Clear();
|
_bundleListView.Clear();
|
||||||
_bundleListView.itemsSource = FilterViewItems(manifest, searchKeyWord);
|
_bundleListView.itemsSource = FilterViewItems(buildReport, searchKeyWord);
|
||||||
_topBar1.text = $"Bundle Name ({_bundleListView.itemsSource.Count})";
|
_topBar1.text = $"Bundle Name ({_bundleListView.itemsSource.Count})";
|
||||||
}
|
}
|
||||||
private List<PatchBundle> FilterViewItems(PatchManifest manifest, string searchKeyWord)
|
private List<ReportBundleInfo> FilterViewItems(BuildReport buildReport, string searchKeyWord)
|
||||||
{
|
{
|
||||||
List<PatchBundle> result = new List<PatchBundle>(manifest.BundleList.Count);
|
List<ReportBundleInfo> result = new List<ReportBundleInfo>(buildReport.BundleInfos.Count);
|
||||||
foreach (var patchBundle in manifest.BundleList)
|
foreach (var bundleInfo in buildReport.BundleInfos)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(searchKeyWord) == false)
|
if (string.IsNullOrEmpty(searchKeyWord) == false)
|
||||||
{
|
{
|
||||||
if (patchBundle.BundleName.Contains(searchKeyWord) == false)
|
if (bundleInfo.BundleName.Contains(searchKeyWord) == false)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.Add(patchBundle);
|
result.Add(bundleInfo);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -173,39 +173,55 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private void BindBundleListViewItem(VisualElement element, int index)
|
private void BindBundleListViewItem(VisualElement element, int index)
|
||||||
{
|
{
|
||||||
var sourceData = _bundleListView.itemsSource as List<PatchBundle>;
|
var sourceData = _bundleListView.itemsSource as List<ReportBundleInfo>;
|
||||||
var patchBundle = sourceData[index];
|
var bundleInfo = sourceData[index];
|
||||||
|
|
||||||
// Bundle Name
|
// Bundle Name
|
||||||
var label1 = element.Q<Label>("Label1");
|
var label1 = element.Q<Label>("Label1");
|
||||||
label1.text = patchBundle.BundleName;
|
label1.text = bundleInfo.BundleName;
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
var label2 = element.Q<Label>("Label2");
|
var label2 = element.Q<Label>("Label2");
|
||||||
label2.text = (patchBundle.SizeBytes / 1024f).ToString("f1") + " KB";
|
label2.text = (bundleInfo.SizeBytes / 1024f).ToString("f1") + " KB";
|
||||||
|
|
||||||
// Hash
|
// Hash
|
||||||
var label3 = element.Q<Label>("Label3");
|
var label3 = element.Q<Label>("Label3");
|
||||||
label3.text = patchBundle.Hash;
|
label3.text = bundleInfo.Hash;
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
var label4 = element.Q<Label>("Label4");
|
var label4 = element.Q<Label>("Label4");
|
||||||
label4.text = patchBundle.Version.ToString();
|
label4.text = bundleInfo.Version.ToString();
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
var label5 = element.Q<Label>("Label5");
|
var label5 = element.Q<Label>("Label5");
|
||||||
label5.text = GetTagsString(patchBundle.Tags);
|
label5.text = GetTagsString(bundleInfo.Tags);
|
||||||
}
|
}
|
||||||
private void BundleListView_onSelectionChange(IEnumerable<object> objs)
|
private void BundleListView_onSelectionChange(IEnumerable<object> objs)
|
||||||
{
|
{
|
||||||
foreach (var item in objs)
|
foreach (var item in objs)
|
||||||
{
|
{
|
||||||
PatchBundle patchBundle = item as PatchBundle;
|
ReportBundleInfo bundleInfo = item as ReportBundleInfo;
|
||||||
FillContainsListView(patchBundle);
|
FillContainsListView(bundleInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 依赖列表相关
|
// 依赖列表相关
|
||||||
|
private void FillContainsListView(ReportBundleInfo bundleInfo)
|
||||||
|
{
|
||||||
|
List<string> containsList = new List<string>();
|
||||||
|
foreach (var assetInfo in _buildReport.AssetInfos)
|
||||||
|
{
|
||||||
|
if (assetInfo.MainBundle == bundleInfo.BundleName)
|
||||||
|
containsList.Add(assetInfo.AssetPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
_includeListView.Clear();
|
||||||
|
#if UNITY_2020_1_OR_NEWER
|
||||||
|
_includeListView.ClearSelection();
|
||||||
|
#endif
|
||||||
|
_includeListView.itemsSource = containsList;
|
||||||
|
_bottomBar1.text = $"Include Assets ({containsList.Count})";
|
||||||
|
}
|
||||||
private VisualElement MakeContainsListViewItem()
|
private VisualElement MakeContainsListViewItem()
|
||||||
{
|
{
|
||||||
VisualElement element = new VisualElement();
|
VisualElement element = new VisualElement();
|
||||||
|
@ -260,38 +276,6 @@ namespace YooAsset.Editor
|
||||||
var label3 = element.Q<Label>("Label3");
|
var label3 = element.Q<Label>("Label3");
|
||||||
label3.text = AssetDatabase.AssetPathToGUID(assetPath);
|
label3.text = AssetDatabase.AssetPathToGUID(assetPath);
|
||||||
}
|
}
|
||||||
private void FillContainsListView(PatchBundle patchBundle)
|
|
||||||
{
|
|
||||||
List<string> containsList = new List<string>();
|
|
||||||
|
|
||||||
int bundleID = -1;
|
|
||||||
for (int i = 0; i < _manifest.BundleList.Count; i++)
|
|
||||||
{
|
|
||||||
if (_manifest.BundleList[i] == patchBundle)
|
|
||||||
{
|
|
||||||
bundleID = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bundleID == -1)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Not found bundle in PatchManifest : {patchBundle.BundleName}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var patchAsset in _manifest.AssetList)
|
|
||||||
{
|
|
||||||
if (patchAsset.BundleID == bundleID)
|
|
||||||
containsList.Add(patchAsset.AssetPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
_includeListView.Clear();
|
|
||||||
#if UNITY_2020_1_OR_NEWER
|
|
||||||
_includeListView.ClearSelection();
|
|
||||||
#endif
|
|
||||||
_includeListView.itemsSource = containsList;
|
|
||||||
_bottomBar1.text = $"Include Assets ({containsList.Count})";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetAssetFileSize(string assetPath)
|
private string GetAssetFileSize(string assetPath)
|
||||||
{
|
{
|
Loading…
Reference in New Issue