Update AssetBundleDebugger

调试窗口增加调试信息导出按钮。
pull/51/head
hevinci 2022-10-22 18:23:40 +08:00
parent 9404882fc7
commit 46d985a720
2 changed files with 31 additions and 0 deletions

View File

@ -73,6 +73,10 @@ namespace YooAsset.Editor
var sampleBtn = root.Q<Button>("SampleButton"); var sampleBtn = root.Q<Button>("SampleButton");
sampleBtn.clicked += SampleBtn_onClick; sampleBtn.clicked += SampleBtn_onClick;
// 导出按钮
var exportBtn = root.Q<Button>("ExportButton");
exportBtn.clicked += ExportBtn_clicked;
// 用户列表菜单 // 用户列表菜单
_playerName = root.Q<Label>("PlayerName"); _playerName = root.Q<Label>("PlayerName");
_playerName.text = "Editor player"; _playerName.text = "Editor player";
@ -251,6 +255,32 @@ namespace YooAsset.Editor
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgSendEditorToPlayer, data); EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgSendEditorToPlayer, data);
RemoteDebuggerInRuntime.EditorRequestDebugReport(); RemoteDebuggerInRuntime.EditorRequestDebugReport();
} }
private void ExportBtn_clicked()
{
if (_currentReport == null)
{
Debug.LogWarning("Debug report is null.");
return;
}
string resultPath = EditorTools.OpenFolderPanel("Export JSON", "Assets/");
if (resultPath != null)
{
// 注意:排序保证生成配置的稳定性
foreach (var packageData in _currentReport.PackageDatas)
{
packageData.ProviderInfos.Sort();
foreach (var providerInfo in packageData.ProviderInfos)
{
providerInfo.DependBundleInfos.Sort();
}
}
string filePath = $"{resultPath}/{nameof(DebugReport)}_{_currentReport.FrameCount}.json";
string fileContent = JsonUtility.ToJson(_currentReport, true);
FileUtility.CreateFile(filePath, fileContent);
}
}
private void OnSearchKeyWordChange(ChangeEvent<string> e) private void OnSearchKeyWordChange(ChangeEvent<string> e)
{ {
_searchKeyWord = e.newValue; _searchKeyWord = e.newValue;

View File

@ -4,6 +4,7 @@
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" /> <uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" />
<uie:ToolbarSearchField focusable="true" name="SearchField" style="flex-grow: 1;" /> <uie:ToolbarSearchField focusable="true" name="SearchField" style="flex-grow: 1;" />
<uie:ToolbarButton text="刷新" 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="刷新" 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="导出" 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;" />
</uie:Toolbar> </uie:Toolbar>
<uie:Toolbar name="FrameToolbar"> <uie:Toolbar name="FrameToolbar">
<ui:SliderInt picking-mode="Ignore" label="Frame:" value="42" high-value="100" name="FrameSlider" style="flex-grow: 1;" /> <ui:SliderInt picking-mode="Ignore" label="Frame:" value="42" high-value="100" name="FrameSlider" style="flex-grow: 1;" />