mirror of https://github.com/tuyoogame/YooAsset
Compare commits
6 Commits
d23c0ba715
...
79e0cf85f9
Author | SHA1 | Date |
---|---|---|
|
79e0cf85f9 | |
|
e996eaa008 | |
|
5088c9e985 | |
|
610b3c6d32 | |
|
cc7290f10e | |
|
576b842368 |
|
@ -2,6 +2,49 @@
|
|||
|
||||
All notable changes to this package will be documented in this file.
|
||||
|
||||
## [2.3.0-preview] - 2025-02-19
|
||||
|
||||
### Improvements
|
||||
|
||||
资源收集窗口列表元素支持手动上下拖拽排序!
|
||||
|
||||
资源扫描窗口列表元素支持手动上下拖拽排序!
|
||||
|
||||
### Added
|
||||
|
||||
- 新增了UIElements扩展类ReorderableListView
|
||||
|
||||
- 新增初始化方法
|
||||
|
||||
```csharp
|
||||
public class YooAssets
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置异步系统参数,快速启动模式的开关
|
||||
/// 注意:该模式默认开启
|
||||
/// </summary>
|
||||
public static void SetOperationSystemQuickStartMode(bool state)
|
||||
}
|
||||
```
|
||||
|
||||
- 新增打包构建参数
|
||||
|
||||
```csharp
|
||||
public class BuildParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧版依赖模式
|
||||
/// 说明:兼容YooAssets1.5.x版本
|
||||
/// </summary>
|
||||
public bool LegacyDependency = false;
|
||||
}
|
||||
```
|
||||
|
||||
### Fixed
|
||||
|
||||
- (#472) 修复了Unity6平台,TableView视图无法显示问题。
|
||||
- 修复了微信小游戏和抖音小游戏未正确使用插件的卸载方法。
|
||||
|
||||
## [2.2.12] - 2025-02-14
|
||||
|
||||
### Improvements
|
||||
|
|
|
@ -51,6 +51,12 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public string PackageNote;
|
||||
|
||||
/// <summary>
|
||||
/// 旧版依赖模式
|
||||
/// 说明:兼容YooAssets1.5.x版本
|
||||
/// </summary>
|
||||
public bool LegacyDependency = false;
|
||||
|
||||
/// <summary>
|
||||
/// 清空构建缓存文件
|
||||
/// </summary>
|
||||
|
|
|
@ -31,6 +31,7 @@ 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;
|
||||
|
@ -43,8 +44,8 @@ namespace YooAsset.Editor
|
|||
manifest.AssetList = CreatePackageAssetList(buildMapContext);
|
||||
manifest.BundleList = CreatePackageBundleList(buildMapContext);
|
||||
|
||||
// 处理资源清单的ID数据
|
||||
ProcessPacakgeIDs(manifest);
|
||||
// 处理资源清单的资源对象
|
||||
ProcessPacakgeAsset(manifest);
|
||||
|
||||
// 处理资源包的依赖列表
|
||||
if (processBundleDepends)
|
||||
|
@ -54,6 +55,14 @@ namespace YooAsset.Editor
|
|||
if (processBundleTags)
|
||||
ProcessBundleTags(manifest);
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
if (buildParameters.LegacyDependency)
|
||||
{
|
||||
if (processBundleDepends)
|
||||
ProcessLegacyDependency(context, manifest);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// 创建补丁清单文本文件
|
||||
{
|
||||
string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||
|
@ -137,7 +146,7 @@ namespace YooAsset.Editor
|
|||
packageAsset.AssetPath = assetInfo.AssetInfo.AssetPath;
|
||||
packageAsset.AssetGUID = buildMapContext.Command.IncludeAssetGUID ? assetInfo.AssetInfo.AssetGUID : string.Empty;
|
||||
packageAsset.AssetTags = assetInfo.AssetTags.ToArray();
|
||||
packageAsset.BundleNameInEditor = assetInfo.BundleName;
|
||||
packageAsset.TempDataInEditor = assetInfo;
|
||||
result.Add(packageAsset);
|
||||
}
|
||||
}
|
||||
|
@ -165,9 +174,9 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理资源清单的ID数据
|
||||
/// 处理资源清单的资源对象列表
|
||||
/// </summary>
|
||||
private void ProcessPacakgeIDs(PackageManifest manifest)
|
||||
private void ProcessPacakgeAsset(PackageManifest manifest)
|
||||
{
|
||||
// 注意:优先缓存资源包索引
|
||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||
|
@ -176,10 +185,11 @@ namespace YooAsset.Editor
|
|||
_cachedBundleIndexIDs.Add(bundleName, index);
|
||||
}
|
||||
|
||||
// 记录资源对象所属的资源包ID
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
string bundleName = packageAsset.BundleNameInEditor;
|
||||
packageAsset.BundleID = GetCachedBundleIndexID(bundleName);
|
||||
var assetInfo = packageAsset.TempDataInEditor as BuildAssetInfo;
|
||||
packageAsset.BundleID = GetCachedBundleIndexID(assetInfo.BundleName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +202,7 @@ namespace YooAsset.Editor
|
|||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
int mainBundleID = GetCachedBundleIndexID(packageBundle.BundleName);
|
||||
var depends = GetBundleDepends(context, packageBundle.BundleName);
|
||||
string[] depends = GetBundleDepends(context, packageBundle.BundleName);
|
||||
List<int> dependIDs = new List<int>(depends.Length);
|
||||
foreach (var dependBundleName in depends)
|
||||
{
|
||||
|
@ -264,5 +274,140 @@ namespace YooAsset.Editor
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含该资源包的索引ID
|
||||
/// </summary>
|
||||
private bool ContainsCachedBundleIndexID(string bundleName)
|
||||
{
|
||||
return _cachedBundleIndexIDs.ContainsKey(bundleName);
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
var dependIDs = packageBundle.DependIDs;
|
||||
packageBundle.TempDataInEditor = new DependencyQuery(dependIDs);
|
||||
}
|
||||
|
||||
// 记录资源对象依赖的资源包ID集合
|
||||
// 注意:依赖关系非引擎构建结果里查询!
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
var mainAssetInfo = packageAsset.TempDataInEditor as BuildAssetInfo;
|
||||
packageAsset.DependBundleIDs = GetAssetDependBundleIDs(mainAssetInfo);
|
||||
}
|
||||
|
||||
// 记录引用该资源包的资源包ID集合
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
packageBundle.ReferenceBundleIDs = GetBundleReferenceBundleIDs(manifest, packageBundle);
|
||||
}
|
||||
|
||||
// 注意:如果是可编程构建管线,需要补充内置资源包
|
||||
// 注意:该步骤依赖前面的操作!
|
||||
var buildResultContext = context.TryGetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
||||
if (buildResultContext != null)
|
||||
{
|
||||
ProcessBuiltinBundleReference(context, manifest, buildResultContext.BuiltinShadersBundleName);
|
||||
ProcessBuiltinBundleReference(context, manifest, buildResultContext.MonoScriptsBundleName);
|
||||
}
|
||||
}
|
||||
private void ProcessBuiltinBundleReference(BuildContext context, PackageManifest manifest, string builtinBundleName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(builtinBundleName))
|
||||
return;
|
||||
|
||||
// 查询内置资源包是否存在
|
||||
if (ContainsCachedBundleIndexID(builtinBundleName) == false)
|
||||
return;
|
||||
|
||||
// 获取内置资源包
|
||||
int builtinBundleID = GetCachedBundleIndexID(builtinBundleName);
|
||||
var builtinPackageBundle = manifest.BundleList[builtinBundleID];
|
||||
|
||||
// 更新依赖资源包ID集合
|
||||
HashSet<int> cacheBundleIDs = new HashSet<int>(builtinPackageBundle.ReferenceBundleIDs);
|
||||
HashSet<string> tempTags = new HashSet<string>();
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
if (cacheBundleIDs.Contains(packageAsset.BundleID))
|
||||
{
|
||||
if (packageAsset.DependBundleIDs.Contains(builtinBundleID) == false)
|
||||
{
|
||||
var tempBundleIDs = new List<int>(packageAsset.DependBundleIDs);
|
||||
tempBundleIDs.Add(builtinBundleID);
|
||||
packageAsset.DependBundleIDs = tempBundleIDs.ToArray();
|
||||
}
|
||||
|
||||
foreach (var tag in packageAsset.AssetTags)
|
||||
{
|
||||
if (tempTags.Contains(tag) == false)
|
||||
tempTags.Add(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新内置资源包的标签集合
|
||||
foreach (var tag in builtinPackageBundle.Tags)
|
||||
{
|
||||
if (tempTags.Contains(tag) == false)
|
||||
tempTags.Add(tag);
|
||||
}
|
||||
builtinPackageBundle.Tags = tempTags.ToArray();
|
||||
}
|
||||
private int[] GetAssetDependBundleIDs(BuildAssetInfo mainAssetInfo)
|
||||
{
|
||||
HashSet<int> result = new HashSet<int>();
|
||||
int mainBundleID = GetCachedBundleIndexID(mainAssetInfo.BundleName);
|
||||
foreach (var dependAssetInfo in mainAssetInfo.AllDependAssetInfos)
|
||||
{
|
||||
if (dependAssetInfo.HasBundleName())
|
||||
{
|
||||
int bundleID = GetCachedBundleIndexID(dependAssetInfo.BundleName);
|
||||
if (mainBundleID != bundleID)
|
||||
{
|
||||
if (result.Contains(bundleID) == false)
|
||||
result.Add(bundleID);
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@ namespace YooAsset.Editor
|
|||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||
|
||||
// 构建参数
|
||||
buildReport.Summary.LegacyDependency = buildParameters.LegacyDependency;
|
||||
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
||||
buildReport.Summary.UseAssetDependencyDB = buildParameters.UseAssetDependencyDB;
|
||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace YooAsset.Editor
|
|||
public class BuildResultContext : IContextObject
|
||||
{
|
||||
public IBundleBuildResults Results;
|
||||
public string BuiltinShadersBundleName;
|
||||
public string MonoScriptsBundleName;
|
||||
}
|
||||
|
||||
void IBuildTask.Run(BuildContext context)
|
||||
|
@ -53,6 +55,8 @@ namespace YooAsset.Editor
|
|||
BuildLogger.Log("UnityEngine build success!");
|
||||
BuildResultContext buildResultContext = new BuildResultContext();
|
||||
buildResultContext.Results = buildResults;
|
||||
buildResultContext.BuiltinShadersBundleName = builtinShadersBundleName;
|
||||
buildResultContext.MonoScriptsBundleName = monoScriptsBundleName;
|
||||
context.SetContextObject(buildResultContext);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace YooAsset.Editor
|
|||
private readonly Dictionary<System.Type, IContextObject> _contextObjects = new Dictionary<System.Type, IContextObject>();
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有情景对象
|
||||
/// 清空所有上下文对象
|
||||
/// </summary>
|
||||
public void ClearAllContext()
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置情景对象
|
||||
/// 设置上下文对象
|
||||
/// </summary>
|
||||
public void SetContextObject(IContextObject contextObject)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取情景对象
|
||||
/// 获取上下文对象
|
||||
/// </summary>
|
||||
public T GetContextObject<T>() where T : IContextObject
|
||||
{
|
||||
|
@ -46,5 +46,21 @@ namespace YooAsset.Editor
|
|||
throw new Exception($"Not found context object : {type}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取上下文对象
|
||||
/// </summary>
|
||||
public T TryGetContextObject<T>() where T : IContextObject
|
||||
{
|
||||
var type = typeof(T);
|
||||
if (_contextObjects.TryGetValue(type, out IContextObject contextObject))
|
||||
{
|
||||
return (T)contextObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@ 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,6 +38,7 @@ 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,6 +67,7 @@ namespace YooAsset.Editor
|
|||
public string IgnoreRuleName;
|
||||
|
||||
// 构建参数
|
||||
public bool LegacyDependency;
|
||||
public bool ClearBuildCacheFiles;
|
||||
public bool UseAssetDependencyDB;
|
||||
public bool EnableSharePackRule;
|
||||
|
|
|
@ -75,9 +75,10 @@ namespace YooAsset.Editor
|
|||
_items.Add(new ItemWrapper("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}"));
|
||||
_items.Add(new ItemWrapper("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}"));
|
||||
_items.Add(new ItemWrapper("Ignore Rule Name", $"{buildReport.Summary.IgnoreRuleName}"));
|
||||
|
||||
|
||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
||||
_items.Add(new ItemWrapper("Legacy Dependency Mode", $"{buildReport.Summary.LegacyDependency}"));
|
||||
_items.Add(new ItemWrapper("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}"));
|
||||
_items.Add(new ItemWrapper("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}"));
|
||||
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
||||
|
|
|
@ -109,6 +109,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 创建默认的WebServer文件系统参数
|
||||
/// </summary>
|
||||
/// <param name="decryptionServices">加密文件解密服务类</param>
|
||||
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
||||
public static FileSystemParameters CreateDefaultWebServerFileSystemParameters(IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
|
||||
{
|
||||
|
@ -123,6 +124,7 @@ namespace YooAsset
|
|||
/// 创建默认的WebRemote文件系统参数
|
||||
/// </summary>
|
||||
/// <param name="remoteServices">远端资源地址查询服务类</param>
|
||||
/// <param name="decryptionServices">加密文件解密服务类</param>
|
||||
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
||||
public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,11 @@ namespace YooAsset
|
|||
private static Stopwatch _watch;
|
||||
private static long _frameTime;
|
||||
|
||||
/// <summary>
|
||||
/// 快速启动模式
|
||||
/// </summary>
|
||||
public static bool QuickStartMode = false;
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作的最小时间片段
|
||||
/// </summary>
|
||||
|
@ -136,6 +141,11 @@ namespace YooAsset
|
|||
_newList.Add(operation);
|
||||
operation.SetPackageName(packageName);
|
||||
operation.SetStart();
|
||||
|
||||
if (QuickStartMode)
|
||||
{
|
||||
operation.InternalOnUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -153,7 +153,23 @@ namespace YooAsset
|
|||
if (IsDone == false)
|
||||
return false;
|
||||
|
||||
return RefCount <= 0;
|
||||
if (RefCount > 0)
|
||||
return false;
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
// 检查引用链上的资源包是否已经全部销毁
|
||||
// 注意:互相引用的资源包无法卸载!
|
||||
if (LoadBundleInfo.Bundle.ReferenceBundleIDs.Length > 0)
|
||||
{
|
||||
foreach (var bundleID in LoadBundleInfo.Bundle.ReferenceBundleIDs)
|
||||
{
|
||||
if (_resourceManager.CheckBundleDestroyed(bundleID) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -298,6 +298,14 @@ namespace YooAsset
|
|||
ProviderDic.Remove(provider.ProviderGUID);
|
||||
}
|
||||
}
|
||||
internal bool CheckBundleDestroyed(int bundleID)
|
||||
{
|
||||
string bundleName = _bundleQuery.GetMainBundleName(bundleID);
|
||||
var bundleFileLoader = TryGetBundleFileLoader(bundleName);
|
||||
if (bundleFileLoader == null)
|
||||
return true;
|
||||
return bundleFileLoader.IsDestroyed;
|
||||
}
|
||||
internal bool HasAnyLoader()
|
||||
{
|
||||
return LoaderDic.Count > 0;
|
||||
|
|
|
@ -13,6 +13,11 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
BundleInfo[] GetDependBundleInfos(AssetInfo assetPath);
|
||||
|
||||
/// <summary>
|
||||
/// 获取主资源包名称
|
||||
/// </summary>
|
||||
string GetMainBundleName(int bundleID);
|
||||
|
||||
/// <summary>
|
||||
/// 获取主资源包名称
|
||||
/// </summary>
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace YooAsset
|
|||
buffer.WriteUTF8(manifest.FileVersion);
|
||||
|
||||
// 写入文件头信息
|
||||
buffer.WriteBool(manifest.LegacyDependency);
|
||||
buffer.WriteBool(manifest.EnableAddressable);
|
||||
buffer.WriteBool(manifest.LocationToLower);
|
||||
buffer.WriteBool(manifest.IncludeAssetGUID);
|
||||
|
@ -55,6 +56,7 @@ namespace YooAsset
|
|||
buffer.WriteUTF8(packageAsset.AssetGUID);
|
||||
buffer.WriteUTF8Array(packageAsset.AssetTags);
|
||||
buffer.WriteInt32(packageAsset.BundleID);
|
||||
buffer.WriteInt32Array(packageAsset.DependBundleIDs);
|
||||
}
|
||||
|
||||
// 写入资源包列表
|
||||
|
@ -70,6 +72,7 @@ namespace YooAsset
|
|||
buffer.WriteBool(packageBundle.Encrypted);
|
||||
buffer.WriteUTF8Array(packageBundle.Tags);
|
||||
buffer.WriteInt32Array(packageBundle.DependIDs);
|
||||
buffer.WriteInt32Array(packageBundle.ReferenceBundleIDs);
|
||||
}
|
||||
|
||||
// 写入文件流
|
||||
|
@ -108,6 +111,7 @@ namespace YooAsset
|
|||
{
|
||||
// 读取文件头信息
|
||||
manifest.FileVersion = fileVersion;
|
||||
manifest.LegacyDependency = buffer.ReadBool();
|
||||
manifest.EnableAddressable = buffer.ReadBool();
|
||||
manifest.LocationToLower = buffer.ReadBool();
|
||||
manifest.IncludeAssetGUID = buffer.ReadBool();
|
||||
|
@ -133,6 +137,7 @@ namespace YooAsset
|
|||
packageAsset.AssetGUID = buffer.ReadUTF8();
|
||||
packageAsset.AssetTags = buffer.ReadUTF8Array();
|
||||
packageAsset.BundleID = buffer.ReadInt32();
|
||||
packageAsset.DependBundleIDs = buffer.ReadInt32Array();
|
||||
FillAssetCollection(manifest, packageAsset);
|
||||
}
|
||||
|
||||
|
@ -150,6 +155,7 @@ namespace YooAsset
|
|||
packageBundle.Encrypted = buffer.ReadBool();
|
||||
packageBundle.Tags = buffer.ReadUTF8Array();
|
||||
packageBundle.DependIDs = buffer.ReadInt32Array();
|
||||
packageBundle.ReferenceBundleIDs = buffer.ReadInt32Array();
|
||||
FillBundleCollection(manifest, packageBundle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace YooAsset
|
|||
// 读取文件头信息
|
||||
Manifest = new PackageManifest();
|
||||
Manifest.FileVersion = fileVersion;
|
||||
Manifest.LegacyDependency = _buffer.ReadBool();
|
||||
Manifest.EnableAddressable = _buffer.ReadBool();
|
||||
Manifest.LocationToLower = _buffer.ReadBool();
|
||||
Manifest.IncludeAssetGUID = _buffer.ReadBool();
|
||||
|
@ -112,6 +113,7 @@ namespace YooAsset
|
|||
packageAsset.AssetGUID = _buffer.ReadUTF8();
|
||||
packageAsset.AssetTags = _buffer.ReadUTF8Array();
|
||||
packageAsset.BundleID = _buffer.ReadInt32();
|
||||
packageAsset.DependBundleIDs = _buffer.ReadInt32Array();
|
||||
ManifestTools.FillAssetCollection(Manifest, packageAsset);
|
||||
|
||||
_packageAssetCount--;
|
||||
|
@ -146,6 +148,7 @@ namespace YooAsset
|
|||
packageBundle.Encrypted = _buffer.ReadBool();
|
||||
packageBundle.Tags = _buffer.ReadUTF8Array();
|
||||
packageBundle.DependIDs = _buffer.ReadInt32Array();
|
||||
packageBundle.ReferenceBundleIDs = _buffer.ReadInt32Array();
|
||||
ManifestTools.FillBundleCollection(Manifest, packageBundle);
|
||||
|
||||
_packageBundleCount--;
|
||||
|
|
|
@ -31,11 +31,18 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public int BundleID;
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
/// <summary>
|
||||
/// 所属资源包名称(仅编辑器有效)
|
||||
/// 依赖的资源包列表
|
||||
/// </summary>
|
||||
public int[] DependBundleIDs;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 临时数据对象(仅编辑器有效)
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
public string BundleNameInEditor;
|
||||
public object TempDataInEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含Tag
|
||||
|
|
|
@ -47,6 +47,14 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public int[] DependIDs;
|
||||
|
||||
#region YOOASSET_LEGACY_DEPENDENCY
|
||||
/// <summary>
|
||||
/// 引用该资源包的资源包列表
|
||||
/// 说明:谁引用了该资源包
|
||||
/// </summary>
|
||||
public int[] ReferenceBundleIDs;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 资源包GUID
|
||||
/// </summary>
|
||||
|
@ -101,6 +109,12 @@ namespace YooAsset
|
|||
[NonSerialized]
|
||||
public readonly List<PackageAsset> IncludeMainAssets = new List<PackageAsset>(10);
|
||||
|
||||
/// <summary>
|
||||
/// 临时数据对象(仅编辑器有效)
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
public object TempDataInEditor;
|
||||
|
||||
|
||||
public PackageBundle()
|
||||
{
|
||||
|
|
|
@ -17,6 +17,11 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public string FileVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 旧版依赖模式
|
||||
/// </summary>
|
||||
public bool LegacyDependency;
|
||||
|
||||
/// <summary>
|
||||
/// 启用可寻址资源定位
|
||||
/// </summary>
|
||||
|
@ -155,16 +160,7 @@ namespace YooAsset
|
|||
{
|
||||
if (AssetDic.TryGetValue(assetPath, out PackageAsset packageAsset))
|
||||
{
|
||||
int bundleID = packageAsset.BundleID;
|
||||
if (bundleID >= 0 && bundleID < BundleList.Count)
|
||||
{
|
||||
var packageBundle = BundleList[bundleID];
|
||||
return packageBundle;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Invalid bundle id : {bundleID} Asset path : {assetPath}");
|
||||
}
|
||||
return GetMainPackageBundle(packageAsset.BundleID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -172,27 +168,58 @@ namespace YooAsset
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取主资源包
|
||||
/// 注意:传入的资源包ID一定合法有效!
|
||||
/// </summary>
|
||||
public PackageBundle GetMainPackageBundle(int bundleID)
|
||||
{
|
||||
if (bundleID >= 0 && bundleID < BundleList.Count)
|
||||
{
|
||||
var packageBundle = BundleList[bundleID];
|
||||
return packageBundle;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Invalid bundle id : {bundleID}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源依赖列表
|
||||
/// 注意:传入的资源路径一定合法有效!
|
||||
/// </summary>
|
||||
public PackageBundle[] GetAllDependencies(string assetPath)
|
||||
{
|
||||
var packageBundle = GetMainPackageBundle(assetPath);
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependIDs.Length);
|
||||
foreach (var dependID in packageBundle.DependIDs)
|
||||
// YOOASSET_LEGACY_DEPENDENCY
|
||||
if (LegacyDependency)
|
||||
{
|
||||
if (dependID >= 0 && dependID < BundleList.Count)
|
||||
if (TryGetPackageAsset(assetPath, out PackageAsset packageAsset))
|
||||
{
|
||||
var dependBundle = BundleList[dependID];
|
||||
result.Add(dependBundle);
|
||||
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($"Invalid bundle id : {dependID} Asset path : {assetPath}");
|
||||
throw new Exception("Should never get here !");
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
else
|
||||
{
|
||||
var packageBundle = GetMainPackageBundle(assetPath);
|
||||
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependIDs.Length);
|
||||
foreach (var dependID in packageBundle.DependIDs)
|
||||
{
|
||||
var dependBundle = GetMainPackageBundle(dependID);
|
||||
result.Add(dependBundle);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -135,6 +135,12 @@ namespace YooAsset
|
|||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||
{
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||
return packageBundle.BundleName;
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo.IsInvalid)
|
||||
|
|
|
@ -144,6 +144,12 @@ namespace YooAsset
|
|||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||
{
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||
return packageBundle.BundleName;
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo.IsInvalid)
|
||||
|
|
|
@ -135,6 +135,12 @@ namespace YooAsset
|
|||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||
{
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||
return packageBundle.BundleName;
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo.IsInvalid)
|
||||
|
|
|
@ -163,6 +163,12 @@ namespace YooAsset
|
|||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||
{
|
||||
// 注意:如果清单里未找到资源包会抛出异常!
|
||||
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||
return packageBundle.BundleName;
|
||||
}
|
||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||
{
|
||||
if (assetInfo.IsInvalid)
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 清单文件格式版本
|
||||
/// </summary>
|
||||
public const string ManifestFileVersion = "2.2.5";
|
||||
public const string ManifestFileVersion = "2.3.0";
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -222,6 +222,15 @@ namespace YooAsset
|
|||
}
|
||||
OperationSystem.MaxTimeSlice = milliseconds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置异步系统参数,快速启动模式的开关
|
||||
/// 注意:该模式默认开启
|
||||
/// </summary>
|
||||
public static void SetOperationSystemQuickStartMode(bool state)
|
||||
{
|
||||
OperationSystem.QuickStartMode = state;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 调试信息
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "com.tuyoogame.yooasset",
|
||||
"displayName": "YooAsset",
|
||||
"version": "2.2.12",
|
||||
"version": "2.3.0-preview",
|
||||
"unity": "2019.4",
|
||||
"description": "unity3d resources management system.",
|
||||
"author": {
|
||||
|
|
Loading…
Reference in New Issue