mirror of https://github.com/tuyoogame/YooAsset
parent
b5df539392
commit
b737b20602
|
@ -72,6 +72,11 @@ namespace YooAsset
|
||||||
_steps = ESteps.LoadFile;
|
_steps = ESteps.LoadFile;
|
||||||
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
|
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
|
||||||
}
|
}
|
||||||
|
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromDelivery)
|
||||||
|
{
|
||||||
|
_steps = ESteps.LoadFile;
|
||||||
|
FileLoadPath = MainBundleInfo.DeliveryFilePath;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException(MainBundleInfo.LoadMode.ToString());
|
throw new System.NotImplementedException(MainBundleInfo.LoadMode.ToString());
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace YooAsset
|
||||||
public enum ELoadMode
|
public enum ELoadMode
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
LoadFromDelivery,
|
||||||
LoadFromStreaming,
|
LoadFromStreaming,
|
||||||
LoadFromCache,
|
LoadFromCache,
|
||||||
LoadFromRemote,
|
LoadFromRemote,
|
||||||
|
@ -25,6 +26,11 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RemoteFallbackURL { private set; get; }
|
public string RemoteFallbackURL { private set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开发者分发的文件地址
|
||||||
|
/// </summary>
|
||||||
|
public string DeliveryFilePath { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注意:该字段只用于帮助编辑器下的模拟模式。
|
/// 注意:该字段只用于帮助编辑器下的模拟模式。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -40,6 +46,15 @@ namespace YooAsset
|
||||||
LoadMode = loadMode;
|
LoadMode = loadMode;
|
||||||
RemoteMainURL = mainURL;
|
RemoteMainURL = mainURL;
|
||||||
RemoteFallbackURL = fallbackURL;
|
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)
|
public BundleInfo(PackageBundle bundle, ELoadMode loadMode)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +62,7 @@ namespace YooAsset
|
||||||
LoadMode = loadMode;
|
LoadMode = loadMode;
|
||||||
RemoteMainURL = string.Empty;
|
RemoteMainURL = string.Empty;
|
||||||
RemoteFallbackURL = string.Empty;
|
RemoteFallbackURL = string.Empty;
|
||||||
|
DeliveryFilePath = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -60,6 +60,14 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID);
|
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接口
|
#region IPlayModeServices接口
|
||||||
public PackageManifest ActiveManifest
|
public PackageManifest ActiveManifest
|
||||||
|
@ -270,6 +278,13 @@ namespace YooAsset
|
||||||
if (packageBundle == null)
|
if (packageBundle == null)
|
||||||
throw new Exception("Should never get here !");
|
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))
|
if (IsCachedPackageBundle(packageBundle))
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,13 @@ namespace YooAsset
|
||||||
public interface IQueryServices
|
public interface IQueryServices
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询内置资源
|
/// 查询应用程序里的内置资源是否存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool QueryStreamingAssets(string packageName, string fileName);
|
bool QueryStreamingAssets(string packageName, string fileName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询开发者分发的文件加载路径
|
||||||
|
/// </summary>
|
||||||
|
string QueryDeliveryFiles(string packageName, string fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue