mirror of https://github.com/tuyoogame/YooAsset
parent
7d9e00a574
commit
e7d346e4e1
|
@ -38,6 +38,11 @@ namespace YooAsset.Editor
|
||||||
/// 资源包视图
|
/// 资源包视图
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BundleView,
|
BundleView,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异步操作视图
|
||||||
|
/// </summary>
|
||||||
|
OperationView,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +53,7 @@ namespace YooAsset.Editor
|
||||||
private SliderInt _frameSlider;
|
private SliderInt _frameSlider;
|
||||||
private DebuggerAssetListViewer _assetListViewer;
|
private DebuggerAssetListViewer _assetListViewer;
|
||||||
private DebuggerBundleListViewer _bundleListViewer;
|
private DebuggerBundleListViewer _bundleListViewer;
|
||||||
|
private DebuggerOperationListViewer _operationListViewer;
|
||||||
|
|
||||||
private EViewMode _viewMode;
|
private EViewMode _viewMode;
|
||||||
private string _searchKeyWord;
|
private string _searchKeyWord;
|
||||||
|
@ -85,6 +91,7 @@ namespace YooAsset.Editor
|
||||||
_viewModeMenu = root.Q<ToolbarMenu>("ViewModeMenu");
|
_viewModeMenu = root.Q<ToolbarMenu>("ViewModeMenu");
|
||||||
_viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.AssetView);
|
_viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.AssetView);
|
||||||
_viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.BundleView);
|
_viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.BundleView);
|
||||||
|
_viewModeMenu.menu.AppendAction(EViewMode.OperationView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.OperationView);
|
||||||
_viewModeMenu.text = EViewMode.AssetView.ToString();
|
_viewModeMenu.text = EViewMode.AssetView.ToString();
|
||||||
|
|
||||||
// 搜索栏
|
// 搜索栏
|
||||||
|
@ -121,6 +128,10 @@ namespace YooAsset.Editor
|
||||||
_bundleListViewer = new DebuggerBundleListViewer();
|
_bundleListViewer = new DebuggerBundleListViewer();
|
||||||
_bundleListViewer.InitViewer();
|
_bundleListViewer.InitViewer();
|
||||||
|
|
||||||
|
// 加载视图
|
||||||
|
_operationListViewer = new DebuggerOperationListViewer();
|
||||||
|
_operationListViewer.InitViewer();
|
||||||
|
|
||||||
// 显示视图
|
// 显示视图
|
||||||
_viewMode = EViewMode.AssetView;
|
_viewMode = EViewMode.AssetView;
|
||||||
_assetListViewer.AttachParent(root);
|
_assetListViewer.AttachParent(root);
|
||||||
|
@ -207,6 +218,7 @@ namespace YooAsset.Editor
|
||||||
_currentPlayerSession.ClearDebugReport();
|
_currentPlayerSession.ClearDebugReport();
|
||||||
_assetListViewer.ClearView();
|
_assetListViewer.ClearView();
|
||||||
_bundleListViewer.ClearView();
|
_bundleListViewer.ClearView();
|
||||||
|
_operationListViewer.ClearView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +254,7 @@ namespace YooAsset.Editor
|
||||||
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
|
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
|
||||||
_assetListViewer.FillViewData(debugReport);
|
_assetListViewer.FillViewData(debugReport);
|
||||||
_bundleListViewer.FillViewData(debugReport);
|
_bundleListViewer.FillViewData(debugReport);
|
||||||
|
_operationListViewer.FillViewData(debugReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +301,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
_assetListViewer.RebuildView(_searchKeyWord);
|
_assetListViewer.RebuildView(_searchKeyWord);
|
||||||
_bundleListViewer.RebuildView(_searchKeyWord);
|
_bundleListViewer.RebuildView(_searchKeyWord);
|
||||||
|
_operationListViewer.RebuildView(_searchKeyWord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnViewModeMenuChange(DropdownMenuAction action)
|
private void OnViewModeMenuChange(DropdownMenuAction action)
|
||||||
|
@ -303,11 +317,19 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
_assetListViewer.AttachParent(root);
|
_assetListViewer.AttachParent(root);
|
||||||
_bundleListViewer.DetachParent();
|
_bundleListViewer.DetachParent();
|
||||||
|
_operationListViewer.DetachParent();
|
||||||
}
|
}
|
||||||
else if (viewMode == EViewMode.BundleView)
|
else if (viewMode == EViewMode.BundleView)
|
||||||
{
|
{
|
||||||
_assetListViewer.DetachParent();
|
_assetListViewer.DetachParent();
|
||||||
_bundleListViewer.AttachParent(root);
|
_bundleListViewer.AttachParent(root);
|
||||||
|
_operationListViewer.DetachParent();
|
||||||
|
}
|
||||||
|
else if (viewMode == EViewMode.OperationView)
|
||||||
|
{
|
||||||
|
_assetListViewer.DetachParent();
|
||||||
|
_bundleListViewer.DetachParent();
|
||||||
|
_operationListViewer.AttachParent(root);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,13 +126,13 @@ namespace YooAsset.Editor
|
||||||
_providerTableView.AddColumn(column);
|
_providerTableView.AddColumn(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpawnTime
|
// BeginTime
|
||||||
{
|
{
|
||||||
var columnStyle = new ColumnStyle(100);
|
var columnStyle = new ColumnStyle(100);
|
||||||
columnStyle.Stretchable = false;
|
columnStyle.Stretchable = false;
|
||||||
columnStyle.Searchable = false;
|
columnStyle.Searchable = false;
|
||||||
columnStyle.Sortable = true;
|
columnStyle.Sortable = true;
|
||||||
var column = new TableColumn("SpawnTime", "Spawn Time", columnStyle);
|
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
|
||||||
column.MakeCell = () =>
|
column.MakeCell = () =>
|
||||||
{
|
{
|
||||||
var label = new Label();
|
var label = new Label();
|
||||||
|
@ -315,7 +315,7 @@ namespace YooAsset.Editor
|
||||||
rowData.AddAssetPathCell("PackageName", packageData.PackageName);
|
rowData.AddAssetPathCell("PackageName", packageData.PackageName);
|
||||||
rowData.AddStringValueCell("AssetPath", providerInfo.AssetPath);
|
rowData.AddStringValueCell("AssetPath", providerInfo.AssetPath);
|
||||||
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
|
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
|
||||||
rowData.AddStringValueCell("SpawnTime", providerInfo.SpawnTime);
|
rowData.AddStringValueCell("BeginTime", providerInfo.BeginTime);
|
||||||
rowData.AddLongValueCell("LoadingTime", providerInfo.LoadingTime);
|
rowData.AddLongValueCell("LoadingTime", providerInfo.LoadingTime);
|
||||||
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
|
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
|
||||||
rowData.AddStringValueCell("Status", providerInfo.Status.ToString());
|
rowData.AddStringValueCell("Status", providerInfo.Status.ToString());
|
||||||
|
|
|
@ -208,13 +208,13 @@ namespace YooAsset.Editor
|
||||||
_usingTableView.AddColumn(column);
|
_usingTableView.AddColumn(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpawnTime
|
// BeginTime
|
||||||
{
|
{
|
||||||
var columnStyle = new ColumnStyle(100);
|
var columnStyle = new ColumnStyle(100);
|
||||||
columnStyle.Stretchable = false;
|
columnStyle.Stretchable = false;
|
||||||
columnStyle.Searchable = false;
|
columnStyle.Searchable = false;
|
||||||
columnStyle.Sortable = true;
|
columnStyle.Sortable = true;
|
||||||
var column = new TableColumn("SpawnTime", "Spawn Time", columnStyle);
|
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
|
||||||
column.MakeCell = () =>
|
column.MakeCell = () =>
|
||||||
{
|
{
|
||||||
var label = new Label();
|
var label = new Label();
|
||||||
|
@ -448,7 +448,7 @@ namespace YooAsset.Editor
|
||||||
rowData.ProviderInfo = providerInfo;
|
rowData.ProviderInfo = providerInfo;
|
||||||
rowData.AddStringValueCell("UsingAssets", providerInfo.AssetPath);
|
rowData.AddStringValueCell("UsingAssets", providerInfo.AssetPath);
|
||||||
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
|
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
|
||||||
rowData.AddStringValueCell("SpawnTime", providerInfo.SpawnTime);
|
rowData.AddStringValueCell("BeginTime", providerInfo.BeginTime);
|
||||||
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
|
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
|
||||||
rowData.AddStringValueCell("Status", providerInfo.Status);
|
rowData.AddStringValueCell("Status", providerInfo.Status);
|
||||||
sourceDatas.Add(rowData);
|
sourceDatas.Add(rowData);
|
||||||
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
internal class DebuggerOperationListViewer
|
||||||
|
{
|
||||||
|
private class OperationTableData : DefaultTableData
|
||||||
|
{
|
||||||
|
public DebugPackageData PackageData;
|
||||||
|
public DebugOperationInfo OperationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VisualTreeAsset _visualAsset;
|
||||||
|
private TemplateContainer _root;
|
||||||
|
|
||||||
|
private TableView _operationTableView;
|
||||||
|
|
||||||
|
private DebugReport _debugReport;
|
||||||
|
private List<ITableData> _sourceDatas;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化页面
|
||||||
|
/// </summary>
|
||||||
|
public void InitViewer()
|
||||||
|
{
|
||||||
|
// 加载布局文件
|
||||||
|
_visualAsset = UxmlLoader.LoadWindowUXML<DebuggerOperationListViewer>();
|
||||||
|
if (_visualAsset == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_root = _visualAsset.CloneTree();
|
||||||
|
_root.style.flexGrow = 1f;
|
||||||
|
|
||||||
|
// 任务列表
|
||||||
|
_operationTableView = _root.Q<TableView>("TopTableView");
|
||||||
|
CreateOperationTableViewColumns();
|
||||||
|
}
|
||||||
|
private void CreateOperationTableViewColumns()
|
||||||
|
{
|
||||||
|
|
||||||
|
// PackageName
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(200);
|
||||||
|
columnStyle.Stretchable = true;
|
||||||
|
columnStyle.Searchable = true;
|
||||||
|
columnStyle.Sortable = true;
|
||||||
|
columnStyle.Counter = true;
|
||||||
|
var column = new TableColumn("PackageName", "Package Name", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OperationName
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(300, 300, 600);
|
||||||
|
columnStyle.Stretchable = true;
|
||||||
|
columnStyle.Searchable = true;
|
||||||
|
columnStyle.Sortable = true;
|
||||||
|
columnStyle.Counter = true;
|
||||||
|
var column = new TableColumn("OperationName", "Operation Name", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Priority
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(100);
|
||||||
|
columnStyle.Stretchable = false;
|
||||||
|
columnStyle.Searchable = false;
|
||||||
|
columnStyle.Sortable = true;
|
||||||
|
var column = new TableColumn("Priority", "Priority", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Progress
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(100);
|
||||||
|
columnStyle.Stretchable = false;
|
||||||
|
columnStyle.Searchable = false;
|
||||||
|
columnStyle.Sortable = false;
|
||||||
|
var column = new TableColumn("Progress", "Progress", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeginTime
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(100);
|
||||||
|
columnStyle.Stretchable = false;
|
||||||
|
columnStyle.Searchable = false;
|
||||||
|
columnStyle.Sortable = true;
|
||||||
|
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProcessTime
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(100);
|
||||||
|
columnStyle.Stretchable = false;
|
||||||
|
columnStyle.Searchable = false;
|
||||||
|
columnStyle.Sortable = true;
|
||||||
|
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status
|
||||||
|
{
|
||||||
|
var columnStyle = new ColumnStyle(100);
|
||||||
|
columnStyle.Stretchable = false;
|
||||||
|
columnStyle.Searchable = false;
|
||||||
|
columnStyle.Sortable = true;
|
||||||
|
var column = new TableColumn("Status", "Status", columnStyle);
|
||||||
|
column.MakeCell = () =>
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
|
{
|
||||||
|
StyleColor textColor;
|
||||||
|
var operationTableData = data as OperationTableData;
|
||||||
|
if (operationTableData.OperationInfo.Status == EOperationStatus.Failed.ToString())
|
||||||
|
textColor = new StyleColor(Color.yellow);
|
||||||
|
else
|
||||||
|
textColor = new StyleColor(Color.white);
|
||||||
|
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
infoLabel.style.color = textColor;
|
||||||
|
};
|
||||||
|
_operationTableView.AddColumn(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 填充页面数据
|
||||||
|
/// </summary>
|
||||||
|
public void FillViewData(DebugReport debugReport)
|
||||||
|
{
|
||||||
|
_debugReport = debugReport;
|
||||||
|
|
||||||
|
// 清空旧数据
|
||||||
|
_operationTableView.ClearAll(false, true);
|
||||||
|
|
||||||
|
// 填充数据源
|
||||||
|
_sourceDatas = new List<ITableData>(1000);
|
||||||
|
foreach (var packageData in debugReport.PackageDatas)
|
||||||
|
{
|
||||||
|
foreach (var operationInfo in packageData.OperationInfos)
|
||||||
|
{
|
||||||
|
var rowData = new OperationTableData();
|
||||||
|
rowData.PackageData = packageData;
|
||||||
|
rowData.OperationInfo = operationInfo;
|
||||||
|
rowData.AddStringValueCell("PackageName", packageData.PackageName);
|
||||||
|
rowData.AddStringValueCell("OperationName", operationInfo.OperationName);
|
||||||
|
rowData.AddLongValueCell("Priority", operationInfo.Priority);
|
||||||
|
rowData.AddDoubleValueCell("Progress", operationInfo.Progress);
|
||||||
|
rowData.AddStringValueCell("BeginTime", operationInfo.BeginTime);
|
||||||
|
rowData.AddLongValueCell("LoadingTime", operationInfo.ProcessTime);
|
||||||
|
rowData.AddStringValueCell("Status", operationInfo.Status.ToString());
|
||||||
|
_sourceDatas.Add(rowData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_operationTableView.itemsSource = _sourceDatas;
|
||||||
|
|
||||||
|
// 重建视图
|
||||||
|
RebuildView(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清空页面
|
||||||
|
/// </summary>
|
||||||
|
public void ClearView()
|
||||||
|
{
|
||||||
|
_debugReport = null;
|
||||||
|
_operationTableView.ClearAll(false, true);
|
||||||
|
RebuildView(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重建视图
|
||||||
|
/// </summary>
|
||||||
|
public void RebuildView(string searchKeyWord)
|
||||||
|
{
|
||||||
|
// 搜索匹配
|
||||||
|
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||||
|
|
||||||
|
// 重建视图
|
||||||
|
_operationTableView.RebuildView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 挂接到父类页面上
|
||||||
|
/// </summary>
|
||||||
|
public void AttachParent(VisualElement parent)
|
||||||
|
{
|
||||||
|
parent.Add(_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从父类页面脱离开
|
||||||
|
/// </summary>
|
||||||
|
public void DetachParent()
|
||||||
|
{
|
||||||
|
_root.RemoveFromHierarchy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: faabdaf3787cba6438d2300f7f71e26f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,5 @@
|
||||||
|
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||||
|
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
|
||||||
|
<YooAsset.Editor.TableView name="TopTableView" />
|
||||||
|
</ui:VisualElement>
|
||||||
|
</ui:UXML>
|
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7147c7108cba1bb4dba3a2cfc758ad43
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
|
@ -0,0 +1,49 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class DebugOperationInfo : IComparer<DebugOperationInfo>, IComparable<DebugOperationInfo>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务名称
|
||||||
|
/// </summary>
|
||||||
|
public string OperationName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 优先级
|
||||||
|
/// </summary>
|
||||||
|
public uint Priority;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务进度
|
||||||
|
/// </summary>
|
||||||
|
public float Progress;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务开始的时间
|
||||||
|
/// </summary>
|
||||||
|
public string BeginTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理耗时(单位:毫秒)
|
||||||
|
/// </summary>
|
||||||
|
public long ProcessTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务状态
|
||||||
|
/// </summary>
|
||||||
|
public string Status;
|
||||||
|
|
||||||
|
public int CompareTo(DebugOperationInfo other)
|
||||||
|
{
|
||||||
|
return Compare(this, other);
|
||||||
|
}
|
||||||
|
public int Compare(DebugOperationInfo a, DebugOperationInfo b)
|
||||||
|
{
|
||||||
|
return string.CompareOrdinal(a.OperationName, b.OperationName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 942ce6ad7b4427d4d87a8a29c8b9371f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -13,15 +13,9 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PackageName;
|
public string PackageName;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 调试数据列表
|
|
||||||
/// </summary>
|
|
||||||
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
|
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 调试数据列表
|
|
||||||
/// </summary>
|
|
||||||
public List<DebugBundleInfo> BundleInfos = new List<DebugBundleInfo>(1000);
|
public List<DebugBundleInfo> BundleInfos = new List<DebugBundleInfo>(1000);
|
||||||
|
public List<DebugOperationInfo> OperationInfos = new List<DebugOperationInfo>(1000);
|
||||||
|
|
||||||
|
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
|
|
|
@ -23,9 +23,9 @@ namespace YooAsset
|
||||||
public string SpawnScene;
|
public string SpawnScene;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源出生的时间
|
/// 资源加载开始时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SpawnTime;
|
public string BeginTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载耗时(单位:毫秒)
|
/// 加载耗时(单位:毫秒)
|
||||||
|
|
|
@ -24,12 +24,12 @@ namespace YooAsset
|
||||||
internal bool IsFinish { private set; get; } = false;
|
internal bool IsFinish { private set; get; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 优先级
|
/// 任务优先级
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint Priority { set; get; } = 0;
|
public uint Priority { set; get; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态
|
/// 任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EOperationStatus Status { get; protected set; } = EOperationStatus.None;
|
public EOperationStatus Status { get; protected set; } = EOperationStatus.None;
|
||||||
|
|
||||||
|
@ -139,6 +139,11 @@ namespace YooAsset
|
||||||
if (Status == EOperationStatus.None)
|
if (Status == EOperationStatus.None)
|
||||||
{
|
{
|
||||||
Status = EOperationStatus.Processing;
|
Status = EOperationStatus.Processing;
|
||||||
|
|
||||||
|
// 开始记录
|
||||||
|
DebugBeginRecording();
|
||||||
|
|
||||||
|
// 开始任务
|
||||||
InternalStart();
|
InternalStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +154,13 @@ namespace YooAsset
|
||||||
internal void UpdateOperation()
|
internal void UpdateOperation()
|
||||||
{
|
{
|
||||||
if (IsDone == false)
|
if (IsDone == false)
|
||||||
|
{
|
||||||
|
// 更新记录
|
||||||
|
DebugUpdateRecording();
|
||||||
|
|
||||||
|
// 更新任务
|
||||||
InternalUpdate();
|
InternalUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
if (IsDone && IsFinish == false)
|
if (IsDone && IsFinish == false)
|
||||||
{
|
{
|
||||||
|
@ -158,6 +169,9 @@ namespace YooAsset
|
||||||
// 进度百分百完成
|
// 进度百分百完成
|
||||||
Progress = 1f;
|
Progress = 1f;
|
||||||
|
|
||||||
|
// 结束记录
|
||||||
|
DebugEndRecording();
|
||||||
|
|
||||||
//注意:如果完成回调内发生异常,会导致Task无限期等待
|
//注意:如果完成回调内发生异常,会导致Task无限期等待
|
||||||
_callback?.Invoke(this);
|
_callback?.Invoke(this);
|
||||||
|
|
||||||
|
@ -235,6 +249,55 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 调试信息
|
#region 调试信息
|
||||||
|
/// <summary>
|
||||||
|
/// 开始的时间
|
||||||
|
/// </summary>
|
||||||
|
public string BeginTime = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理耗时(单位:毫秒)
|
||||||
|
/// </summary>
|
||||||
|
public long ProcessTime { protected set; get; }
|
||||||
|
|
||||||
|
// 加载耗时统计
|
||||||
|
private Stopwatch _watch = null;
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void DebugBeginRecording()
|
||||||
|
{
|
||||||
|
if (_watch == null)
|
||||||
|
{
|
||||||
|
BeginTime = SpawnTimeToString(UnityEngine.Time.realtimeSinceStartup);
|
||||||
|
_watch = Stopwatch.StartNew();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void DebugUpdateRecording()
|
||||||
|
{
|
||||||
|
if (_watch != null)
|
||||||
|
{
|
||||||
|
ProcessTime = _watch.ElapsedMilliseconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void DebugEndRecording()
|
||||||
|
{
|
||||||
|
if (_watch != null)
|
||||||
|
{
|
||||||
|
ProcessTime = _watch.ElapsedMilliseconds;
|
||||||
|
_watch = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string SpawnTimeToString(float spawnTime)
|
||||||
|
{
|
||||||
|
float h = UnityEngine.Mathf.FloorToInt(spawnTime / 3600f);
|
||||||
|
float m = UnityEngine.Mathf.FloorToInt(spawnTime / 60f - h * 60f);
|
||||||
|
float s = UnityEngine.Mathf.FloorToInt(spawnTime - m * 60f - h * 3600f);
|
||||||
|
return h.ToString("00") + ":" + m.ToString("00") + ":" + s.ToString("00");
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 排序接口实现
|
#region 排序接口实现
|
||||||
|
|
|
@ -132,5 +132,27 @@ namespace YooAsset
|
||||||
operation.SetPackageName(packageName);
|
operation.SetPackageName(packageName);
|
||||||
operation.StartOperation();
|
operation.StartOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 调试信息
|
||||||
|
internal static List<DebugOperationInfo> GetDebugOperationInfos(string packageName)
|
||||||
|
{
|
||||||
|
List<DebugOperationInfo> result = new List<DebugOperationInfo>(_operations.Count);
|
||||||
|
foreach (var operation in _operations)
|
||||||
|
{
|
||||||
|
if (operation.PackageName == packageName)
|
||||||
|
{
|
||||||
|
var operationInfo = new DebugOperationInfo();
|
||||||
|
operationInfo.OperationName = operation.GetType().FullName;
|
||||||
|
operationInfo.Priority = operation.Priority;
|
||||||
|
operationInfo.Progress = operation.Progress;
|
||||||
|
operationInfo.BeginTime = operation.BeginTime;
|
||||||
|
operationInfo.ProcessTime = operation.ProcessTime;
|
||||||
|
operationInfo.Status = operation.Status.ToString();
|
||||||
|
result.Add(operationInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -99,7 +99,6 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
DebugBeginRecording();
|
|
||||||
_steps = ESteps.StartBundleLoader;
|
_steps = ESteps.StartBundleLoader;
|
||||||
}
|
}
|
||||||
internal override void InternalUpdate()
|
internal override void InternalUpdate()
|
||||||
|
@ -267,8 +266,6 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void InvokeCompletion(string error, EOperationStatus status)
|
protected void InvokeCompletion(string error, EOperationStatus status)
|
||||||
{
|
{
|
||||||
DebugEndRecording();
|
|
||||||
|
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Error = error;
|
Error = error;
|
||||||
Status = status;
|
Status = status;
|
||||||
|
@ -311,50 +308,10 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SpawnScene = string.Empty;
|
public string SpawnScene = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 出生的时间
|
|
||||||
/// </summary>
|
|
||||||
public string SpawnTime = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载耗时(单位:毫秒)
|
|
||||||
/// </summary>
|
|
||||||
public long LoadingTime { protected set; get; }
|
|
||||||
|
|
||||||
// 加载耗时统计
|
|
||||||
private Stopwatch _watch = null;
|
|
||||||
|
|
||||||
[Conditional("DEBUG")]
|
[Conditional("DEBUG")]
|
||||||
public void InitSpawnDebugInfo()
|
public void InitProviderDebugInfo()
|
||||||
{
|
{
|
||||||
SpawnScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; ;
|
SpawnScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
|
||||||
SpawnTime = SpawnTimeToString(UnityEngine.Time.realtimeSinceStartup);
|
|
||||||
}
|
|
||||||
private string SpawnTimeToString(float spawnTime)
|
|
||||||
{
|
|
||||||
float h = UnityEngine.Mathf.FloorToInt(spawnTime / 3600f);
|
|
||||||
float m = UnityEngine.Mathf.FloorToInt(spawnTime / 60f - h * 60f);
|
|
||||||
float s = UnityEngine.Mathf.FloorToInt(spawnTime - m * 60f - h * 3600f);
|
|
||||||
return h.ToString("00") + ":" + m.ToString("00") + ":" + s.ToString("00");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Conditional("DEBUG")]
|
|
||||||
private void DebugBeginRecording()
|
|
||||||
{
|
|
||||||
if (_watch == null)
|
|
||||||
{
|
|
||||||
_watch = Stopwatch.StartNew();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Conditional("DEBUG")]
|
|
||||||
private void DebugEndRecording()
|
|
||||||
{
|
|
||||||
if (_watch != null)
|
|
||||||
{
|
|
||||||
LoadingTime = _watch.ElapsedMilliseconds;
|
|
||||||
_watch = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace YooAsset
|
||||||
ProviderOperation provider;
|
ProviderOperation provider;
|
||||||
{
|
{
|
||||||
provider = new SceneProvider(this, providerGUID, assetInfo, loadSceneParams, suspendLoad);
|
provider = new SceneProvider(this, providerGUID, assetInfo, loadSceneParams, suspendLoad);
|
||||||
provider.InitSpawnDebugInfo();
|
provider.InitProviderDebugInfo();
|
||||||
ProviderDic.Add(providerGUID, provider);
|
ProviderDic.Add(providerGUID, provider);
|
||||||
OperationSystem.StartOperation(PackageName, provider);
|
OperationSystem.StartOperation(PackageName, provider);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ namespace YooAsset
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
{
|
{
|
||||||
provider = new AssetProvider(this, providerGUID, assetInfo);
|
provider = new AssetProvider(this, providerGUID, assetInfo);
|
||||||
provider.InitSpawnDebugInfo();
|
provider.InitProviderDebugInfo();
|
||||||
ProviderDic.Add(providerGUID, provider);
|
ProviderDic.Add(providerGUID, provider);
|
||||||
OperationSystem.StartOperation(PackageName, provider);
|
OperationSystem.StartOperation(PackageName, provider);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ namespace YooAsset
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
{
|
{
|
||||||
provider = new SubAssetsProvider(this, providerGUID, assetInfo);
|
provider = new SubAssetsProvider(this, providerGUID, assetInfo);
|
||||||
provider.InitSpawnDebugInfo();
|
provider.InitProviderDebugInfo();
|
||||||
ProviderDic.Add(providerGUID, provider);
|
ProviderDic.Add(providerGUID, provider);
|
||||||
OperationSystem.StartOperation(PackageName, provider);
|
OperationSystem.StartOperation(PackageName, provider);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ namespace YooAsset
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
{
|
{
|
||||||
provider = new AllAssetsProvider(this, providerGUID, assetInfo);
|
provider = new AllAssetsProvider(this, providerGUID, assetInfo);
|
||||||
provider.InitSpawnDebugInfo();
|
provider.InitProviderDebugInfo();
|
||||||
ProviderDic.Add(providerGUID, provider);
|
ProviderDic.Add(providerGUID, provider);
|
||||||
OperationSystem.StartOperation(PackageName, provider);
|
OperationSystem.StartOperation(PackageName, provider);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ namespace YooAsset
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
{
|
{
|
||||||
provider = new RawFileProvider(this, providerGUID, assetInfo);
|
provider = new RawFileProvider(this, providerGUID, assetInfo);
|
||||||
provider.InitSpawnDebugInfo();
|
provider.InitProviderDebugInfo();
|
||||||
ProviderDic.Add(providerGUID, provider);
|
ProviderDic.Add(providerGUID, provider);
|
||||||
OperationSystem.StartOperation(PackageName, provider);
|
OperationSystem.StartOperation(PackageName, provider);
|
||||||
}
|
}
|
||||||
|
@ -359,14 +359,6 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 调试信息
|
#region 调试信息
|
||||||
internal DebugPackageData GetDebugPackageData()
|
|
||||||
{
|
|
||||||
DebugPackageData data = new DebugPackageData();
|
|
||||||
data.PackageName = PackageName;
|
|
||||||
data.ProviderInfos = GetDebugProviderInfos();
|
|
||||||
data.BundleInfos = GetDebugBundleInfos();
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
internal List<DebugProviderInfo> GetDebugProviderInfos()
|
internal List<DebugProviderInfo> GetDebugProviderInfos()
|
||||||
{
|
{
|
||||||
List<DebugProviderInfo> result = new List<DebugProviderInfo>(ProviderDic.Count);
|
List<DebugProviderInfo> result = new List<DebugProviderInfo>(ProviderDic.Count);
|
||||||
|
@ -375,8 +367,8 @@ namespace YooAsset
|
||||||
DebugProviderInfo providerInfo = new DebugProviderInfo();
|
DebugProviderInfo providerInfo = new DebugProviderInfo();
|
||||||
providerInfo.AssetPath = provider.MainAssetInfo.AssetPath;
|
providerInfo.AssetPath = provider.MainAssetInfo.AssetPath;
|
||||||
providerInfo.SpawnScene = provider.SpawnScene;
|
providerInfo.SpawnScene = provider.SpawnScene;
|
||||||
providerInfo.SpawnTime = provider.SpawnTime;
|
providerInfo.BeginTime = provider.BeginTime;
|
||||||
providerInfo.LoadingTime = provider.LoadingTime;
|
providerInfo.LoadingTime = provider.ProcessTime;
|
||||||
providerInfo.RefCount = provider.RefCount;
|
providerInfo.RefCount = provider.RefCount;
|
||||||
providerInfo.Status = provider.Status.ToString();
|
providerInfo.Status = provider.Status.ToString();
|
||||||
providerInfo.DependBundles = provider.GetDebugDependBundles();
|
providerInfo.DependBundles = provider.GetDebugDependBundles();
|
||||||
|
|
|
@ -1166,7 +1166,12 @@ namespace YooAsset
|
||||||
#region 调试信息
|
#region 调试信息
|
||||||
internal DebugPackageData GetDebugPackageData()
|
internal DebugPackageData GetDebugPackageData()
|
||||||
{
|
{
|
||||||
return _resourceManager.GetDebugPackageData();
|
DebugPackageData data = new DebugPackageData();
|
||||||
|
data.PackageName = PackageName;
|
||||||
|
data.ProviderInfos = _resourceManager.GetDebugProviderInfos();
|
||||||
|
data.BundleInfos = _resourceManager.GetDebugBundleInfos();
|
||||||
|
data.OperationInfos = OperationSystem.GetDebugOperationInfos(PackageName);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue