mirror of https://github.com/tuyoogame/YooAsset
update resource package
parent
d9c911d89b
commit
7eacb46555
|
@ -51,12 +51,6 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public string PackageNote;
|
||||
|
||||
/// <summary>
|
||||
/// 怀旧版依赖模式
|
||||
/// 说明:兼容YooAsset1.5.x版本
|
||||
/// </summary>
|
||||
public bool LegacyDependency = false;
|
||||
|
||||
/// <summary>
|
||||
/// 清空构建缓存文件
|
||||
/// </summary>
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace YooAsset.Editor
|
|||
// 创建新补丁清单
|
||||
PackageManifest manifest = new PackageManifest();
|
||||
manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
|
||||
manifest.LegacyDependency = buildParameters.LegacyDependency;
|
||||
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||
|
@ -55,13 +54,9 @@ namespace YooAsset.Editor
|
|||
if (processBundleTags)
|
||||
ProcessBundleTags(manifest);
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
if (buildParameters.LegacyDependency)
|
||||
{
|
||||
if (processBundleDepends)
|
||||
ProcessLegacyDependency(context, manifest);
|
||||
}
|
||||
#endregion
|
||||
// 4. 处理内置资源包
|
||||
if (processBundleDepends)
|
||||
ProcessBuiltinBundleDependency(context, manifest);
|
||||
|
||||
// 创建补丁清单文本文件
|
||||
{
|
||||
|
@ -73,17 +68,13 @@ namespace YooAsset.Editor
|
|||
|
||||
// 创建补丁清单二进制文件
|
||||
string packageHash;
|
||||
string packagePath;
|
||||
{
|
||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||
ManifestTools.SerializeToBinary(filePath, manifest);
|
||||
packageHash = HashUtility.FileCRC32(filePath);
|
||||
BuildLogger.Log($"Create package manifest file: {filePath}");
|
||||
|
||||
ManifestContext manifestContext = new ManifestContext();
|
||||
byte[] bytesData = FileUtility.ReadAllBytes(filePath);
|
||||
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData);
|
||||
context.SetContextObject(manifestContext);
|
||||
packagePath = $"{packageOutputDirectory}/{fileName}";
|
||||
ManifestTools.SerializeToBinary(packagePath, manifest);
|
||||
packageHash = HashUtility.FileCRC32(packagePath);
|
||||
BuildLogger.Log($"Create package manifest file: {packagePath}");
|
||||
}
|
||||
|
||||
// 创建补丁清单哈希文件
|
||||
|
@ -101,6 +92,14 @@ namespace YooAsset.Editor
|
|||
FileUtility.WriteAllText(filePath, buildParameters.PackageVersion);
|
||||
BuildLogger.Log($"Create package manifest version file: {filePath}");
|
||||
}
|
||||
|
||||
// 填充上下文
|
||||
{
|
||||
ManifestContext manifestContext = new ManifestContext();
|
||||
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
|
||||
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData);
|
||||
context.SetContextObject(manifestContext);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -192,18 +191,13 @@ namespace YooAsset.Editor
|
|||
packageAsset.BundleID = GetCachedBundleIndexID(assetInfo.BundleName);
|
||||
}
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
if (manifest.LegacyDependency)
|
||||
// 记录资源对象依赖的资源包ID集合
|
||||
// 注意:依赖关系非引擎构建结果里查询!
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
// 记录资源对象依赖的资源包ID集合
|
||||
// 注意:依赖关系非引擎构建结果里查询!
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
var mainAssetInfo = packageAsset.TempDataInEditor as BuildAssetInfo;
|
||||
packageAsset.DependBundleIDs = GetAssetDependBundleIDs(mainAssetInfo);
|
||||
}
|
||||
var mainAssetInfo = packageAsset.TempDataInEditor as BuildAssetInfo;
|
||||
packageAsset.DependBundleIDs = GetAssetDependBundleIDs(mainAssetInfo);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -215,33 +209,19 @@ namespace YooAsset.Editor
|
|||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
int mainBundleID = GetCachedBundleIndexID(packageBundle.BundleName);
|
||||
string[] depends = GetBundleDepends(context, packageBundle.BundleName);
|
||||
List<int> dependIDs = new List<int>(depends.Length);
|
||||
foreach (var dependBundleName in depends)
|
||||
string[] dependNames = GetBundleDepends(context, packageBundle.BundleName);
|
||||
List<int> dependIDs = new List<int>(dependNames.Length);
|
||||
foreach (var dependName in dependNames)
|
||||
{
|
||||
int bundleID = GetCachedBundleIndexID(dependBundleName);
|
||||
if (bundleID != mainBundleID)
|
||||
dependIDs.Add(bundleID);
|
||||
}
|
||||
packageBundle.DependIDs = dependIDs.ToArray();
|
||||
}
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
if (manifest.LegacyDependency)
|
||||
{
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
var dependIDs = packageBundle.DependIDs;
|
||||
packageBundle.TempDataInEditor = new DependencyQuery(dependIDs);
|
||||
int dependBundleID = GetCachedBundleIndexID(dependName);
|
||||
if (dependBundleID != mainBundleID)
|
||||
dependIDs.Add(dependBundleID);
|
||||
}
|
||||
|
||||
// 记录引用该资源包的资源包ID集合
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
packageBundle.ReferenceBundleIDs = GetBundleReferenceBundleIDs(manifest, packageBundle);
|
||||
}
|
||||
// 排序并填充数据
|
||||
dependIDs.Sort();
|
||||
packageBundle.DependBundleIDs = dependIDs.ToArray();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -254,41 +234,17 @@ namespace YooAsset.Editor
|
|||
packageBundle.Tags = Array.Empty<string>();
|
||||
}
|
||||
|
||||
// YOOASSET_LEGACY_DEPENDENCY
|
||||
if (manifest.LegacyDependency)
|
||||
// 将主资源的标签信息传染给其依赖的资源包集合
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
// 将主资源的标签信息传染给其依赖的资源包集合
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
var assetTags = packageAsset.AssetTags;
|
||||
int bundleID = packageAsset.BundleID;
|
||||
CacheBundleTags(bundleID, assetTags);
|
||||
if (packageAsset.DependBundleIDs != null)
|
||||
{
|
||||
var assetTags = packageAsset.AssetTags;
|
||||
int bundleID = packageAsset.BundleID;
|
||||
CacheBundleTags(bundleID, assetTags);
|
||||
|
||||
if (packageAsset.DependBundleIDs != null)
|
||||
foreach (var dependBundleID in packageAsset.DependBundleIDs)
|
||||
{
|
||||
foreach (var dependBundleID in packageAsset.DependBundleIDs)
|
||||
{
|
||||
CacheBundleTags(dependBundleID, assetTags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 将主资源的标签信息传染给其依赖的资源包集合
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
var assetTags = packageAsset.AssetTags;
|
||||
int bundleID = packageAsset.BundleID;
|
||||
CacheBundleTags(bundleID, assetTags);
|
||||
|
||||
var packageBundle = manifest.BundleList[bundleID];
|
||||
if (packageBundle.DependIDs != null)
|
||||
{
|
||||
foreach (var dependBundleID in packageBundle.DependIDs)
|
||||
{
|
||||
CacheBundleTags(dependBundleID, assetTags);
|
||||
}
|
||||
CacheBundleTags(dependBundleID, assetTags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,26 +298,15 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
private class DependencyQuery
|
||||
{
|
||||
private readonly HashSet<int> _dependIDs;
|
||||
|
||||
public DependencyQuery(int[] dependIDs)
|
||||
{
|
||||
_dependIDs = new HashSet<int>(dependIDs);
|
||||
}
|
||||
public bool Contains(int bundleID)
|
||||
{
|
||||
return _dependIDs.Contains(bundleID);
|
||||
}
|
||||
}
|
||||
private void ProcessLegacyDependency(BuildContext context, PackageManifest manifest)
|
||||
private void ProcessBuiltinBundleDependency(BuildContext context, PackageManifest manifest)
|
||||
{
|
||||
// 注意:如果是可编程构建管线,需要补充内置资源包
|
||||
// 注意:该步骤依赖前面的操作!
|
||||
var buildResultContext = context.TryGetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
||||
if (buildResultContext != null)
|
||||
{
|
||||
// 注意:初始化资源清单建立引用关系
|
||||
ManifestTools.InitManifest(manifest);
|
||||
ProcessBuiltinBundleReference(context, manifest, buildResultContext.BuiltinShadersBundleName);
|
||||
ProcessBuiltinBundleReference(context, manifest, buildResultContext.MonoScriptsBundleName);
|
||||
}
|
||||
|
@ -425,26 +370,11 @@ namespace YooAsset.Editor
|
|||
}
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
private int[] GetBundleReferenceBundleIDs(PackageManifest manifest, PackageBundle queryBundle)
|
||||
{
|
||||
int queryBundleID = GetCachedBundleIndexID(queryBundle.BundleName);
|
||||
List<int> result = new List<int>();
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
if (packageBundle == queryBundle)
|
||||
continue;
|
||||
|
||||
var dependencyQuery = packageBundle.TempDataInEditor as DependencyQuery;
|
||||
if (dependencyQuery.Contains(queryBundleID))
|
||||
{
|
||||
int referenceBundleID = GetCachedBundleIndexID(packageBundle.BundleName);
|
||||
if (result.Contains(referenceBundleID) == false)
|
||||
result.Add(referenceBundleID);
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
// 排序并返回数据
|
||||
List<int> listResult = new List<int>(result);
|
||||
listResult.Sort();
|
||||
return listResult.ToArray();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace YooAsset.Editor
|
|||
buildReport.Summary.IgnoreRuleName = buildMapContext.Command.IgnoreRule.GetType().FullName;
|
||||
|
||||
// 构建参数
|
||||
buildReport.Summary.LegacyDependency = buildParameters.LegacyDependency;
|
||||
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
||||
buildReport.Summary.UseAssetDependencyDB = buildParameters.UseAssetDependencyDB;
|
||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||
|
@ -155,8 +154,8 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
private List<string> GetBundleDependBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||
{
|
||||
List<string> dependBundles = new List<string>(packageBundle.DependIDs.Length);
|
||||
foreach (int index in packageBundle.DependIDs)
|
||||
List<string> dependBundles = new List<string>(packageBundle.DependBundleIDs.Length);
|
||||
foreach (int index in packageBundle.DependBundleIDs)
|
||||
{
|
||||
string dependBundleName = manifest.BundleList[index].BundleName;
|
||||
dependBundles.Add(dependBundleName);
|
||||
|
@ -170,7 +169,7 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
private List<string> GetBundleReferenceBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||
{
|
||||
List<string> referenceBundles = new List<string>(packageBundle.ReferenceBundleIDs.Length);
|
||||
List<string> referenceBundles = new List<string>(packageBundle.ReferenceBundleIDs.Count);
|
||||
foreach (int index in packageBundle.ReferenceBundleIDs)
|
||||
{
|
||||
string dependBundleName = manifest.BundleList[index].BundleName;
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace YooAsset.Editor
|
|||
buildParameters.BuildTarget = BuildTarget;
|
||||
buildParameters.PackageName = PackageName;
|
||||
buildParameters.PackageVersion = GetPackageVersion();
|
||||
buildParameters.LegacyDependency = false;
|
||||
buildParameters.EnableSharePackRule = true;
|
||||
buildParameters.VerifyBuildingResult = true;
|
||||
buildParameters.FileNameStyle = fileNameStyle;
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace YooAsset.Editor
|
|||
buildParameters.BuildTarget = BuildTarget;
|
||||
buildParameters.PackageName = PackageName;
|
||||
buildParameters.PackageVersion = GetPackageVersion();
|
||||
buildParameters.LegacyDependency = false;
|
||||
buildParameters.EnableSharePackRule = true;
|
||||
buildParameters.VerifyBuildingResult = true;
|
||||
buildParameters.FileNameStyle = fileNameStyle;
|
||||
|
|
|
@ -67,7 +67,6 @@ namespace YooAsset.Editor
|
|||
public string IgnoreRuleName;
|
||||
|
||||
// 构建参数
|
||||
public bool LegacyDependency;
|
||||
public bool ClearBuildCacheFiles;
|
||||
public bool UseAssetDependencyDB;
|
||||
public bool EnableSharePackRule;
|
||||
|
|
|
@ -62,7 +62,6 @@ namespace YooAsset.Editor
|
|||
BindListViewItem(string.Empty, string.Empty);
|
||||
|
||||
BindListViewHeader("Build Params");
|
||||
BindListViewItem("Legacy Dependency Mode", $"{buildReport.Summary.LegacyDependency}");
|
||||
BindListViewItem("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}");
|
||||
BindListViewItem("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}");
|
||||
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 快速启动模式
|
||||
/// </summary>
|
||||
public static bool QuickStartMode = false;
|
||||
public static bool QuickStartMode = true;
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作的最小时间片段
|
||||
|
|
|
@ -156,10 +156,10 @@ namespace YooAsset
|
|||
if (RefCount > 0)
|
||||
return false;
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
// YOOASSET_LEGACY_DEPENDENCY
|
||||
// 检查引用链上的资源包是否已经全部销毁
|
||||
// 注意:互相引用的资源包无法卸载!
|
||||
if (LoadBundleInfo.Bundle.ReferenceBundleIDs.Length > 0)
|
||||
if (LoadBundleInfo.Bundle.ReferenceBundleIDs.Count > 0)
|
||||
{
|
||||
foreach (var bundleID in LoadBundleInfo.Bundle.ReferenceBundleIDs)
|
||||
{
|
||||
|
@ -167,7 +167,6 @@ namespace YooAsset
|
|||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace YooAsset
|
|||
buffer.WriteUTF8(manifest.FileVersion);
|
||||
|
||||
// 写入文件头信息
|
||||
buffer.WriteBool(manifest.LegacyDependency);
|
||||
buffer.WriteBool(manifest.EnableAddressable);
|
||||
buffer.WriteBool(manifest.LocationToLower);
|
||||
buffer.WriteBool(manifest.IncludeAssetGUID);
|
||||
|
@ -71,8 +70,7 @@ namespace YooAsset
|
|||
buffer.WriteInt64(packageBundle.FileSize);
|
||||
buffer.WriteBool(packageBundle.Encrypted);
|
||||
buffer.WriteUTF8Array(packageBundle.Tags);
|
||||
buffer.WriteInt32Array(packageBundle.DependIDs);
|
||||
buffer.WriteInt32Array(packageBundle.ReferenceBundleIDs);
|
||||
buffer.WriteInt32Array(packageBundle.DependBundleIDs);
|
||||
}
|
||||
|
||||
// 写入文件流
|
||||
|
@ -111,7 +109,6 @@ namespace YooAsset
|
|||
{
|
||||
// 读取文件头信息
|
||||
manifest.FileVersion = fileVersion;
|
||||
manifest.LegacyDependency = buffer.ReadBool();
|
||||
manifest.EnableAddressable = buffer.ReadBool();
|
||||
manifest.LocationToLower = buffer.ReadBool();
|
||||
manifest.IncludeAssetGUID = buffer.ReadBool();
|
||||
|
@ -154,8 +151,7 @@ namespace YooAsset
|
|||
packageBundle.FileSize = buffer.ReadInt64();
|
||||
packageBundle.Encrypted = buffer.ReadBool();
|
||||
packageBundle.Tags = buffer.ReadUTF8Array();
|
||||
packageBundle.DependIDs = buffer.ReadInt32Array();
|
||||
packageBundle.ReferenceBundleIDs = buffer.ReadInt32Array();
|
||||
packageBundle.DependBundleIDs = buffer.ReadInt32Array();
|
||||
FillBundleCollection(manifest, packageBundle);
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +179,17 @@ namespace YooAsset
|
|||
throw new Exception($"Invalid bundle id : {bundleID} Asset path : {packageAsset.AssetPath}");
|
||||
}
|
||||
}
|
||||
|
||||
// 填充资源包引用关系
|
||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||
{
|
||||
var sourceBundle = manifest.BundleList[index];
|
||||
foreach (int dependIndex in sourceBundle.DependBundleIDs)
|
||||
{
|
||||
var dependBundle = manifest.BundleList[dependIndex];
|
||||
dependBundle.AddReferenceBundleID(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateAssetCollection(PackageManifest manifest, int assetCount)
|
||||
|
|
|
@ -78,7 +78,6 @@ namespace YooAsset
|
|||
// 读取文件头信息
|
||||
Manifest = new PackageManifest();
|
||||
Manifest.FileVersion = fileVersion;
|
||||
Manifest.LegacyDependency = _buffer.ReadBool();
|
||||
Manifest.EnableAddressable = _buffer.ReadBool();
|
||||
Manifest.LocationToLower = _buffer.ReadBool();
|
||||
Manifest.IncludeAssetGUID = _buffer.ReadBool();
|
||||
|
@ -147,8 +146,7 @@ namespace YooAsset
|
|||
packageBundle.FileSize = _buffer.ReadInt64();
|
||||
packageBundle.Encrypted = _buffer.ReadBool();
|
||||
packageBundle.Tags = _buffer.ReadUTF8Array();
|
||||
packageBundle.DependIDs = _buffer.ReadInt32Array();
|
||||
packageBundle.ReferenceBundleIDs = _buffer.ReadInt32Array();
|
||||
packageBundle.DependBundleIDs = _buffer.ReadInt32Array();
|
||||
ManifestTools.FillBundleCollection(Manifest, packageBundle);
|
||||
|
||||
_packageBundleCount--;
|
||||
|
|
|
@ -31,12 +31,11 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public int BundleID;
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
/// <summary>
|
||||
/// 依赖的资源包列表
|
||||
/// 依赖的资源包ID集合
|
||||
/// 说明:框架层收集查询结果
|
||||
/// </summary>
|
||||
public int[] DependBundleIDs;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 临时数据对象(仅编辑器有效)
|
||||
|
|
|
@ -44,16 +44,9 @@ namespace YooAsset
|
|||
|
||||
/// <summary>
|
||||
/// 依赖的资源包ID集合
|
||||
/// 注意:引擎层构建查询结果
|
||||
/// </summary>
|
||||
public int[] DependIDs;
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
/// <summary>
|
||||
/// 引用该资源包的资源包列表
|
||||
/// 说明:谁引用了该资源包
|
||||
/// </summary>
|
||||
public int[] ReferenceBundleIDs;
|
||||
#endregion
|
||||
public int[] DependBundleIDs;
|
||||
|
||||
/// <summary>
|
||||
/// 资源包GUID
|
||||
|
@ -66,7 +59,6 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 资源包类型
|
||||
/// </summary>
|
||||
private int _bundleType;
|
||||
public int BundleType
|
||||
{
|
||||
get
|
||||
|
@ -74,11 +66,11 @@ namespace YooAsset
|
|||
return _bundleType;
|
||||
}
|
||||
}
|
||||
private int _bundleType;
|
||||
|
||||
/// <summary>
|
||||
/// 文件名称
|
||||
/// </summary>
|
||||
private string _fileName;
|
||||
/// </summary>
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
|
@ -88,11 +80,11 @@ namespace YooAsset
|
|||
return _fileName;
|
||||
}
|
||||
}
|
||||
private string _fileName;
|
||||
|
||||
/// <summary>
|
||||
/// 文件后缀名
|
||||
/// </summary>
|
||||
private string _fileExtension;
|
||||
public string FileExtension
|
||||
{
|
||||
get
|
||||
|
@ -102,6 +94,7 @@ namespace YooAsset
|
|||
return _fileExtension;
|
||||
}
|
||||
}
|
||||
private string _fileExtension;
|
||||
|
||||
/// <summary>
|
||||
/// 包含的主资源集合
|
||||
|
@ -110,10 +103,12 @@ namespace YooAsset
|
|||
public readonly List<PackageAsset> IncludeMainAssets = new List<PackageAsset>(10);
|
||||
|
||||
/// <summary>
|
||||
/// 临时数据对象(仅编辑器有效)
|
||||
/// 引用该资源包的资源包列表
|
||||
/// 说明:谁引用了该资源包
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
public object TempDataInEditor;
|
||||
public readonly List<int> ReferenceBundleIDs = new List<int>(10);
|
||||
private readonly HashSet<int> _referenceBundleIDs = new HashSet<int>();
|
||||
|
||||
|
||||
public PackageBundle()
|
||||
|
@ -130,6 +125,19 @@ namespace YooAsset
|
|||
_fileName = ManifestTools.GetRemoteBundleFileName(manifest.OutputNameStyle, BundleName, _fileExtension, FileHash);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加引用该资源包的资源包ID
|
||||
/// 说明:谁引用了该资源包
|
||||
/// </summary>
|
||||
public void AddReferenceBundleID(int bundleID)
|
||||
{
|
||||
if (_referenceBundleIDs.Contains(bundleID) == false)
|
||||
{
|
||||
_referenceBundleIDs.Add(bundleID);
|
||||
ReferenceBundleIDs.Add(bundleID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含Tag
|
||||
/// </summary>
|
||||
|
|
|
@ -17,11 +17,6 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public string FileVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 怀旧版依赖模式
|
||||
/// </summary>
|
||||
public bool LegacyDependency;
|
||||
|
||||
/// <summary>
|
||||
/// 启用可寻址资源定位
|
||||
/// </summary>
|
||||
|
@ -191,35 +186,20 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public PackageBundle[] GetAllDependencies(string assetPath)
|
||||
{
|
||||
// YOOASSET_LEGACY_DEPENDENCY
|
||||
if (LegacyDependency)
|
||||
if (TryGetPackageAsset(assetPath, out PackageAsset packageAsset))
|
||||
{
|
||||
if (TryGetPackageAsset(assetPath, out PackageAsset packageAsset))
|
||||
{
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageAsset.DependBundleIDs.Length);
|
||||
foreach (var dependID in packageAsset.DependBundleIDs)
|
||||
{
|
||||
var dependBundle = GetMainPackageBundle(dependID);
|
||||
result.Add(dependBundle);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Should never get here !");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var packageBundle = GetMainPackageBundle(assetPath);
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependIDs.Length);
|
||||
foreach (var dependID in packageBundle.DependIDs)
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageAsset.DependBundleIDs.Length);
|
||||
foreach (var dependID in packageAsset.DependBundleIDs)
|
||||
{
|
||||
var dependBundle = GetMainPackageBundle(dependID);
|
||||
result.Add(dependBundle);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Should never get here !");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 清单文件格式版本
|
||||
/// </summary>
|
||||
public const string ManifestFileVersion = "2.3.0";
|
||||
public const string ManifestFileVersion = "2.3.1";
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue