Update AssetBundleBuilder

pull/4/head
hevinci 2022-03-17 15:27:49 +08:00
parent feb9a22083
commit 7cb0394785
10 changed files with 79 additions and 24 deletions

View File

@ -4,21 +4,17 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
/// <summary>
/// 构建的资源信息类
/// </summary>
[Serializable]
public class BuildAssetInfo
{
/// <summary>
/// 资源路径
/// </summary>
public string AssetPath;
public string AssetPath { private set; get; }
/// <summary>
/// 资源包完整名称
/// </summary>
public string BundleName;
public string BundleName { private set; get; }
/// <summary>
/// 是否为原生资源
@ -30,21 +26,21 @@ namespace YooAsset.Editor
/// </summary>
public bool IsCollectAsset = false;
/// <summary>
/// 资源标记列表
/// </summary>
public List<string> AssetTags = new List<string>();
/// <summary>
/// 被依赖次数
/// </summary>
public int DependCount = 0;
/// <summary>
/// 资源标记列表
/// </summary>
public readonly List<string> AssetTags = new List<string>();
/// <summary>
/// 依赖的所有资源
/// 注意:包括零依赖资源和冗余资源(资源包名无效)
/// </summary>
public List<BuildAssetInfo> AllDependAssetInfos;
public List<BuildAssetInfo> AllDependAssetInfos { private set; get; }
public BuildAssetInfo(string assetPath)
@ -81,10 +77,18 @@ namespace YooAsset.Editor
{
foreach (var tag in tags)
{
if (AssetTags.Contains(tag) == false)
{
AssetTags.Add(tag);
}
AddAssetTag(tag);
}
}
/// <summary>
/// 添加资源标记
/// </summary>
public void AddAssetTag(string tag)
{
if (AssetTags.Contains(tag) == false)
{
AssetTags.Add(tag);
}
}

View File

@ -6,21 +6,17 @@ using UnityEditor;
namespace YooAsset.Editor
{
/// <summary>
/// 构建的资源包信息类
/// </summary>
[Serializable]
public class BuildBundleInfo
{
/// <summary>
/// 资源包完整名称
/// </summary>
public string BundleName;
public string BundleName { private set; get; }
/// <summary>
/// 包含的资源列表
/// </summary>
public List<BuildAssetInfo> Assets = new List<BuildAssetInfo>();
public readonly List<BuildAssetInfo> Assets = new List<BuildAssetInfo>();
/// <summary>
/// 是否为原生文件

View File

@ -19,7 +19,7 @@ namespace YooAsset.Editor
/// <summary>
/// 资源包列表
/// </summary>
public List<BuildBundleInfo> BundleInfos;
public List<ReportBundleInfo> BundleInfos;
/// <summary>
/// 冗余的资源列表
@ -35,5 +35,14 @@ namespace YooAsset.Editor
string json = JsonUtility.ToJson(buildReport, true);
FileUtility.CreateFile(savePath, json);
}
/// <summary>
/// 反序列化
/// </summary>
public static BuildReport Deserialize(string jsonData)
{
BuildReport report = JsonUtility.FromJson<BuildReport>(jsonData);
return report;
}
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset.Editor
{
[Serializable]
public class ReportAssetInfo
{
}
}

View File

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

View File

@ -0,0 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset.Editor
{
[Serializable]
public class ReportBundleInfo
{
}
}

View File

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

View File

@ -41,7 +41,7 @@ namespace YooAsset.Editor
buildReport.Summary.IsIgnoreTypeTreeChanges = buildParameters.Parameters.IsIgnoreTypeTreeChanges;
buildReport.Summary.IsDisableLoadAssetByFileName = buildParameters.Parameters.IsDisableLoadAssetByFileName;
buildReport.BundleInfos = buildMapContext.BundleInfos;
//buildReport.BundleInfos = buildMapContext.BundleInfos;
buildReport.RedundancyList = buildMapContext.RedundancyList;
// 删除旧文件