Update AssetBundleBuilder

This commit is contained in:
hevinci
2022-03-18 11:25:07 +08:00
parent 8ee06ccf76
commit 512093b0ba
6 changed files with 49 additions and 13 deletions

View File

@@ -26,19 +26,44 @@ namespace YooAsset.Editor
/// </summary>
public List<ReportBundleInfo> BundleInfos = new List<ReportBundleInfo>();
/// <summary>
/// 冗余的资源列表
/// </summary>
public List<string> RedundancyAssetList = new List<string>();
/// <summary>
/// 序列化
/// 获取资源包信息类
/// </summary>
public ReportBundleInfo GetBundleInfo(string bundleName)
{
foreach (var bundleInfo in BundleInfos)
{
if (bundleInfo.BundleName == bundleName)
return bundleInfo;
}
throw new Exception($"Not found bundle : {bundleName}");
}
/// <summary>
/// 获取资源信息类
/// </summary>
public ReportAssetInfo GetAssetInfo(string assetPath)
{
foreach (var assetInfo in AssetInfos)
{
if (assetInfo.AssetPath == assetPath)
return assetInfo;
}
throw new Exception($"Not found asset : {assetPath}");
}
public static void Serialize(string savePath, BuildReport buildReport)
{
string json = JsonUtility.ToJson(buildReport, true);
FileUtility.CreateFile(savePath, json);
}
/// <summary>
/// 反序列化
/// </summary>
public static BuildReport Deserialize(string jsonData)
{
BuildReport report = JsonUtility.FromJson<BuildReport>(jsonData);

View File

@@ -13,17 +13,17 @@ namespace YooAsset.Editor
public string AssetPath;
/// <summary>
/// 所属资源包
/// 所属资源包名称
/// </summary>
public string MainBundle;
/// <summary>
/// 依赖的资源包
/// 依赖的资源包名称列表
/// </summary>
public List<string> DependBundles = new List<string>();
/// <summary>
/// 依赖的资源列表
/// 依赖的资源路径列表
/// </summary>
public List<string> DependAssets = new List<string>();
}