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

View File

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

View File

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

View File

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

@ -10,13 +10,8 @@ namespace YooAsset
public ulong DeliveryFileOffset; public ulong DeliveryFileOffset;
} }
public interface IQueryServices public interface IDeliveryQueryServices
{ {
/// <summary>
/// 查询应用程序里的内置资源是否存在
/// </summary>
bool QueryStreamingAssets(string packageName, string fileName);
/// <summary> /// <summary>
/// 查询是否为开发者分发的资源 /// 查询是否为开发者分发的资源
/// </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: