diff --git a/Assets/YooAsset/Runtime/InitializeParameters.cs b/Assets/YooAsset/Runtime/InitializeParameters.cs index 9436685..93805b8 100644 --- a/Assets/YooAsset/Runtime/InitializeParameters.cs +++ b/Assets/YooAsset/Runtime/InitializeParameters.cs @@ -88,7 +88,12 @@ namespace YooAsset /// /// 内置资源查询服务接口 /// - public IQueryServices QueryServices = null; + public IBuildinQueryServices BuildinQueryServices = null; + + /// + /// 分发资源查询服务接口 + /// + public IDeliveryQueryServices DeliveryQueryServices = null; /// /// 远端资源地址查询服务类 @@ -104,7 +109,7 @@ namespace YooAsset /// /// 内置资源查询服务接口 /// - public IQueryServices QueryServices = null; + public IBuildinQueryServices BuildinQueryServices = null; /// /// 远端资源地址查询服务类 diff --git a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs index 9575c6f..6fb7e4f 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/HostPlayModeImpl.cs @@ -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 /// /// 异步初始化 /// - 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接口 diff --git a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/WebPlayModeImpl.cs b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/WebPlayModeImpl.cs index 2b14e44..24a846f 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/PlayMode/WebPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/PlayMode/WebPlayModeImpl.cs @@ -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 /// /// 异步初始化 /// - 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接口 diff --git a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs index 08e500d..eaedbec 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs @@ -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."); } diff --git a/Assets/YooAsset/Runtime/Services/IBuildinQueryServices.cs b/Assets/YooAsset/Runtime/Services/IBuildinQueryServices.cs new file mode 100644 index 0000000..bf4f230 --- /dev/null +++ b/Assets/YooAsset/Runtime/Services/IBuildinQueryServices.cs @@ -0,0 +1,11 @@ + +namespace YooAsset +{ + public interface IBuildinQueryServices + { + /// + /// 查询应用程序里的内置资源是否存在 + /// + bool QueryStreamingAssets(string packageName, string fileName); + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/Services/IQueryServices.cs.meta b/Assets/YooAsset/Runtime/Services/IBuildinQueryServices.cs.meta similarity index 100% rename from Assets/YooAsset/Runtime/Services/IQueryServices.cs.meta rename to Assets/YooAsset/Runtime/Services/IBuildinQueryServices.cs.meta diff --git a/Assets/YooAsset/Runtime/Services/IQueryServices.cs b/Assets/YooAsset/Runtime/Services/IDeliveryQueryServices.cs similarity index 72% rename from Assets/YooAsset/Runtime/Services/IQueryServices.cs rename to Assets/YooAsset/Runtime/Services/IDeliveryQueryServices.cs index e9ba2f5..9e2fc11 100644 --- a/Assets/YooAsset/Runtime/Services/IQueryServices.cs +++ b/Assets/YooAsset/Runtime/Services/IDeliveryQueryServices.cs @@ -9,14 +9,9 @@ namespace YooAsset public string DeliveryFilePath; public ulong DeliveryFileOffset; } - - public interface IQueryServices + + public interface IDeliveryQueryServices { - /// - /// 查询应用程序里的内置资源是否存在 - /// - bool QueryStreamingAssets(string packageName, string fileName); - /// /// 查询是否为开发者分发的资源 /// diff --git a/Assets/YooAsset/Runtime/Services/IDeliveryQueryServices.cs.meta b/Assets/YooAsset/Runtime/Services/IDeliveryQueryServices.cs.meta new file mode 100644 index 0000000..5941a59 --- /dev/null +++ b/Assets/YooAsset/Runtime/Services/IDeliveryQueryServices.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7edb4ad6b8dd5cf4bbe1b84a019f6303 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: