diff --git a/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs b/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs index a3d9e15..99b662a 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs @@ -30,7 +30,12 @@ namespace YooAsset /// 开发者分发的文件地址 /// public string DeliveryFilePath { private set; get; } - + + /// + /// 开发者分发的文件偏移量 + /// + public ulong DeliveryFileOffset { private set; get; } + /// /// 注意:该字段只用于帮助编辑器下的模拟模式。 /// @@ -47,14 +52,16 @@ namespace YooAsset RemoteMainURL = mainURL; RemoteFallbackURL = fallbackURL; DeliveryFilePath = string.Empty; + DeliveryFileOffset = 0; } - public BundleInfo(PackageBundle bundle, ELoadMode loadMode, string deliveryFilePath) + public BundleInfo(PackageBundle bundle, ELoadMode loadMode, string deliveryFilePath, ulong deliveryFileOffset) { Bundle = bundle; LoadMode = loadMode; RemoteMainURL = string.Empty; RemoteFallbackURL = string.Empty; DeliveryFilePath = deliveryFilePath; + DeliveryFileOffset = deliveryFileOffset; } public BundleInfo(PackageBundle bundle, ELoadMode loadMode) { @@ -63,6 +70,7 @@ namespace YooAsset RemoteMainURL = string.Empty; RemoteFallbackURL = string.Empty; DeliveryFilePath = string.Empty; + DeliveryFileOffset = 0; } /// diff --git a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs index edca06d..9575c6f 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs @@ -60,13 +60,13 @@ namespace YooAsset { return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID); } - private bool IsDeliveryPackageBundle(PackageBundle packageBundle, out string deliveryFilePath) + private bool IsDeliveryPackageBundle(PackageBundle packageBundle) { - deliveryFilePath = _queryServices.QueryDeliveryFiles(_packageName, packageBundle.FileName); - if (string.IsNullOrEmpty(deliveryFilePath)) - return false; - else - return true; + return _queryServices.QueryDeliveryFiles(_packageName, packageBundle.FileName); + } + private DeliveryFileInfo GetDeiveryFileInfo(PackageBundle packageBundle) + { + return _queryServices.GetDeliveryFileInfo(_packageName, packageBundle.FileName); } #region IPlayModeServices接口 @@ -119,6 +119,10 @@ namespace YooAsset List downloadList = new List(1000); foreach (var packageBundle in manifest.BundleList) { + // 忽略分发文件 + if (IsDeliveryPackageBundle(packageBundle)) + continue; + // 忽略缓存文件 if (IsCachedPackageBundle(packageBundle)) continue; @@ -144,6 +148,10 @@ namespace YooAsset List downloadList = new List(1000); foreach (var packageBundle in manifest.BundleList) { + // 忽略分发文件 + if (IsDeliveryPackageBundle(packageBundle)) + continue; + // 忽略缓存文件 if (IsCachedPackageBundle(packageBundle)) continue; @@ -205,6 +213,10 @@ namespace YooAsset List downloadList = new List(1000); foreach (var packageBundle in checkList) { + // 忽略分发文件 + if (IsDeliveryPackageBundle(packageBundle)) + continue; + // 忽略缓存文件 if (IsCachedPackageBundle(packageBundle)) continue; @@ -279,9 +291,10 @@ namespace YooAsset throw new Exception("Should never get here !"); // 查询分发资源 - if (IsDeliveryPackageBundle(packageBundle, out string deliveryFilePath)) + if (IsDeliveryPackageBundle(packageBundle)) { - BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromDelivery, deliveryFilePath); + DeliveryFileInfo deliveryFileInfo = GetDeiveryFileInfo(packageBundle); + BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromDelivery, deliveryFileInfo.DeliveryFilePath, deliveryFileInfo.DeliveryFileOffset); return bundleInfo; } diff --git a/Assets/YooAsset/Runtime/Services/IQueryServices.cs b/Assets/YooAsset/Runtime/Services/IQueryServices.cs index 404a5f2..e9ba2f5 100644 --- a/Assets/YooAsset/Runtime/Services/IQueryServices.cs +++ b/Assets/YooAsset/Runtime/Services/IQueryServices.cs @@ -1,6 +1,15 @@  namespace YooAsset { + /// + /// 分发的资源信息 + /// + public struct DeliveryFileInfo + { + public string DeliveryFilePath; + public ulong DeliveryFileOffset; + } + public interface IQueryServices { /// @@ -9,8 +18,13 @@ namespace YooAsset bool QueryStreamingAssets(string packageName, string fileName); /// - /// 查询开发者分发的文件加载路径 + /// 查询是否为开发者分发的资源 /// - string QueryDeliveryFiles(string packageName, string fileName); + bool QueryDeliveryFiles(string packageName, string fileName); + + /// + /// 获取开发者分发的资源信息 + /// + DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName); } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/Services/Internal/IRemoteServices.cs b/Assets/YooAsset/Runtime/Services/IRemoteServices.cs similarity index 100% rename from Assets/YooAsset/Runtime/Services/Internal/IRemoteServices.cs rename to Assets/YooAsset/Runtime/Services/IRemoteServices.cs diff --git a/Assets/YooAsset/Runtime/Services/Internal/IRemoteServices.cs.meta b/Assets/YooAsset/Runtime/Services/IRemoteServices.cs.meta similarity index 100% rename from Assets/YooAsset/Runtime/Services/Internal/IRemoteServices.cs.meta rename to Assets/YooAsset/Runtime/Services/IRemoteServices.cs.meta