mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-31 05:58:47 +00:00
update runtime code
This commit is contained in:
@@ -31,6 +31,11 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string DeliveryFilePath { private set; get; }
|
public string DeliveryFilePath { private set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开发者分发的文件偏移量
|
||||||
|
/// </summary>
|
||||||
|
public ulong DeliveryFileOffset { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注意:该字段只用于帮助编辑器下的模拟模式。
|
/// 注意:该字段只用于帮助编辑器下的模拟模式。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -47,14 +52,16 @@ namespace YooAsset
|
|||||||
RemoteMainURL = mainURL;
|
RemoteMainURL = mainURL;
|
||||||
RemoteFallbackURL = fallbackURL;
|
RemoteFallbackURL = fallbackURL;
|
||||||
DeliveryFilePath = string.Empty;
|
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;
|
Bundle = bundle;
|
||||||
LoadMode = loadMode;
|
LoadMode = loadMode;
|
||||||
RemoteMainURL = string.Empty;
|
RemoteMainURL = string.Empty;
|
||||||
RemoteFallbackURL = string.Empty;
|
RemoteFallbackURL = string.Empty;
|
||||||
DeliveryFilePath = deliveryFilePath;
|
DeliveryFilePath = deliveryFilePath;
|
||||||
|
DeliveryFileOffset = deliveryFileOffset;
|
||||||
}
|
}
|
||||||
public BundleInfo(PackageBundle bundle, ELoadMode loadMode)
|
public BundleInfo(PackageBundle bundle, ELoadMode loadMode)
|
||||||
{
|
{
|
||||||
@@ -63,6 +70,7 @@ namespace YooAsset
|
|||||||
RemoteMainURL = string.Empty;
|
RemoteMainURL = string.Empty;
|
||||||
RemoteFallbackURL = string.Empty;
|
RemoteFallbackURL = string.Empty;
|
||||||
DeliveryFilePath = string.Empty;
|
DeliveryFilePath = string.Empty;
|
||||||
|
DeliveryFileOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID);
|
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);
|
return _queryServices.QueryDeliveryFiles(_packageName, packageBundle.FileName);
|
||||||
if (string.IsNullOrEmpty(deliveryFilePath))
|
}
|
||||||
return false;
|
private DeliveryFileInfo GetDeiveryFileInfo(PackageBundle packageBundle)
|
||||||
else
|
{
|
||||||
return true;
|
return _queryServices.GetDeliveryFileInfo(_packageName, packageBundle.FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IPlayModeServices接口
|
#region IPlayModeServices接口
|
||||||
@@ -119,6 +119,10 @@ namespace YooAsset
|
|||||||
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
||||||
foreach (var packageBundle in manifest.BundleList)
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
{
|
{
|
||||||
|
// 忽略分发文件
|
||||||
|
if (IsDeliveryPackageBundle(packageBundle))
|
||||||
|
continue;
|
||||||
|
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (IsCachedPackageBundle(packageBundle))
|
if (IsCachedPackageBundle(packageBundle))
|
||||||
continue;
|
continue;
|
||||||
@@ -144,6 +148,10 @@ namespace YooAsset
|
|||||||
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
||||||
foreach (var packageBundle in manifest.BundleList)
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
{
|
{
|
||||||
|
// 忽略分发文件
|
||||||
|
if (IsDeliveryPackageBundle(packageBundle))
|
||||||
|
continue;
|
||||||
|
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (IsCachedPackageBundle(packageBundle))
|
if (IsCachedPackageBundle(packageBundle))
|
||||||
continue;
|
continue;
|
||||||
@@ -205,6 +213,10 @@ namespace YooAsset
|
|||||||
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
||||||
foreach (var packageBundle in checkList)
|
foreach (var packageBundle in checkList)
|
||||||
{
|
{
|
||||||
|
// 忽略分发文件
|
||||||
|
if (IsDeliveryPackageBundle(packageBundle))
|
||||||
|
continue;
|
||||||
|
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (IsCachedPackageBundle(packageBundle))
|
if (IsCachedPackageBundle(packageBundle))
|
||||||
continue;
|
continue;
|
||||||
@@ -279,9 +291,10 @@ namespace YooAsset
|
|||||||
throw new Exception("Should never get here !");
|
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;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 分发的资源信息
|
||||||
|
/// </summary>
|
||||||
|
public struct DeliveryFileInfo
|
||||||
|
{
|
||||||
|
public string DeliveryFilePath;
|
||||||
|
public ulong DeliveryFileOffset;
|
||||||
|
}
|
||||||
|
|
||||||
public interface IQueryServices
|
public interface IQueryServices
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -9,8 +18,13 @@ namespace YooAsset
|
|||||||
bool QueryStreamingAssets(string packageName, string fileName);
|
bool QueryStreamingAssets(string packageName, string fileName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询开发者分发的文件加载路径
|
/// 查询是否为开发者分发的资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string QueryDeliveryFiles(string packageName, string fileName);
|
bool QueryDeliveryFiles(string packageName, string fileName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取开发者分发的资源信息
|
||||||
|
/// </summary>
|
||||||
|
DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user