Compare commits

...

24 Commits

Author SHA1 Message Date
何冠峰
e6958d205e Update CHANGELOG.md 2025-03-06 15:05:52 +08:00
何冠峰
b03d9db2b0 Update package.json 2025-03-06 15:05:39 +08:00
何冠峰
30853b6d62 update space shooter 2025-03-06 14:31:40 +08:00
何冠峰
a7cafcb328 update UIElements
展示单位Units
2025-03-06 14:31:26 +08:00
何冠峰
d03bca5512 update asset bundle debugger 2025-03-06 12:20:45 +08:00
何冠峰
af3fc50188 update UIElements 2025-03-06 12:20:13 +08:00
何冠峰
b71eeeb855 update UIElements 2025-03-06 11:45:51 +08:00
何冠峰
317c42521a update test sample 2025-03-06 11:39:26 +08:00
何冠峰
064d69269e Update PakcageInvokeBuildParam.cs 2025-03-06 11:17:20 +08:00
何冠峰
9e6401d3c0 update space shooter 2025-03-06 11:17:00 +08:00
何冠峰
2aaba328ee fix #488 2025-03-06 11:16:21 +08:00
何冠峰
62fdc93a82 update test sample 2025-03-06 10:55:54 +08:00
何冠峰
408f0942ee update test sample 2025-03-05 20:00:02 +08:00
何冠峰
ddda9e29db fix #491 2025-03-05 17:39:33 +08:00
何冠峰
c2b33f5ec4 fix #492 2025-03-05 17:29:52 +08:00
何冠峰
e58999e484 update asset bundle debugger 2025-03-05 17:26:58 +08:00
何冠峰
ed9692574c Update AssetBundleSimulateBuilder.cs
模拟构建默认启用依赖关系数据库
2025-03-05 10:54:33 +08:00
何冠峰
f7e078e064 update file system 2025-03-05 10:54:02 +08:00
何冠峰
b74a44dc36 update UIElements 2025-03-03 20:57:50 +08:00
何冠峰
6b36cdb5ee update AssetBundleDebugger
内置了新的UIElments的TreeViewer组件。
2025-03-03 18:28:02 +08:00
何冠峰
56ae1a8f95 update UIElements 2025-02-28 19:06:17 +08:00
何冠峰
3069b1d1f1 update diagnostic system 2025-02-28 18:38:18 +08:00
何冠峰
e7d346e4e1 update diagnostic system
调试窗口增加异步操作视图
2025-02-27 20:37:28 +08:00
何冠峰
7d9e00a574 update resource package 2025-02-27 18:15:02 +08:00
177 changed files with 3388 additions and 620 deletions

View File

@@ -2,6 +2,18 @@
All notable changes to this package will be documented in this file.
## [2.3.3-preview] - 2025-03-06
### Improvements
- 新增了异步操作任务调试器AssetBundleDebugger窗口-->OperationView视图模式
- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅增加编辑器下开始游戏时间。
- 单元测试用例增加加密解密测试用例。
### Fixed
- (#492) 修复了发布的MAC平台应用在启动的时候提示权限无法获取的问题。
## [2.3.2-preview] - 2025-02-27
### Fixed

View File

@@ -97,7 +97,7 @@ namespace YooAsset.Editor
private Button _passesVisibleBtn;
private Label _titleLabel;
private Label _descLabel;
private TableView _elementTableView;
private TableViewer _elementTableView;
private ScanReportCombiner _reportCombiner;
private string _lastestOpenFolder;
@@ -152,7 +152,7 @@ namespace YooAsset.Editor
_descLabel = root.Q<Label>("ReportDesc");
// 列表相关
_elementTableView = root.Q<TableView>("TopTableView");
_elementTableView = root.Q<TableViewer>("TopTableView");
_elementTableView.ClickTableDataEvent = OnClickTableViewItem;
_lastestOpenFolder = EditorTools.GetProjectPath();
@@ -326,7 +326,7 @@ namespace YooAsset.Editor
var column = new TableColumn("眼睛框", string.Empty, columnStyle);
column.MakeCell = () =>
{
var toggle = new DisplayToggle();
var toggle = new ToggleDisplay();
toggle.text = string.Empty;
toggle.style.unityTextAlign = TextAnchor.MiddleCenter;
toggle.RegisterValueChangedCallback((evt) => { OnDisplayToggleValueChange(toggle, evt); });
@@ -334,11 +334,10 @@ namespace YooAsset.Editor
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
{
var toggle = element as DisplayToggle;
var toggle = element as ToggleDisplay;
toggle.userData = data;
var tableData = data as ElementTableData;
toggle.SetValueWithoutNotify(tableData.Element.Hidden);
toggle.RefreshIcon();
};
_elementTableView.AddColumn(column);
var headerElement = _elementTableView.GetHeaderElement("眼睛框");
@@ -442,6 +441,8 @@ namespace YooAsset.Editor
columnStyle.Stretchable = header.Stretchable;
columnStyle.Searchable = header.Searchable;
columnStyle.Sortable = header.Sortable;
columnStyle.Counter = header.Counter;
columnStyle.Units = header.Units;
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
column.MakeCell = () =>
{
@@ -577,10 +578,8 @@ namespace YooAsset.Editor
// 重绘视图
RebuildView();
}
private void OnDisplayToggleValueChange(DisplayToggle toggle, ChangeEvent<bool> e)
private void OnDisplayToggleValueChange(ToggleDisplay toggle, ChangeEvent<bool> e)
{
toggle.RefreshIcon();
// 处理自身
toggle.SetValueWithoutNotify(e.newValue);
@@ -593,7 +592,8 @@ namespace YooAsset.Editor
foreach (var selectedItem in selectedItems)
{
var selectElement = selectedItem as ElementTableData;
selectElement.Element.Hidden = e.newValue;
if (selectElement != null)
selectElement.Element.Hidden = e.newValue;
}
// 重绘视图

View File

@@ -17,6 +17,6 @@
<ui:Button text="显示白名单元素" display-tooltip-when-elided="true" name="WhiteListVisibleButton" style="width: 100px;" />
</uie:Toolbar>
<ui:VisualElement name="AssetGroup" 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" />
<YooAsset.Editor.TableViewer name="TopTableView" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -43,6 +43,16 @@ namespace YooAsset.Editor
/// </summary>
public bool Sortable = false;
/// <summary>
/// 统计数量
/// </summary>
public bool Counter = false;
/// <summary>
/// 展示单位
/// </summary>
public string Units = string.Empty;
/// <summary>
/// 数值类型
/// </summary>
@@ -89,6 +99,16 @@ namespace YooAsset.Editor
Sortable = true;
return this;
}
public ReportHeader SetCounter()
{
Counter = true;
return this;
}
public ReportHeader SetUnits(string units)
{
Units = units;
return this;
}
public ReportHeader SetHeaderType(EHeaderType value)
{
HeaderType = value;

View File

@@ -26,6 +26,7 @@ namespace YooAsset.Editor
buildParameters.FileNameStyle = EFileNameStyle.HashName;
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
buildParameters.BuildinFileCopyParams = string.Empty;
buildParameters.UseAssetDependencyDB = true;
var pipeline = new EditorSimulateBuildPipeline();
BuildResult buildResult = pipeline.Run(buildParameters, false);

View File

@@ -38,21 +38,31 @@ namespace YooAsset.Editor
/// 资源包视图
/// </summary>
BundleView,
/// <summary>
/// 异步操作视图
/// </summary>
OperationView,
}
private readonly Dictionary<int, RemotePlayerSession> _playerSessions = new Dictionary<int, RemotePlayerSession>();
private Label _playerName;
private ToolbarButton _playerName;
private ToolbarMenu _viewModeMenu;
private SliderInt _frameSlider;
private DebuggerAssetListViewer _assetListViewer;
private DebuggerBundleListViewer _bundleListViewer;
private DebuggerOperationListViewer _operationListViewer;
private EViewMode _viewMode;
private string _searchKeyWord;
private DebugReport _currentReport;
private RemotePlayerSession _currentPlayerSession;
private double _lastRepaintTime = 0;
private int _nextRepaintIndex = -1;
private int _lastRepaintIndex = 0;
private int _rangeIndex = 0;
@@ -78,13 +88,14 @@ namespace YooAsset.Editor
exportBtn.clicked += ExportBtn_clicked;
// 用户列表菜单
_playerName = root.Q<Label>("PlayerName");
_playerName = root.Q<ToolbarButton>("PlayerName");
_playerName.text = "Editor player";
// 视口模式菜单
_viewModeMenu = root.Q<ToolbarMenu>("ViewModeMenu");
_viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.AssetView);
_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();
// 搜索栏
@@ -111,6 +122,9 @@ namespace YooAsset.Editor
var frameClear = root.Q<ToolbarButton>("FrameClear");
frameClear.clicked += OnFrameClear_clicked;
var recorderToggle = root.Q<ToggleRecord>("FrameRecord");
recorderToggle.RegisterValueChangedCallback(OnRecordToggleValueChange);
}
// 加载视图
@@ -121,6 +135,10 @@ namespace YooAsset.Editor
_bundleListViewer = new DebuggerBundleListViewer();
_bundleListViewer.InitViewer();
// 加载视图
_operationListViewer = new DebuggerOperationListViewer();
_operationListViewer.InitViewer();
// 显示视图
_viewMode = EViewMode.AssetView;
_assetListViewer.AttachParent(root);
@@ -129,8 +147,9 @@ namespace YooAsset.Editor
EditorConnection.instance.Initialize();
EditorConnection.instance.RegisterConnection(OnHandleConnectionEvent);
EditorConnection.instance.RegisterDisconnection(OnHandleDisconnectionEvent);
EditorConnection.instance.Register(RemoteDebuggerDefine.kMsgSendPlayerToEditor, OnHandlePlayerMessage);
RemoteDebuggerInRuntime.EditorHandleDebugReportCallback = OnHandleDebugReport;
EditorConnection.instance.Register(RemoteDebuggerDefine.kMsgPlayerSendToEditor, OnHandlePlayerMessage);
RemoteEditorConnection.Instance.Initialize();
RemoteEditorConnection.Instance.Register(RemoteDebuggerDefine.kMsgPlayerSendToEditor, OnHandlePlayerMessage);
}
catch (Exception e)
{
@@ -142,9 +161,23 @@ namespace YooAsset.Editor
// 远程调试
EditorConnection.instance.UnregisterConnection(OnHandleConnectionEvent);
EditorConnection.instance.UnregisterDisconnection(OnHandleDisconnectionEvent);
EditorConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendPlayerToEditor, OnHandlePlayerMessage);
EditorConnection.instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor, OnHandlePlayerMessage);
RemoteEditorConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor);
_playerSessions.Clear();
}
public void Update()
{
// 每间隔1秒绘制一次页面
if (EditorApplication.timeSinceStartup - _lastRepaintTime > 1f)
{
_lastRepaintTime = EditorApplication.timeSinceStartup;
if (_nextRepaintIndex >= 0)
{
RepaintFrame(_nextRepaintIndex);
_nextRepaintIndex = -1;
}
}
}
private void OnHandleConnectionEvent(int playerId)
{
@@ -158,24 +191,27 @@ namespace YooAsset.Editor
}
private void OnHandlePlayerMessage(MessageEventArgs args)
{
int playerId = args.playerId;
var debugReport = DebugReport.Deserialize(args.data);
OnHandleDebugReport(args.playerId, debugReport);
}
private void OnHandleDebugReport(int playerId, DebugReport debugReport)
{
Debug.Log($"Handle player {playerId} debug report !");
if (debugReport.DebuggerVersion != RemoteDebuggerDefine.DebuggerVersion)
{
Debug.LogWarning($"Debugger versions are inconsistent : {debugReport.DebuggerVersion} != {RemoteDebuggerDefine.DebuggerVersion}");
return;
}
//Debug.Log($"Handle player {playerId} debug report !");
_currentPlayerSession = GetOrCreatePlayerSession(playerId);
_currentPlayerSession.AddDebugReport(debugReport);
_frameSlider.highValue = _currentPlayerSession.MaxRangeValue;
_frameSlider.value = _currentPlayerSession.MaxRangeValue;
UpdateFrameView(_currentPlayerSession);
_nextRepaintIndex = _currentPlayerSession.MaxRangeValue;
}
private void OnFrameSliderChange(int sliderValue)
{
if (_currentPlayerSession != null)
{
_rangeIndex = _currentPlayerSession.ClampRangeIndex(sliderValue); ;
UpdateFrameView(_currentPlayerSession, _rangeIndex);
RepaintFrame(_rangeIndex);
}
}
private void OnFrameLast_clicked()
@@ -184,7 +220,7 @@ namespace YooAsset.Editor
{
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex - 1);
_frameSlider.value = _rangeIndex;
UpdateFrameView(_currentPlayerSession, _rangeIndex);
RepaintFrame(_rangeIndex);
}
}
private void OnFrameNext_clicked()
@@ -193,56 +229,37 @@ namespace YooAsset.Editor
{
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex + 1);
_frameSlider.value = _rangeIndex;
UpdateFrameView(_currentPlayerSession, _rangeIndex);
RepaintFrame(_rangeIndex);
}
}
private void OnFrameClear_clicked()
{
_nextRepaintIndex = -1;
_lastRepaintIndex = 0;
_rangeIndex = 0;
_frameSlider.label = $"Frame:";
_frameSlider.value = 0;
_frameSlider.lowValue = 0;
_frameSlider.highValue = 0;
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
if (_currentPlayerSession != null)
{
_frameSlider.label = $"Frame:";
_frameSlider.value = 0;
_frameSlider.lowValue = 0;
_frameSlider.highValue = 0;
_currentPlayerSession.ClearDebugReport();
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
}
}
private RemotePlayerSession GetOrCreatePlayerSession(int playerId)
private void OnRecordToggleValueChange(ChangeEvent<bool> evt)
{
if (_playerSessions.TryGetValue(playerId, out RemotePlayerSession session))
{
return session;
}
else
{
RemotePlayerSession newSession = new RemotePlayerSession(playerId);
_playerSessions.Add(playerId, newSession);
return newSession;
}
}
private void UpdateFrameView(RemotePlayerSession playerSession)
{
if (playerSession != null)
{
UpdateFrameView(playerSession, playerSession.MaxRangeValue);
}
}
private void UpdateFrameView(RemotePlayerSession playerSession, int rangeIndex)
{
if (playerSession == null)
return;
var debugReport = playerSession.GetDebugReport(rangeIndex);
if (debugReport != null)
{
_currentReport = debugReport;
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
_assetListViewer.FillViewData(debugReport);
_bundleListViewer.FillViewData(debugReport);
}
// 发送采集数据的命令
RemoteCommand command = new RemoteCommand();
command.CommandType = (int)ERemoteCommand.SampleAuto;
command.CommandParam = evt.newValue ? "open" : "close";
byte[] data = RemoteCommand.Serialize(command);
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
}
private void SampleBtn_onClick()
@@ -252,8 +269,8 @@ namespace YooAsset.Editor
command.CommandType = (int)ERemoteCommand.SampleOnce;
command.CommandParam = string.Empty;
byte[] data = RemoteCommand.Serialize(command);
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgSendEditorToPlayer, data);
RemoteDebuggerInRuntime.EditorRequestDebugReport();
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
}
private void ExportBtn_clicked()
{
@@ -288,6 +305,7 @@ namespace YooAsset.Editor
{
_assetListViewer.RebuildView(_searchKeyWord);
_bundleListViewer.RebuildView(_searchKeyWord);
_operationListViewer.RebuildView(_searchKeyWord);
}
}
private void OnViewModeMenuChange(DropdownMenuAction action)
@@ -303,16 +321,27 @@ namespace YooAsset.Editor
{
_assetListViewer.AttachParent(root);
_bundleListViewer.DetachParent();
_operationListViewer.DetachParent();
}
else if (viewMode == EViewMode.BundleView)
{
_assetListViewer.DetachParent();
_bundleListViewer.AttachParent(root);
_operationListViewer.DetachParent();
}
else if (viewMode == EViewMode.OperationView)
{
_assetListViewer.DetachParent();
_bundleListViewer.DetachParent();
_operationListViewer.AttachParent(root);
}
else
{
throw new NotImplementedException(viewMode.ToString());
}
// 重新绘制该帧数据
RepaintFrame(_lastRepaintIndex);
}
}
private DropdownMenuAction.Status OnViewModeMenuStatusUpdate(DropdownMenuAction action)
@@ -323,6 +352,63 @@ namespace YooAsset.Editor
else
return DropdownMenuAction.Status.Normal;
}
private RemotePlayerSession GetOrCreatePlayerSession(int playerId)
{
if (_playerSessions.TryGetValue(playerId, out RemotePlayerSession session))
{
return session;
}
else
{
RemotePlayerSession newSession = new RemotePlayerSession(playerId);
_playerSessions.Add(playerId, newSession);
return newSession;
}
}
private void RepaintFrame(int repaintIndex)
{
if (_currentPlayerSession == null)
{
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
return;
}
var debugReport = _currentPlayerSession.GetDebugReport(repaintIndex);
if (debugReport != null)
{
_lastRepaintIndex = repaintIndex;
_currentReport = debugReport;
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
_frameSlider.highValue = _currentPlayerSession.MaxRangeValue;
_frameSlider.value = repaintIndex;
if (_viewMode == EViewMode.AssetView)
{
_assetListViewer.FillViewData(debugReport);
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
}
else if (_viewMode == EViewMode.BundleView)
{
_assetListViewer.ClearView();
_bundleListViewer.FillViewData(debugReport);
_operationListViewer.ClearView();
}
else if (_viewMode == EViewMode.OperationView)
{
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.FillViewData(debugReport);
}
else
{
throw new System.NotImplementedException(_viewMode.ToString());
}
}
}
}
}
#endif

View File

@@ -1,7 +1,7 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:Toolbar name="TopToolbar" style="display: flex;">
<ui:Label text="Player" display-tooltip-when-elided="true" name="PlayerName" style="width: 200px; -unity-text-align: lower-left; padding-left: 5px;" />
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" />
<uie:ToolbarButton text="IP" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PlayerName" style="width: 200px;" />
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 150px; flex-grow: 0;" />
<uie:ToolbarSearchField focusable="true" name="SearchField" style="flex-grow: 1;" />
<uie:ToolbarButton text="Refresh" display-tooltip-when-elided="true" name="SampleButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
<uie:ToolbarButton text="Export" display-tooltip-when-elided="true" name="ExportButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
@@ -11,5 +11,6 @@
<uie:ToolbarButton text=" &lt;&lt; " display-tooltip-when-elided="true" name="FrameLast" />
<uie:ToolbarButton text=" &gt;&gt; " display-tooltip-when-elided="true" name="FrameNext" />
<uie:ToolbarButton text="Clear" display-tooltip-when-elided="true" name="FrameClear" />
<YooAsset.Editor.ToggleRecord name="FrameRecord" style="width: 20px;" />
</uie:Toolbar>
</ui:UXML>

View File

@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace YooAsset.Editor
{
internal class RemotePlayerSession
{
private readonly List<DebugReport> _reportList = new List<DebugReport>();
private readonly Queue<DebugReport> _reports = new Queue<DebugReport>();
/// <summary>
/// 用户ID
@@ -29,7 +30,7 @@ namespace YooAsset.Editor
{
get
{
int index = _reportList.Count - 1;
int index = _reports.Count - 1;
if (index < 0)
index = 0;
return index;
@@ -37,7 +38,7 @@ namespace YooAsset.Editor
}
public RemotePlayerSession(int playerId, int maxReportCount = 1000)
public RemotePlayerSession(int playerId, int maxReportCount = 500)
{
PlayerId = playerId;
MaxReportCount = maxReportCount;
@@ -48,7 +49,7 @@ namespace YooAsset.Editor
/// </summary>
public void ClearDebugReport()
{
_reportList.Clear();
_reports.Clear();
}
/// <summary>
@@ -59,9 +60,9 @@ namespace YooAsset.Editor
if (report == null)
Debug.LogWarning("Invalid debug report data !");
if (_reportList.Count >= MaxReportCount)
_reportList.RemoveAt(0);
_reportList.Add(report);
if (_reports.Count >= MaxReportCount)
_reports.Dequeue();
_reports.Enqueue(report);
}
/// <summary>
@@ -69,11 +70,11 @@ namespace YooAsset.Editor
/// </summary>
public DebugReport GetDebugReport(int rangeIndex)
{
if (_reportList.Count == 0)
if (_reports.Count == 0)
return null;
if (rangeIndex < 0 || rangeIndex >= _reportList.Count)
if (rangeIndex < 0 || rangeIndex >= _reports.Count)
return null;
return _reportList[rangeIndex];
return _reports.ElementAt(rangeIndex);
}
/// <summary>

View File

@@ -24,10 +24,9 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private TableView _providerTableView;
private TableView _dependTableView;
private TableViewer _providerTableView;
private TableViewer _dependTableView;
private DebugReport _debugReport;
private List<ITableData> _sourceDatas;
@@ -45,21 +44,20 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f;
// 资源列表
_providerTableView = _root.Q<TableView>("TopTableView");
_providerTableView = _root.Q<TableViewer>("TopTableView");
_providerTableView.SelectionChangedEvent = OnProviderTableViewSelectionChanged;
CreateAssetTableViewColumns();
// 依赖列表
_dependTableView = _root.Q<TableView>("BottomTableView");
_dependTableView = _root.Q<TableViewer>("BottomTableView");
CreateDependTableViewColumns();
#if UNITY_2020_3_OR_NEWER
// 面板分屏
var topGroup = _root.Q<VisualElement>("TopGroup");
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
topGroup.style.minHeight = 100;
bottomGroup.style.minHeight = 100f;
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
#endif
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
}
private void CreateAssetTableViewColumns()
{
@@ -90,6 +88,7 @@ namespace YooAsset.Editor
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
columnStyle.Counter = true;
var column = new TableColumn("AssetPath", "Asset Path", columnStyle);
column.MakeCell = () =>
{
@@ -126,13 +125,13 @@ namespace YooAsset.Editor
_providerTableView.AddColumn(column);
}
// SpawnTime
// BeginTime
{
var columnStyle = new ColumnStyle(100);
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
var column = new TableColumn("SpawnTime", "Spawn Time", columnStyle);
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
column.MakeCell = () =>
{
var label = new Label();
@@ -149,10 +148,11 @@ namespace YooAsset.Editor
// LoadingTime
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle(130);
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
columnStyle.Units = "ms";
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
column.MakeCell = () =>
{
@@ -226,6 +226,7 @@ namespace YooAsset.Editor
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
columnStyle.Counter = true;
var column = new TableColumn("DependBundles", "Depend Bundles", columnStyle);
column.MakeCell = () =>
{
@@ -279,7 +280,7 @@ namespace YooAsset.Editor
{
StyleColor textColor;
var dependTableData = data as DependTableData;
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed)
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow);
else
textColor = new StyleColor(Color.white);
@@ -297,8 +298,6 @@ namespace YooAsset.Editor
/// </summary>
public void FillViewData(DebugReport debugReport)
{
_debugReport = debugReport;
// 清空旧数据
_providerTableView.ClearAll(false, true);
_dependTableView.ClearAll(false, true);
@@ -315,7 +314,7 @@ namespace YooAsset.Editor
rowData.AddAssetPathCell("PackageName", packageData.PackageName);
rowData.AddStringValueCell("AssetPath", providerInfo.AssetPath);
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
rowData.AddStringValueCell("SpawnTime", providerInfo.SpawnTime);
rowData.AddStringValueCell("BeginTime", providerInfo.BeginTime);
rowData.AddLongValueCell("LoadingTime", providerInfo.LoadingTime);
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
rowData.AddStringValueCell("Status", providerInfo.Status.ToString());
@@ -333,10 +332,11 @@ namespace YooAsset.Editor
/// </summary>
public void ClearView()
{
_debugReport = null;
_providerTableView.ClearAll(false, true);
_providerTableView.RebuildView();
_dependTableView.ClearAll(false, true);
RebuildView(null);
_dependTableView.RebuildView();
}
/// <summary>
@@ -345,10 +345,12 @@ namespace YooAsset.Editor
public void RebuildView(string searchKeyWord)
{
// 搜索匹配
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
if (_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图
_providerTableView.RebuildView();
_dependTableView.RebuildView();
}
/// <summary>

View File

@@ -1,8 +1,8 @@
<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" />
<YooAsset.Editor.TableViewer name="TopTableView" />
</ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; 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: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;">
<YooAsset.Editor.TableView name="BottomTableView" />
<YooAsset.Editor.TableViewer name="BottomTableView" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -28,11 +28,10 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private TableView _bundleTableView;
private TableView _usingTableView;
private TableView _referenceTableView;
private TableViewer _bundleTableView;
private TableViewer _usingTableView;
private TableViewer _referenceTableView;
private DebugReport _debugReport;
private List<ITableData> _sourceDatas;
/// <summary>
@@ -49,26 +48,25 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f;
// 资源包列表
_bundleTableView = _root.Q<TableView>("BundleTableView");
_bundleTableView = _root.Q<TableViewer>("BundleTableView");
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
CreateBundleTableViewColumns();
// 使用列表
_usingTableView = _root.Q<TableView>("UsingTableView");
_usingTableView = _root.Q<TableViewer>("UsingTableView");
CreateUsingTableViewColumns();
// 引用列表
_referenceTableView = _root.Q<TableView>("ReferenceTableView");
_referenceTableView = _root.Q<TableViewer>("ReferenceTableView");
CreateReferenceTableViewColumns();
#if UNITY_2020_3_OR_NEWER
// 面板分屏
var topGroup = _root.Q<VisualElement>("TopGroup");
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
topGroup.style.minHeight = 100;
bottomGroup.style.minHeight = 100f;
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
PanelSplitView.SplitVerticalPanel(bottomGroup, _usingTableView, _referenceTableView);
#endif
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
UIElementsTools.SplitVerticalPanel(bottomGroup, _usingTableView, _referenceTableView);
}
private void CreateBundleTableViewColumns()
{
@@ -99,6 +97,7 @@ namespace YooAsset.Editor
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
columnStyle.Counter = true;
var column = new TableColumn("BundleName", "Bundle Name", columnStyle);
column.MakeCell = () =>
{
@@ -152,7 +151,7 @@ namespace YooAsset.Editor
{
StyleColor textColor;
var bundleTableData = data as BundleTableData;
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed)
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow);
else
textColor = new StyleColor(Color.white);
@@ -172,6 +171,7 @@ namespace YooAsset.Editor
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
columnStyle.Counter = true;
var column = new TableColumn("UsingAssets", "Using Assets", columnStyle);
column.MakeCell = () =>
{
@@ -208,13 +208,13 @@ namespace YooAsset.Editor
_usingTableView.AddColumn(column);
}
// SpawnTime
// BeginTime
{
var columnStyle = new ColumnStyle(100);
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
var column = new TableColumn("SpawnTime", "Spawn Time", columnStyle);
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
column.MakeCell = () =>
{
var label = new Label();
@@ -287,6 +287,7 @@ namespace YooAsset.Editor
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
columnStyle.Counter = true;
var column = new TableColumn("ReferenceBundle", "Reference Bundle", columnStyle);
column.MakeCell = () =>
{
@@ -340,7 +341,7 @@ namespace YooAsset.Editor
{
StyleColor textColor;
var feferenceTableData = data as ReferenceTableData;
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed)
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow);
else
textColor = new StyleColor(Color.white);
@@ -358,8 +359,6 @@ namespace YooAsset.Editor
/// </summary>
public void FillViewData(DebugReport debugReport)
{
_debugReport = debugReport;
// 清空旧数据
_bundleTableView.ClearAll(false, true);
_usingTableView.ClearAll(false, true);
@@ -392,11 +391,12 @@ namespace YooAsset.Editor
/// </summary>
public void ClearView()
{
_debugReport = null;
_bundleTableView.ClearAll(false, true);
_bundleTableView.RebuildView();
_usingTableView.ClearAll(false, true);
_usingTableView.RebuildView();
_referenceTableView.ClearAll(false, true);
_referenceTableView.RebuildView();
}
@@ -407,10 +407,13 @@ namespace YooAsset.Editor
public void RebuildView(string searchKeyWord)
{
// 搜索匹配
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
if(_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图
_bundleTableView.RebuildView();
_usingTableView.RebuildView();
_referenceTableView.RebuildView();
}
/// <summary>
@@ -448,7 +451,7 @@ namespace YooAsset.Editor
rowData.ProviderInfo = providerInfo;
rowData.AddStringValueCell("UsingAssets", providerInfo.AssetPath);
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
rowData.AddStringValueCell("SpawnTime", providerInfo.SpawnTime);
rowData.AddStringValueCell("BeginTime", providerInfo.BeginTime);
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
rowData.AddStringValueCell("Status", providerInfo.Status);
sourceDatas.Add(rowData);

View File

@@ -1,9 +1,9 @@
<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="BundleTableView" />
<YooAsset.Editor.TableViewer name="BundleTableView" />
</ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 400px; 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: 1px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="UsingTableView" />
<YooAsset.Editor.TableView name="ReferenceTableView" />
<YooAsset.Editor.TableViewer name="UsingTableView" />
<YooAsset.Editor.TableViewer name="ReferenceTableView" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -0,0 +1,509 @@
#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 TableViewer _operationTableView;
private Toolbar _bottomToolbar;
private TreeViewer _childTreeView;
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<TableViewer>("TopTableView");
_operationTableView.SelectionChangedEvent = OnOperationTableViewSelectionChanged;
CreateOperationTableViewColumns();
// 底部标题栏
_bottomToolbar = _root.Q<Toolbar>("BottomToolbar");
CreateBottomToolbarHeaders();
// 子列表
_childTreeView = _root.Q<TreeViewer>("BottomTreeView");
_childTreeView.makeItem = MakeTreeViewItem;
_childTreeView.bindItem = BindTreeViewItem;
// 面板分屏
var topGroup = _root.Q<VisualElement>("TopGroup");
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
topGroup.style.minHeight = 100;
bottomGroup.style.minHeight = 100f;
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
}
private void CreateOperationTableViewColumns()
{
// PackageName
{
var columnStyle = new ColumnStyle(200);
columnStyle.Searchable = true;
columnStyle.Sortable = 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(130);
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
columnStyle.Units = "ms";
var column = new TableColumn("ProcessTime", "Process 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);
}
// Desc
{
var columnStyle = new ColumnStyle(500, 500, 1000);
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
var column = new TableColumn("Desc", "Desc", 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);
}
}
private void CreateBottomToolbarHeaders()
{
// OperationName
{
ToolbarButton button = new ToolbarButton();
button.text = "OperationName";
button.style.flexGrow = 0;
button.style.width = 315;
_bottomToolbar.Add(button);
}
// Progress
{
ToolbarButton button = new ToolbarButton();
button.text = "Progress";
button.style.flexGrow = 0;
button.style.width = 100;
_bottomToolbar.Add(button);
}
// BeginTime
{
ToolbarButton button = new ToolbarButton();
button.text = "BeginTime";
button.style.flexGrow = 0;
button.style.width = 100;
_bottomToolbar.Add(button);
}
// ProcessTime
{
ToolbarButton button = new ToolbarButton();
button.text = "ProcessTime (ms)";
button.style.flexGrow = 0;
button.style.width = 130;
_bottomToolbar.Add(button);
}
// Status
{
ToolbarButton button = new ToolbarButton();
button.text = "Status";
button.style.flexGrow = 0;
button.style.width = 100;
_bottomToolbar.Add(button);
}
// Desc
{
ToolbarButton button = new ToolbarButton();
button.text = "Desc";
button.style.flexGrow = 0;
button.style.width = 500;
_bottomToolbar.Add(button);
}
}
/// <summary>
/// 填充页面数据
/// </summary>
public void FillViewData(DebugReport debugReport)
{
// 清空旧数据
_operationTableView.ClearAll(false, true);
_childTreeView.ClearAll();
_childTreeView.RebuildView();
// 填充数据源
_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());
rowData.AddStringValueCell("Desc", operationInfo.OperationDesc);
_sourceDatas.Add(rowData);
}
}
_operationTableView.itemsSource = _sourceDatas;
// 重建视图
RebuildView(null);
}
/// <summary>
/// 清空页面
/// </summary>
public void ClearView()
{
_operationTableView.ClearAll(false, true);
_operationTableView.RebuildView();
_childTreeView.ClearAll();
_childTreeView.RebuildView();
}
/// <summary>
/// 重建视图
/// </summary>
public void RebuildView(string searchKeyWord)
{
// 搜索匹配
if(_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图
_operationTableView.RebuildView();
_childTreeView.RebuildView();
}
/// <summary>
/// 挂接到父类页面上
/// </summary>
public void AttachParent(VisualElement parent)
{
parent.Add(_root);
}
/// <summary>
/// 从父类页面脱离开
/// </summary>
public void DetachParent()
{
_root.RemoveFromHierarchy();
}
private void OnOperationTableViewSelectionChanged(ITableData data)
{
var operationTableData = data as OperationTableData;
DebugPackageData packageData = operationTableData.PackageData;
DebugOperationInfo operationInfo = operationTableData.OperationInfo;
TreeNode rootNode = new TreeNode(operationInfo);
FillTreeData(operationInfo, rootNode);
_childTreeView.ClearAll();
_childTreeView.SetRootItem(rootNode);
_childTreeView.RebuildView();
}
private void MakeTreeViewItem(VisualElement container)
{
// OperationName
{
Label label = new Label();
label.name = "OperationName";
label.style.flexGrow = 0f;
label.style.width = 300;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}
// Progress
{
var label = new Label();
label.name = "Progress";
label.style.flexGrow = 0f;
label.style.width = 100;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}
// BeginTime
{
var label = new Label();
label.name = "BeginTime";
label.style.flexGrow = 0f;
label.style.width = 100;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}
// ProcessTime
{
var label = new Label();
label.name = "ProcessTime";
label.style.flexGrow = 0f;
label.style.width = 130;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}
// Status
{
var label = new Label();
label.name = "Status";
label.style.flexGrow = 0f;
label.style.width = 100;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}
// Desc
{
Label label = new Label();
label.name = "Desc";
label.style.flexGrow = 1f;
label.style.width = 500;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}
}
private void BindTreeViewItem(VisualElement container, object userData)
{
var operationInfo = (DebugOperationInfo)userData;
// OperationName
{
var label = container.Q<Label>("OperationName");
label.text = operationInfo.OperationName;
}
// Progress
{
var label = container.Q<Label>("Progress");
label.text = operationInfo.Progress.ToString();
}
// BeginTime
{
var label = container.Q<Label>("BeginTime");
label.text = operationInfo.BeginTime;
}
// ProcessTime
{
var label = container.Q<Label>("ProcessTime");
label.text = operationInfo.ProcessTime.ToString();
}
// Status
{
StyleColor textColor;
if (operationInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow);
else
textColor = new StyleColor(Color.white);
var label = container.Q<Label>("Status");
label.text = operationInfo.Status;
label.style.color = textColor;
}
// Desc
{
var label = container.Q<Label>("Desc");
label.text = operationInfo.OperationDesc;
}
}
private void FillTreeData(DebugOperationInfo parentOperation, TreeNode rootNode)
{
foreach (var childOperation in parentOperation.Childs)
{
var childNode = new TreeNode(childOperation);
rootNode.AddChild(childNode);
FillTreeData(childOperation, childNode);
}
}
}
}
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 88e4ec854876f3f40bce38bc880c0f6a
guid: faabdaf3787cba6438d2300f7f71e26f
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,9 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
<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.TableViewer name="TopTableView" />
</ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="flex-grow: 1;">
<uie:Toolbar name="BottomToolbar" />
<YooAsset.Editor.TreeViewer name="BottomTreeView" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7147c7108cba1bb4dba3a2cfc758ad43
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@@ -24,8 +24,8 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private TableView _assetTableView;
private TableView _dependTableView;
private TableViewer _assetTableView;
private TableViewer _dependTableView;
private BuildReport _buildReport;
private string _reportFilePath;
@@ -46,23 +46,22 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f;
// 资源列表
_assetTableView = _root.Q<TableView>("TopTableView");
_assetTableView = _root.Q<TableViewer>("TopTableView");
_assetTableView.SelectionChangedEvent = OnAssetTableViewSelectionChanged;
_assetTableView.ClickTableDataEvent = OnClickAssetTableView;
CreateAssetTableViewColumns();
// 依赖列表
_dependTableView = _root.Q<TableView>("BottomTableView");
_dependTableView = _root.Q<TableViewer>("BottomTableView");
_dependTableView.ClickTableDataEvent = OnClickBundleTableView;
CreateDependTableViewColumns();
#if UNITY_2020_3_OR_NEWER
// 面板分屏
var topGroup = _root.Q<VisualElement>("TopGroup");
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
topGroup.style.minHeight = 100;
bottomGroup.style.minHeight = 100f;
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
#endif
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
}
private void CreateAssetTableViewColumns()
{

View File

@@ -1,8 +1,8 @@
<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" style="flex-grow: 1;" />
<YooAsset.Editor.TableViewer name="TopTableView" style="flex-grow: 1;" />
</ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; 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: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;">
<YooAsset.Editor.TableView name="BottomTableView" style="flex-grow: 1;" />
<YooAsset.Editor.TableViewer name="BottomTableView" style="flex-grow: 1;" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -24,8 +24,8 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private TableView _bundleTableView;
private TableView _includeTableView;
private TableViewer _bundleTableView;
private TableViewer _includeTableView;
private BuildReport _buildReport;
private string _reportFilePath;
@@ -46,13 +46,13 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f;
// 资源包列表
_bundleTableView = _root.Q<TableView>("TopTableView");
_bundleTableView = _root.Q<TableViewer>("TopTableView");
_bundleTableView.ClickTableDataEvent = OnClickBundleTableView;
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
CreateBundleTableViewColumns();
// 包含列表
_includeTableView = _root.Q<TableView>("BottomTableView");
_includeTableView = _root.Q<TableViewer>("BottomTableView");
_includeTableView.ClickTableDataEvent = OnClickIncludeTableView;
CreateIncludeTableViewColumns();
@@ -61,7 +61,7 @@ namespace YooAsset.Editor
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
topGroup.style.minHeight = 100;
bottomGroup.style.minHeight = 100f;
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
#endif
}
private void CreateBundleTableViewColumns()

View File

@@ -1,8 +1,8 @@
<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" style="flex-grow: 1;" />
<YooAsset.Editor.TableViewer name="TopTableView" style="flex-grow: 1;" />
</ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; 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: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;">
<YooAsset.Editor.TableView name="BottomTableView" style="flex-grow: 1;" />
<YooAsset.Editor.TableViewer name="BottomTableView" style="flex-grow: 1;" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -1,41 +0,0 @@
#if UNITY_2019_4_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
/// <summary>
/// 显示开关(眼睛图标)
/// </summary>
public class DisplayToggle : Toggle
{
private readonly VisualElement _checkbox;
public DisplayToggle()
{
_checkbox = this.Q<VisualElement>("unity-checkmark");
RefreshIcon();
}
/// <summary>
/// 刷新图标
/// </summary>
public void RefreshIcon()
{
if (this.value)
{
var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleoff@2x").image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
else
{
var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleon@2x").image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
}
}
}
#endif

View File

@@ -1,36 +0,0 @@
#if UNITY_2020_3_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
/// <summary>
/// 分屏控件
/// </summary>
public class PanelSplitView : TwoPaneSplitView
{
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
{
}
/// <summary>
/// 竖版分屏
/// </summary>
public static void SplitVerticalPanel(VisualElement root, VisualElement panelA, VisualElement panelB)
{
root.Remove(panelA);
root.Remove(panelB);
var spliteView = new PanelSplitView();
spliteView.fixedPaneInitialDimension = 300;
spliteView.orientation = TwoPaneSplitViewOrientation.Vertical;
spliteView.contentContainer.Add(panelA);
spliteView.contentContainer.Add(panelB);
root.Add(spliteView);
}
}
}
#endif

View File

@@ -0,0 +1,55 @@
#if UNITY_2019_4_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
/// <summary>
/// 显示开关(眼睛图标)
/// </summary>
public class ToggleDisplay : Toggle
{
public new class UxmlFactory : UxmlFactory<ToggleDisplay, UxmlTraits>
{
}
private readonly VisualElement _checkbox;
public ToggleDisplay()
{
_checkbox = this.Q<VisualElement>("unity-checkmark");
RefreshIcon();
}
public override void SetValueWithoutNotify(bool newValue)
{
base.SetValueWithoutNotify(newValue);
RefreshIcon();
}
#if UNITY_2021_3_OR_NEWER
protected override void ToggleValue()
{
base.ToggleValue();
RefreshIcon();
}
#endif
private void RefreshIcon()
{
if (this.value)
{
var icon = EditorGUIUtility.IconContent(UIElementsIcon.VisibilityToggleOff).image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
else
{
var icon = EditorGUIUtility.IconContent(UIElementsIcon.VisibilityToggleOn).image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
}
}
}
#endif

View File

@@ -0,0 +1,55 @@
#if UNITY_2019_4_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
/// <summary>
/// 折叠开关
/// </summary>
public class ToggleFoldout : Toggle
{
public new class UxmlFactory : UxmlFactory<ToggleFoldout, UxmlTraits>
{
}
private readonly VisualElement _checkbox;
public ToggleFoldout()
{
_checkbox = this.Q<VisualElement>("unity-checkmark");
RefreshIcon();
}
public override void SetValueWithoutNotify(bool newValue)
{
base.SetValueWithoutNotify(newValue);
RefreshIcon();
}
#if UNITY_2021_3_OR_NEWER
protected override void ToggleValue()
{
base.ToggleValue();
RefreshIcon();
}
#endif
public void RefreshIcon()
{
if (this.value)
{
var icon = EditorGUIUtility.IconContent(UIElementsIcon.FoldoutOn).image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
else
{
var icon = EditorGUIUtility.IconContent(UIElementsIcon.FoldoutOff).image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
}
}
}
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 07f7c95e8e42fd04f81b9925b2dcf0d0
guid: 2619997e70d98794da26a947f9129e25
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,55 @@
#if UNITY_2019_4_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
/// <summary>
/// 录制开关
/// </summary>
public class ToggleRecord : Toggle
{
public new class UxmlFactory : UxmlFactory<ToggleRecord, UxmlTraits>
{
}
private readonly VisualElement _checkbox;
public ToggleRecord()
{
_checkbox = this.Q<VisualElement>("unity-checkmark");
RefreshIcon();
}
public override void SetValueWithoutNotify(bool newValue)
{
base.SetValueWithoutNotify(newValue);
RefreshIcon();
}
#if UNITY_2021_3_OR_NEWER
protected override void ToggleValue()
{
base.ToggleValue();
RefreshIcon();
}
#endif
private void RefreshIcon()
{
if (this.value)
{
var icon = EditorGUIUtility.IconContent(UIElementsIcon.RecordOn).image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
else
{
var icon = EditorGUIUtility.IconContent(UIElementsIcon.RecordOff).image as Texture2D;
_checkbox.style.backgroundImage = icon;
}
}
}
}
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0c3f4136cf7142346ae33e8a82cbdb27
guid: 4eace285493a0844f8a8b8f4a4ea02d8
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -46,6 +46,11 @@ namespace YooAsset.Editor
/// </summary>
public bool Counter = false;
/// <summary>
/// 展示单位
/// </summary>
public string Units = string.Empty;
public ColumnStyle(Length width)
{
if (width.value > MaxValue)

View File

@@ -13,9 +13,9 @@ namespace YooAsset.Editor
/// <summary>
/// Unity2022版本以上推荐官方类MultiColumnListView组件
/// </summary>
public class TableView : VisualElement
public class TableViewer : VisualElement
{
public new class UxmlFactory : UxmlFactory<TableView, UxmlTraits>
public new class UxmlFactory : UxmlFactory<TableViewer, UxmlTraits>
{
}
@@ -82,7 +82,7 @@ namespace YooAsset.Editor
public Action<ITableData> SelectionChangedEvent;
public TableView()
public TableViewer()
{
this.style.flexShrink = 1f;
this.style.flexGrow = 1f;
@@ -214,6 +214,16 @@ namespace YooAsset.Editor
}
}
// 设置展示单位
foreach (var column in _columns)
{
if (string.IsNullOrEmpty(column.ColumnStyle.Units) == false)
{
var toobarButton = GetHeaderElement(column.ElementName) as ToolbarButton;
toobarButton.text = $"{toobarButton.text} ({column.ColumnStyle.Units})";
}
}
// 设置升降符号
if (string.IsNullOrEmpty(_sortingHeader) == false)
{

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1797f960cdbd5aa41a96bb02d16c4998
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
#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
{
public class TreeNode
{
/// <summary>
/// 子节点集合
/// </summary>
public List<TreeNode> Children = new List<TreeNode>(10);
/// <summary>
/// 父节点
/// </summary>
public TreeNode Parent { get; set; }
/// <summary>
/// 用户数据
/// </summary>
public object UserData { get; set; }
/// <summary>
/// 是否展开
/// </summary>
public bool IsExpanded { get; set; } = false;
public TreeNode(object userData)
{
UserData = userData;
}
/// <summary>
/// 添加子节点
/// </summary>
public void AddChild(TreeNode child)
{
child.Parent = this;
Children.Add(child);
}
/// <summary>
/// 清理所有子节点
/// </summary>
public void ClearChildren()
{
foreach(var child in Children)
{
child.Parent = null;
}
Children.Clear();
}
/// <summary>
/// 计算节点的深度
/// </summary>
public int GetDepth()
{
int depth = 0;
TreeNode current = this;
while (current.Parent != null)
{
depth++;
current = current.Parent;
}
return depth;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 473cdc8e1dd7b0f43938ddb99287a2a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,152 @@
#if UNITY_2019_4_OR_NEWER
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
public class TreeViewer : VisualElement
{
public new class UxmlFactory : UxmlFactory<TreeViewer, UxmlTraits>
{
}
private readonly ListView _listView;
private readonly List<TreeNode> _flattenList = new List<TreeNode>(1000);
private readonly List<TreeNode> _rootList = new List<TreeNode>(100);
/// <summary>
/// 制作列表元素
/// </summary>
public Action<VisualElement> makeItem { get; set; }
/// <summary>
/// 绑定列表数据
/// </summary>
public Action<VisualElement, object> bindItem { get; set; }
public TreeViewer()
{
this.style.flexShrink = 1f;
this.style.flexGrow = 1f;
// 创建ListView
_listView = new ListView();
_listView.style.flexShrink = 1f;
_listView.style.flexGrow = 1f;
_listView.itemsSource = _flattenList;
_listView.makeItem = MakeItemInternal;
_listView.bindItem = BindItemInternal;
this.Add(_listView);
}
/// <summary>
/// 设置根节点数据
/// </summary>
public void SetRootItem(TreeNode rootNode)
{
_rootList.Add(rootNode);
}
/// <summary>
/// 设置根节点数据
/// </summary>
public void SetRootItems(List<TreeNode> rootNodes)
{
_rootList.AddRange(rootNodes);
}
/// <summary>
/// 清理数据
/// </summary>
public void ClearAll()
{
_rootList.Clear();
}
/// <summary>
/// 重新绘制视图
/// </summary>
public void RebuildView()
{
_flattenList.Clear();
foreach (var treeRoot in _rootList)
{
FlattenTree(treeRoot, 0);
}
_listView.Rebuild();
}
/// <summary>
/// 将树形结构扁平化为列表
/// </summary>
private void FlattenTree(TreeNode node, int depth)
{
_flattenList.Add(node);
if (node.IsExpanded)
{
foreach (var child in node.Children)
{
FlattenTree(child, depth + 1);
}
}
}
private VisualElement MakeItemInternal()
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Row;
// 折叠按钮
var toggle = new ToggleFoldout();
toggle.text = string.Empty;
toggle.name = "foldout";
toggle.style.alignSelf = Align.Center;
toggle.style.width = 15;
toggle.style.height = 15;
toggle.RegisterValueChangedCallback((ChangeEvent<bool> callback) =>
{
var treeNode = toggle.userData as TreeNode;
treeNode.IsExpanded = toggle.value;
RebuildView();
});
container.Add(toggle);
// 用户自定义元素
if (makeItem != null)
{
makeItem.Invoke(container);
}
return container;
}
private void BindItemInternal(VisualElement item, int index)
{
var treeNode = _flattenList[index];
// 设置折叠状态
var toggle = item.Q<ToggleFoldout>("foldout");
toggle.SetValueWithoutNotify(treeNode.IsExpanded);
toggle.userData = treeNode;
toggle.style.marginLeft = treeNode.GetDepth() * 15;
// 隐藏折叠按钮
if (treeNode.Children.Count == 0)
{
toggle.style.visibility = Visibility.Hidden;
}
// 用户自定义元素
if (bindItem != null)
{
bindItem.Invoke(item, treeNode.UserData);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db2fb30e2d4512149b615fe6b2562ecd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
#if UNITY_2019_4_OR_NEWER
namespace YooAsset.Editor
{
/// <summary>
/// 引擎图标名称
/// </summary>
public class UIElementsIcon
{
public const string RecordOn = "d_Record On@2x";
public const string RecordOff = "d_Record Off@2x";
#if UNITY_2019
public const string FoldoutOn = "IN foldout on";
public const string FoldoutOff = "IN foldout";
#else
public const string FoldoutOn = "d_IN_foldout_on@2x";
public const string FoldoutOff = "d_IN_foldout@2x";
#endif
public const string VisibilityToggleOff = "animationvisibilitytoggleoff@2x";
public const string VisibilityToggleOn = "animationvisibilitytoggleon@2x";
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41af337b41140c842b4b9f34a34f5cc6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -32,6 +32,34 @@ namespace YooAsset.Editor
label.style.minWidth = minWidth;
}
}
/// <summary>
/// 设置按钮图标
/// </summary>
public static void SetToolbarButtonIcon(ToolbarButton element, string iconName)
{
var image = EditorGUIUtility.IconContent(iconName).image as Texture2D;
element.style.backgroundImage = image;
element.text = string.Empty;
}
/// <summary>
/// 竖版分屏
/// </summary>
public static void SplitVerticalPanel(VisualElement root, VisualElement panelA, VisualElement panelB)
{
#if UNITY_2020_3_OR_NEWER
root.Remove(panelA);
root.Remove(panelB);
var spliteView = new TwoPaneSplitView();
spliteView.fixedPaneInitialDimension = 300;
spliteView.orientation = TwoPaneSplitViewOrientation.Vertical;
spliteView.contentContainer.Add(panelA);
spliteView.contentContainer.Add(panelB);
root.Add(spliteView);
#endif
}
}
}
#endif

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace YooAsset
{
[Serializable]
internal class DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
internal struct DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
{
/// <summary>
/// 资源包名称
@@ -20,7 +20,7 @@ namespace YooAsset
/// <summary>
/// 加载状态
/// </summary>
public EOperationStatus Status;
public string Status;
/// <summary>
/// 谁引用了该资源包

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset
{
[Serializable]
internal struct DebugOperationInfo : IComparer<DebugOperationInfo>, IComparable<DebugOperationInfo>
{
/// <summary>
/// 任务名称
/// </summary>
public string OperationName;
/// <summary>
/// 任务说明
/// </summary>
public string OperationDesc;
/// <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;
/// <summary>
/// 子任务列表
/// TODO : Serialization depth limit 10 exceeded
/// </summary>
public List<DebugOperationInfo> Childs;
public int CompareTo(DebugOperationInfo other)
{
return Compare(this, other);
}
public int Compare(DebugOperationInfo a, DebugOperationInfo b)
{
return string.CompareOrdinal(a.OperationName, b.OperationName);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 942ce6ad7b4427d4d87a8a29c8b9371f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,15 +13,9 @@ namespace YooAsset
/// </summary>
public string PackageName;
/// <summary>
/// 调试数据列表
/// </summary>
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
/// <summary>
/// 调试数据列表
/// </summary>
public List<DebugBundleInfo> BundleInfos = new List<DebugBundleInfo>(1000);
public List<DebugOperationInfo> OperationInfos = new List<DebugOperationInfo>(1000);
[NonSerialized]
@@ -53,7 +47,7 @@ namespace YooAsset
else
{
UnityEngine.Debug.LogError($"Can not found {nameof(DebugBundleInfo)} : {bundleName}");
return null;
return default;
}
}
}

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace YooAsset
{
[Serializable]
internal class DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
internal struct DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
{
/// <summary>
/// 包裹名
@@ -23,9 +23,9 @@ namespace YooAsset
public string SpawnScene;
/// <summary>
/// 资源出生的时间
/// 资源加载开始时间
/// </summary>
public string SpawnTime;
public string BeginTime;
/// <summary>
/// 加载耗时(单位:毫秒)

View File

@@ -12,6 +12,11 @@ namespace YooAsset
[Serializable]
internal class DebugReport
{
/// <summary>
/// 调试器版本
/// </summary>
public string DebuggerVersion = RemoteDebuggerDefine.DebuggerVersion;
/// <summary>
/// 游戏帧
/// </summary>

View File

@@ -10,6 +10,11 @@ namespace YooAsset
/// 采样一次
/// </summary>
SampleOnce = 0,
/// <summary>
/// 自动采集
/// </summary>
SampleAuto = 1,
}
[Serializable]

View File

@@ -1,11 +1,11 @@
using System;
using System.Text;
namespace YooAsset
{
internal class RemoteDebuggerDefine
{
public static readonly Guid kMsgSendPlayerToEditor = new Guid("e34a5702dd353724aa315fb8011f08c3");
public static readonly Guid kMsgSendEditorToPlayer = new Guid("4d1926c9df5b052469a1c63448b7609a");
public const string DebuggerVersion = "2.3.3";
public static readonly Guid kMsgPlayerSendToEditor = new Guid("e34a5702dd353724aa315fb8011f08c3");
public static readonly Guid kMsgEditorSendToPlayer = new Guid("4d1926c9df5b052469a1c63448b7609a");
}
}

View File

@@ -7,47 +7,66 @@ namespace YooAsset
{
internal class RemoteDebuggerInRuntime : MonoBehaviour
{
#if UNITY_EDITOR
/// <summary>
/// 编辑器下获取报告的回调
/// </summary>
public static Action<int, DebugReport> EditorHandleDebugReportCallback;
private static bool _sampleOnce = false;
private static bool _autoSample = false;
/// <summary>
/// 编辑器下请求报告数据
/// </summary>
public static void EditorRequestDebugReport()
private void Awake()
{
if (UnityEditor.EditorApplication.isPlaying)
{
var report = YooAssets.GetDebugReport();
EditorHandleDebugReportCallback?.Invoke(0, report);
}
#if UNITY_EDITOR
RemotePlayerConnection.Instance.Initialize();
#endif
}
#else
private void OnEnable()
{
PlayerConnection.instance.Register(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
#if UNITY_EDITOR
RemotePlayerConnection.Instance.Register(RemoteDebuggerDefine.kMsgEditorSendToPlayer, OnHandleEditorMessage);
#else
PlayerConnection.instance.Register(RemoteDebuggerDefine.kMsgEditorSendToPlayer, OnHandleEditorMessage);
#endif
}
private void OnDisable()
{
PlayerConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
#if UNITY_EDITOR
RemotePlayerConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgEditorSendToPlayer);
#else
PlayerConnection.instance.Unregister(RemoteDebuggerDefine.kMsgEditorSendToPlayer, OnHandleEditorMessage);
#endif
}
private void OnHandleEditorMessage(MessageEventArgs args)
private void LateUpdate()
{
if (_autoSample || _sampleOnce)
{
_sampleOnce = false;
var debugReport = YooAssets.GetDebugReport();
var data = DebugReport.Serialize(debugReport);
#if UNITY_EDITOR
RemotePlayerConnection.Instance.Send(RemoteDebuggerDefine.kMsgPlayerSendToEditor, data);
#else
PlayerConnection.instance.Send(RemoteDebuggerDefine.kMsgPlayerSendToEditor, data);
#endif
}
}
private static void OnHandleEditorMessage(MessageEventArgs args)
{
var command = RemoteCommand.Deserialize(args.data);
YooLogger.Log($"On handle remote command : {command.CommandType} Param : {command.CommandParam}");
if (command.CommandType == (int)ERemoteCommand.SampleOnce)
{
var debugReport = YooAssets.GetDebugReport();
var data = DebugReport.Serialize(debugReport);
PlayerConnection.instance.Send(RemoteDebuggerDefine.kMsgSendPlayerToEditor, data);
_sampleOnce = true;
}
else if (command.CommandType == (int)ERemoteCommand.SampleAuto)
{
if (command.CommandParam == "open")
_autoSample = true;
else
_autoSample = false;
}
else
{
throw new NotImplementedException(command.CommandType.ToString());
}
}
#endif
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.Networking.PlayerConnection;
using UnityEngine;
namespace YooAsset
{
internal class RemoteEditorConnection
{
private static RemoteEditorConnection _instance;
public static RemoteEditorConnection Instance
{
get
{
if (_instance == null)
_instance = new RemoteEditorConnection();
return _instance;
}
}
private readonly Dictionary<Guid, UnityAction<MessageEventArgs>> _messageCallbacks = new Dictionary<Guid, UnityAction<MessageEventArgs>>();
public void Initialize()
{
_messageCallbacks.Clear();
}
public void Register(Guid messageID, UnityAction<MessageEventArgs> callback)
{
if (messageID == Guid.Empty)
throw new ArgumentException("messageID is empty !");
if (_messageCallbacks.ContainsKey(messageID) == false)
_messageCallbacks.Add(messageID, callback);
}
public void Unregister(Guid messageID)
{
if (_messageCallbacks.ContainsKey(messageID))
_messageCallbacks.Remove(messageID);
}
public void Send(Guid messageID, byte[] data)
{
if (messageID == Guid.Empty)
throw new ArgumentException("messageID is empty !");
// 接收对方的消息
RemotePlayerConnection.Instance.HandleEditorMessage(messageID, data);
}
internal void HandlePlayerMessage(Guid messageID, byte[] data)
{
if (_messageCallbacks.TryGetValue(messageID, out UnityAction<MessageEventArgs> value))
{
var args = new MessageEventArgs();
args.playerId = 0;
args.data = data;
value?.Invoke(args);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 557f37a710d7e2c4d80fe0f778d66463
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.Networking.PlayerConnection;
using UnityEngine;
namespace YooAsset
{
internal class RemotePlayerConnection
{
private static RemotePlayerConnection _instance;
public static RemotePlayerConnection Instance
{
get
{
if (_instance == null)
_instance = new RemotePlayerConnection();
return _instance;
}
}
private readonly Dictionary<Guid, UnityAction<MessageEventArgs>> _messageCallbacks = new Dictionary<Guid, UnityAction<MessageEventArgs>>();
public void Initialize()
{
_messageCallbacks.Clear();
}
public void Register(Guid messageID, UnityAction<MessageEventArgs> callback)
{
if (messageID == Guid.Empty)
throw new ArgumentException("messageID is empty !");
if (_messageCallbacks.ContainsKey(messageID) == false)
_messageCallbacks.Add(messageID, callback);
}
public void Unregister(Guid messageID)
{
if (_messageCallbacks.ContainsKey(messageID))
_messageCallbacks.Remove(messageID);
}
public void Send(Guid messageID, byte[] data)
{
if (messageID == Guid.Empty)
throw new ArgumentException("messageID is empty !");
// 接收对方的消息
RemoteEditorConnection.Instance.HandlePlayerMessage(messageID, data);
}
internal void HandleEditorMessage(Guid messageID, byte[] data)
{
if (_messageCallbacks.TryGetValue(messageID, out UnityAction<MessageEventArgs> value))
{
var args = new MessageEventArgs();
args.playerId = 0;
args.data = data;
value?.Invoke(args);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a726a61cbc448749a4ee80b8c9860b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -110,5 +110,9 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"PackageVersion : {_packageVersion} PackageHash : {_packageHash}";
}
}
}

View File

@@ -100,5 +100,9 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"PackageVersion : {_packageVersion} PackageHash : {_packageHash}";
}
}
}

View File

@@ -100,5 +100,9 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"PackageVersion : {_packageVersion} PackageHash : {_packageHash}";
}
}
}

View File

@@ -113,6 +113,10 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"PackageVersion : {_packageVersion} PackageHash : {_packageHash}";
}
private string GetWebRequestURL(string fileName)
{

View File

@@ -110,5 +110,9 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"PackageVersion : {_packageVersion} PackageHash : {_packageHash}";
}
}
}

View File

@@ -35,6 +35,11 @@ namespace YooAsset
DownloadProgress = 0;
}
internal override string InternalGetDesc()
{
return $"RefCount : {RefCount}";
}
/// <summary>
/// 减少引用计数
/// </summary>

View File

@@ -8,11 +8,15 @@ namespace YooAsset
{
public abstract class AsyncOperationBase : IEnumerator, IComparable<AsyncOperationBase>
{
private readonly List<AsyncOperationBase> _childs = new List<AsyncOperationBase>(10);
private Action<AsyncOperationBase> _callback;
private string _packageName = null;
private int _whileFrame = 1000;
/// <summary>
/// 所有子任务
/// </summary>
internal readonly List<AsyncOperationBase> Childs = new List<AsyncOperationBase>(10);
/// <summary>
/// 等待异步执行完成
/// </summary>
@@ -24,12 +28,12 @@ namespace YooAsset
internal bool IsFinish { private set; get; } = false;
/// <summary>
/// 优先级
/// 任务优先级
/// </summary>
public uint Priority { set; get; } = 0;
/// <summary>
/// 状态
/// 任务状态
/// </summary>
public EOperationStatus Status { get; protected set; } = EOperationStatus.None;
@@ -109,6 +113,10 @@ namespace YooAsset
{
throw new System.NotImplementedException(this.GetType().Name);
}
internal virtual string InternalGetDesc()
{
return string.Empty;
}
/// <summary>
/// 设置包裹名称
@@ -124,11 +132,19 @@ namespace YooAsset
internal void AddChildOperation(AsyncOperationBase child)
{
#if UNITY_EDITOR
if (_childs.Contains(child))
if (Childs.Contains(child))
throw new Exception($"The child node {child.GetType().Name} already exists !");
#endif
_childs.Add(child);
Childs.Add(child);
}
/// <summary>
/// 获取异步操作说明
/// </summary>
internal string GetOperationDesc()
{
return InternalGetDesc();
}
/// <summary>
@@ -139,6 +155,11 @@ namespace YooAsset
if (Status == EOperationStatus.None)
{
Status = EOperationStatus.Processing;
// 开始记录
DebugBeginRecording();
// 开始任务
InternalStart();
}
}
@@ -149,7 +170,13 @@ namespace YooAsset
internal void UpdateOperation()
{
if (IsDone == false)
{
// 更新记录
DebugUpdateRecording();
// 更新任务
InternalUpdate();
}
if (IsDone && IsFinish == false)
{
@@ -158,6 +185,9 @@ namespace YooAsset
// 进度百分百完成
Progress = 1f;
// 结束记录
DebugEndRecording();
//注意如果完成回调内发生异常会导致Task无限期等待
_callback?.Invoke(this);
@@ -171,7 +201,7 @@ namespace YooAsset
/// </summary>
internal void AbortOperation()
{
foreach (var child in _childs)
foreach (var child in Childs)
{
child.AbortOperation();
}
@@ -235,6 +265,55 @@ namespace YooAsset
}
#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
#region

View File

@@ -43,6 +43,15 @@ namespace YooAsset
/// </summary>
public static void Update()
{
// 移除已经完成的异步操作
// 注意:移除上一帧完成的异步操作,方便调试器接收到完整的信息!
for (int i = _operations.Count - 1; i >= 0; i--)
{
var operation = _operations[i];
if (operation.IsFinish)
_operations.RemoveAt(i);
}
// 添加新增的异步操作
if (_newList.Count > 0)
{
@@ -77,14 +86,6 @@ namespace YooAsset
operation.UpdateOperation();
}
// 移除已经完成的异步操作
for (int i = _operations.Count - 1; i >= 0; i--)
{
var operation = _operations[i];
if (operation.IsFinish)
_operations.RemoveAt(i);
}
}
/// <summary>
@@ -132,5 +133,39 @@ namespace YooAsset
operation.SetPackageName(packageName);
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 = GetDebugOperationInfo(operation);
result.Add(operationInfo);
}
}
return result;
}
internal static DebugOperationInfo GetDebugOperationInfo(AsyncOperationBase operation)
{
var operationInfo = new DebugOperationInfo();
operationInfo.OperationName = operation.GetType().Name;
operationInfo.OperationDesc = operation.GetOperationDesc();
operationInfo.Priority = operation.Priority;
operationInfo.Progress = operation.Progress;
operationInfo.BeginTime = operation.BeginTime;
operationInfo.ProcessTime = operation.ProcessTime;
operationInfo.Status = operation.Status.ToString();
operationInfo.Childs = new List<DebugOperationInfo>(operation.Childs.Count);
foreach (var child in operation.Childs)
{
var childInfo = GetDebugOperationInfo(child);
operationInfo.Childs.Add(childInfo);
}
return operationInfo;
}
#endregion
}
}

View File

@@ -13,6 +13,11 @@ namespace YooAsset
/// </summary>
public string BuildPipelineName;
/// <summary>
/// 用户数据
/// </summary>
public object BuildUserData;
/// <summary>
/// 构建类所属程序集名称
/// </summary>

View File

@@ -151,6 +151,11 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
var assetInfo = _handle.GetAssetInfo();
return $"AssetPath : {assetInfo.AssetPath}";
}
/// <summary>
/// 取消实例化对象操作

View File

@@ -116,6 +116,10 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"BundleName : {LoadBundleInfo.Bundle.BundleName}";
}
/// <summary>
/// 引用(引用计数递加)

View File

@@ -110,5 +110,9 @@ namespace YooAsset
Status = EOperationStatus.Succeed;
}
}
internal override string InternalGetDesc()
{
return $"SceneName : {_provider.SceneName}";
}
}
}

View File

@@ -53,6 +53,10 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"LoopCount : {_loopCount}";
}
/// <summary>
/// 说明:资源包之间会有深层的依赖链表,需要多次迭代才可以在单帧内卸载!

View File

@@ -99,7 +99,6 @@ namespace YooAsset
}
internal override void InternalStart()
{
DebugBeginRecording();
_steps = ESteps.StartBundleLoader;
}
internal override void InternalUpdate()
@@ -174,6 +173,10 @@ namespace YooAsset
}
}
}
internal override string InternalGetDesc()
{
return $"AssetPath : {MainAssetInfo.AssetPath}";
}
protected abstract void ProcessBundleResult();
/// <summary>
@@ -267,8 +270,6 @@ namespace YooAsset
/// </summary>
protected void InvokeCompletion(string error, EOperationStatus status)
{
DebugEndRecording();
_steps = ESteps.Done;
Error = error;
Status = status;
@@ -311,50 +312,10 @@ namespace YooAsset
/// </summary>
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")]
public void InitSpawnDebugInfo()
public void InitProviderDebugInfo()
{
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;
}
SpawnScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
}
/// <summary>

View File

@@ -119,7 +119,7 @@ namespace YooAsset
ProviderOperation provider;
{
provider = new SceneProvider(this, providerGUID, assetInfo, loadSceneParams, suspendLoad);
provider.InitSpawnDebugInfo();
provider.InitProviderDebugInfo();
ProviderDic.Add(providerGUID, provider);
OperationSystem.StartOperation(PackageName, provider);
}
@@ -158,7 +158,7 @@ namespace YooAsset
if (provider == null)
{
provider = new AssetProvider(this, providerGUID, assetInfo);
provider.InitSpawnDebugInfo();
provider.InitProviderDebugInfo();
ProviderDic.Add(providerGUID, provider);
OperationSystem.StartOperation(PackageName, provider);
}
@@ -194,7 +194,7 @@ namespace YooAsset
if (provider == null)
{
provider = new SubAssetsProvider(this, providerGUID, assetInfo);
provider.InitSpawnDebugInfo();
provider.InitProviderDebugInfo();
ProviderDic.Add(providerGUID, provider);
OperationSystem.StartOperation(PackageName, provider);
}
@@ -230,7 +230,7 @@ namespace YooAsset
if (provider == null)
{
provider = new AllAssetsProvider(this, providerGUID, assetInfo);
provider.InitSpawnDebugInfo();
provider.InitProviderDebugInfo();
ProviderDic.Add(providerGUID, provider);
OperationSystem.StartOperation(PackageName, provider);
}
@@ -266,7 +266,7 @@ namespace YooAsset
if (provider == null)
{
provider = new RawFileProvider(this, providerGUID, assetInfo);
provider.InitSpawnDebugInfo();
provider.InitProviderDebugInfo();
ProviderDic.Add(providerGUID, provider);
OperationSystem.StartOperation(PackageName, provider);
}
@@ -359,14 +359,6 @@ namespace YooAsset
}
#region
internal DebugPackageData GetDebugPackageData()
{
DebugPackageData data = new DebugPackageData();
data.PackageName = PackageName;
data.ProviderInfos = GetDebugProviderInfos();
data.BundleInfos = GetDebugBundleInfos();
return data;
}
internal List<DebugProviderInfo> GetDebugProviderInfos()
{
List<DebugProviderInfo> result = new List<DebugProviderInfo>(ProviderDic.Count);
@@ -375,8 +367,8 @@ namespace YooAsset
DebugProviderInfo providerInfo = new DebugProviderInfo();
providerInfo.AssetPath = provider.MainAssetInfo.AssetPath;
providerInfo.SpawnScene = provider.SpawnScene;
providerInfo.SpawnTime = provider.SpawnTime;
providerInfo.LoadingTime = provider.LoadingTime;
providerInfo.BeginTime = provider.BeginTime;
providerInfo.LoadingTime = provider.ProcessTime;
providerInfo.RefCount = provider.RefCount;
providerInfo.Status = provider.Status.ToString();
providerInfo.DependBundles = provider.GetDebugDependBundles();
@@ -393,7 +385,7 @@ namespace YooAsset
var bundleInfo = new DebugBundleInfo();
bundleInfo.BundleName = packageBundle.BundleName;
bundleInfo.RefCount = bundleLoader.RefCount;
bundleInfo.Status = bundleLoader.Status;
bundleInfo.Status = bundleLoader.Status.ToString();
bundleInfo.ReferenceBundles = FilterReferenceBundles(packageBundle);
result.Add(bundleInfo);
}

Some files were not shown because too many files have changed in this diff Show More