Update runtime code

pull/51/head
hevinci 2022-10-22 15:38:51 +08:00
parent 989d88f7d3
commit c196e44bc6
7 changed files with 61 additions and 13 deletions

View File

@ -341,7 +341,6 @@ namespace YooAsset
foreach (var provider in _providers)
{
DebugProviderInfo providerInfo = new DebugProviderInfo();
providerInfo.PackageName = BundleServices.GetPackageName();
providerInfo.AssetPath = provider.MainAssetInfo.AssetPath;
providerInfo.SpawnScene = provider.SpawnScene;
providerInfo.SpawnTime = provider.SpawnTime;

View File

@ -1,10 +1,17 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset
{
[Serializable]
internal class DebugBundleInfo
internal class DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
{
/// <summary>
/// 包裹名
/// </summary>
public string PackageName { set; get; }
/// <summary>
/// 资源包名称
/// </summary>
@ -19,5 +26,14 @@ namespace YooAsset
/// 加载状态
/// </summary>
public int Status;
public int CompareTo(DebugBundleInfo other)
{
return Compare(this, other);
}
public int Compare(DebugBundleInfo a, DebugBundleInfo b)
{
return string.CompareOrdinal(a.BundleName, b.BundleName);
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset
{
[Serializable]
internal class DebugPackageData
{
/// <summary>
/// 包裹名称
/// </summary>
public string PackageName;
/// <summary>
/// 调试数据列表
/// </summary>
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
}
}

View File

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

View File

@ -8,9 +8,9 @@ namespace YooAsset
internal class DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
{
/// <summary>
/// 所属的资源包裹
/// 包裹
/// </summary>
public string PackageName;
public string PackageName { set; get; }
/// <summary>
/// 资源对象路径

View File

@ -12,17 +12,21 @@ namespace YooAsset
[Serializable]
internal class DebugReport
{
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
/// <summary>
/// 游戏帧
/// </summary>
public int FrameCount;
/// <summary>
/// 调试的包裹数据列表
/// </summary>
public List<DebugPackageData> PackageDatas = new List<DebugPackageData>(10);
/// <summary>
/// 序列化
/// </summary>
public static byte[] Serialize(DebugReport debugReport)
public static byte[] Serialize(DebugReport debugReport)
{
return Encoding.UTF8.GetBytes(JsonUtility.ToJson(debugReport));
}

View File

@ -236,12 +236,9 @@ namespace YooAsset
foreach (var package in _packages)
{
var result = package.GetDebugReportInfos();
report.ProviderInfos.AddRange(result);
var packageData = package.GetDebugPackageData();
report.PackageDatas.Add(packageData);
}
// 重新排序
report.ProviderInfos.Sort();
return report;
}
#endregion