diff --git a/Assets/YooAsset/Runtime/AssetSystem/Loader/AssetBundleFileLoader.cs b/Assets/YooAsset/Runtime/AssetSystem/Loader/AssetBundleFileLoader.cs
index 483eb97..dc4bb64 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Loader/AssetBundleFileLoader.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Loader/AssetBundleFileLoader.cs
@@ -72,6 +72,11 @@ namespace YooAsset
_steps = ESteps.LoadFile;
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
}
+ else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromDelivery)
+ {
+ _steps = ESteps.LoadFile;
+ FileLoadPath = MainBundleInfo.DeliveryFilePath;
+ }
else
{
throw new System.NotImplementedException(MainBundleInfo.LoadMode.ToString());
diff --git a/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs b/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs
index 793deb2..a3d9e15 100644
--- a/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs
+++ b/Assets/YooAsset/Runtime/PackageSystem/BundleInfo.cs
@@ -6,6 +6,7 @@ namespace YooAsset
public enum ELoadMode
{
None,
+ LoadFromDelivery,
LoadFromStreaming,
LoadFromCache,
LoadFromRemote,
@@ -25,6 +26,11 @@ namespace YooAsset
///
public string RemoteFallbackURL { private set; get; }
+ ///
+ /// 开发者分发的文件地址
+ ///
+ public string DeliveryFilePath { private set; get; }
+
///
/// 注意:该字段只用于帮助编辑器下的模拟模式。
///
@@ -40,6 +46,15 @@ namespace YooAsset
LoadMode = loadMode;
RemoteMainURL = mainURL;
RemoteFallbackURL = fallbackURL;
+ DeliveryFilePath = string.Empty;
+ }
+ public BundleInfo(PackageBundle bundle, ELoadMode loadMode, string deliveryFilePath)
+ {
+ Bundle = bundle;
+ LoadMode = loadMode;
+ RemoteMainURL = string.Empty;
+ RemoteFallbackURL = string.Empty;
+ DeliveryFilePath = deliveryFilePath;
}
public BundleInfo(PackageBundle bundle, ELoadMode loadMode)
{
@@ -47,6 +62,7 @@ namespace YooAsset
LoadMode = loadMode;
RemoteMainURL = string.Empty;
RemoteFallbackURL = string.Empty;
+ DeliveryFilePath = string.Empty;
}
///
diff --git a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs
index cfe0978..b92db53 100644
--- a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs
@@ -60,6 +60,14 @@ namespace YooAsset
{
return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID);
}
+ private bool IsDeliveryPackageBundle(PackageBundle packageBundle, out string deliveryFilePath)
+ {
+ deliveryFilePath = _queryServices.QueryDeliveryFiles(_packageName, packageBundle.FileName);
+ if (string.IsNullOrEmpty(deliveryFilePath))
+ return false;
+ else
+ return true;
+ }
#region IPlayModeServices接口
public PackageManifest ActiveManifest
@@ -270,6 +278,13 @@ namespace YooAsset
if (packageBundle == null)
throw new Exception("Should never get here !");
+ // 查询分发资源
+ if (IsDeliveryPackageBundle(packageBundle, out string deliveryFilePath))
+ {
+ BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromDelivery, deliveryFilePath);
+ return bundleInfo;
+ }
+
// 查询沙盒资源
if (IsCachedPackageBundle(packageBundle))
{
diff --git a/Assets/YooAsset/Runtime/Services/IQueryServices.cs b/Assets/YooAsset/Runtime/Services/IQueryServices.cs
index 16170ba..404a5f2 100644
--- a/Assets/YooAsset/Runtime/Services/IQueryServices.cs
+++ b/Assets/YooAsset/Runtime/Services/IQueryServices.cs
@@ -4,8 +4,13 @@ namespace YooAsset
public interface IQueryServices
{
///
- /// 查询内置资源
+ /// 查询应用程序里的内置资源是否存在
///
bool QueryStreamingAssets(string packageName, string fileName);
+
+ ///
+ /// 查询开发者分发的文件加载路径
+ ///
+ string QueryDeliveryFiles(string packageName, string fileName);
}
}
\ No newline at end of file