update package system

IQueryServices接口变更为IBuildinQueryServices
pull/150/head
hevinci 2023-08-14 12:27:43 +08:00
parent ab2d7d4724
commit a2d4691f04
8 changed files with 50 additions and 23 deletions

View File

@ -88,7 +88,12 @@ namespace YooAsset
/// <summary>
/// 内置资源查询服务接口
/// </summary>
public IQueryServices QueryServices = null;
public IBuildinQueryServices BuildinQueryServices = null;
/// <summary>
/// 分发资源查询服务接口
/// </summary>
public IDeliveryQueryServices DeliveryQueryServices = null;
/// <summary>
/// 远端资源地址查询服务类
@ -104,7 +109,7 @@ namespace YooAsset
/// <summary>
/// 内置资源查询服务接口
/// </summary>
public IQueryServices QueryServices = null;
public IBuildinQueryServices BuildinQueryServices = null;
/// <summary>
/// 远端资源地址查询服务类

View File

@ -10,7 +10,8 @@ namespace YooAsset
// 参数相关
private string _packageName;
private IQueryServices _queryServices;
private IBuildinQueryServices _buildinQueryServices;
private IDeliveryQueryServices _deliveryQueryServices;
private IRemoteServices _remoteServices;
public IRemoteServices RemoteServices
@ -21,10 +22,11 @@ namespace YooAsset
/// <summary>
/// 异步初始化
/// </summary>
public InitializationOperation InitializeAsync(string packageName, IQueryServices queryServices, IRemoteServices remoteServices)
public InitializationOperation InitializeAsync(string packageName, IBuildinQueryServices buildinQueryServices, IDeliveryQueryServices deliveryQueryServices, IRemoteServices remoteServices)
{
_packageName = packageName;
_queryServices = queryServices;
_buildinQueryServices = buildinQueryServices;
_deliveryQueryServices = deliveryQueryServices;
_remoteServices = remoteServices;
var operation = new HostPlayModeInitializationOperation(this, packageName);
@ -54,7 +56,7 @@ namespace YooAsset
// 查询相关
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
{
return _queryServices.QueryStreamingAssets(_packageName, packageBundle.FileName);
return _buildinQueryServices.QueryStreamingAssets(_packageName, packageBundle.FileName);
}
private bool IsCachedPackageBundle(PackageBundle packageBundle)
{
@ -62,11 +64,11 @@ namespace YooAsset
}
private bool IsDeliveryPackageBundle(PackageBundle packageBundle)
{
return _queryServices.QueryDeliveryFiles(_packageName, packageBundle.FileName);
return _deliveryQueryServices.QueryDeliveryFiles(_packageName, packageBundle.FileName);
}
private DeliveryFileInfo GetDeiveryFileInfo(PackageBundle packageBundle)
{
return _queryServices.GetDeliveryFileInfo(_packageName, packageBundle.FileName);
return _deliveryQueryServices.GetDeliveryFileInfo(_packageName, packageBundle.FileName);
}
#region IPlayModeServices接口

View File

@ -10,7 +10,7 @@ namespace YooAsset
// 参数相关
private string _packageName;
private IQueryServices _queryServices;
private IBuildinQueryServices _buildinQueryServices;
private IRemoteServices _remoteServices;
public IRemoteServices RemoteServices
@ -21,10 +21,10 @@ namespace YooAsset
/// <summary>
/// 异步初始化
/// </summary>
public InitializationOperation InitializeAsync(string packageName, IQueryServices queryServices, IRemoteServices remoteServices)
public InitializationOperation InitializeAsync(string packageName, IBuildinQueryServices buildinQueryServices, IRemoteServices remoteServices)
{
_packageName = packageName;
_queryServices = queryServices;
_buildinQueryServices = buildinQueryServices;
_remoteServices = remoteServices;
var operation = new WebPlayModeInitializationOperation(this, packageName);
@ -44,7 +44,7 @@ namespace YooAsset
// 查询相关
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
{
return _queryServices.QueryStreamingAssets(_packageName, packageBundle.FileName);
return _buildinQueryServices.QueryStreamingAssets(_packageName, packageBundle.FileName);
}
#region IPlayModeServices接口

View File

@ -122,7 +122,8 @@ namespace YooAsset
var initializeParameters = parameters as HostPlayModeParameters;
initializeOperation = hostPlayModeImpl.InitializeAsync(
PackageName,
initializeParameters.QueryServices,
initializeParameters.BuildinQueryServices,
initializeParameters.DeliveryQueryServices,
initializeParameters.RemoteServices
);
}
@ -138,7 +139,7 @@ namespace YooAsset
var initializeParameters = parameters as WebPlayModeParameters;
initializeOperation = webPlayModeImpl.InitializeAsync(
PackageName,
initializeParameters.QueryServices,
initializeParameters.BuildinQueryServices,
initializeParameters.RemoteServices
);
}
@ -187,8 +188,10 @@ namespace YooAsset
if (parameters is HostPlayModeParameters)
{
var hostPlayModeParameters = parameters as HostPlayModeParameters;
if (hostPlayModeParameters.QueryServices == null)
throw new Exception($"{nameof(IQueryServices)} is null.");
if (hostPlayModeParameters.BuildinQueryServices == null)
throw new Exception($"{nameof(IBuildinQueryServices)} is null.");
if (hostPlayModeParameters.DeliveryQueryServices == null)
throw new Exception($"{nameof(IDeliveryQueryServices)} is null.");
if (hostPlayModeParameters.RemoteServices == null)
throw new Exception($"{nameof(IRemoteServices)} is null.");
}

View File

@ -0,0 +1,11 @@

namespace YooAsset
{
public interface IBuildinQueryServices
{
/// <summary>
/// 查询应用程序里的内置资源是否存在
/// </summary>
bool QueryStreamingAssets(string packageName, string fileName);
}
}

View File

@ -9,14 +9,9 @@ namespace YooAsset
public string DeliveryFilePath;
public ulong DeliveryFileOffset;
}
public interface IQueryServices
public interface IDeliveryQueryServices
{
/// <summary>
/// 查询应用程序里的内置资源是否存在
/// </summary>
bool QueryStreamingAssets(string packageName, string fileName);
/// <summary>
/// 查询是否为开发者分发的资源
/// </summary>

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7edb4ad6b8dd5cf4bbe1b84a019f6303
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: