update asset bundle reporter

pull/70/head
hevinci 2023-02-21 11:57:17 +08:00
parent 7d21da76fb
commit fa0dc48993
1 changed files with 14 additions and 10 deletions

View File

@ -27,7 +27,6 @@ namespace YooAsset.Editor
private TemplateContainer _root; private TemplateContainer _root;
private ListView _listView; private ListView _listView;
private BuildReport _buildReport;
private readonly List<ItemWrapper> _items = new List<ItemWrapper>(); private readonly List<ItemWrapper> _items = new List<ItemWrapper>();
@ -55,14 +54,12 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public void FillViewData(BuildReport buildReport) public void FillViewData(BuildReport buildReport)
{ {
_buildReport = buildReport;
_items.Clear(); _items.Clear();
_items.Add(new ItemWrapper("YooAsset版本", buildReport.Summary.YooVersion)); _items.Add(new ItemWrapper("YooAsset版本", buildReport.Summary.YooVersion));
_items.Add(new ItemWrapper("引擎版本", buildReport.Summary.UnityVersion)); _items.Add(new ItemWrapper("引擎版本", buildReport.Summary.UnityVersion));
_items.Add(new ItemWrapper("构建时间", buildReport.Summary.BuildDate)); _items.Add(new ItemWrapper("构建时间", buildReport.Summary.BuildDate));
_items.Add(new ItemWrapper("构建耗时", $"{buildReport.Summary.BuildSeconds}秒")); _items.Add(new ItemWrapper("构建耗时", ConvertTime(buildReport.Summary.BuildSeconds)));
_items.Add(new ItemWrapper("构建平台", $"{buildReport.Summary.BuildTarget}")); _items.Add(new ItemWrapper("构建平台", $"{buildReport.Summary.BuildTarget}"));
_items.Add(new ItemWrapper("构建管线", $"{buildReport.Summary.BuildPipeline}")); _items.Add(new ItemWrapper("构建管线", $"{buildReport.Summary.BuildPipeline}"));
_items.Add(new ItemWrapper("构建模式", $"{buildReport.Summary.BuildMode}")); _items.Add(new ItemWrapper("构建模式", $"{buildReport.Summary.BuildMode}"));
@ -154,16 +151,23 @@ namespace YooAsset.Editor
label2.text = itemWrapper.Value; label2.text = itemWrapper.Value;
} }
private string ConvertTime(int time)
{
if (time <= 60)
{
return $"{time}秒钟";
}
else
{
int minute = time / 60;
return $"{minute}分钟";
}
}
private string ConvertSize(long size) private string ConvertSize(long size)
{ {
if (size == 0) if (size == 0)
return "0"; return "0";
if (size < 1024) return EditorUtility.FormatBytes(size);
return $"{size} Bytes";
else if (size < 1024 * 1024)
return $"{(int)(size / 1024)} KB";
else
return $"{(int)(size / (1024 * 1024))} MB";
} }
} }
} }