mirror of https://github.com/tuyoogame/YooAsset
parent
e743a15fbc
commit
370329b07d
|
@ -150,5 +150,10 @@ namespace YooAsset
|
||||||
/// 内置资源查询服务接口
|
/// 内置资源查询服务接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IBuildinQueryServices BuildinQueryServices = null;
|
public IBuildinQueryServices BuildinQueryServices = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 微信缓存查询服务接口
|
||||||
|
/// </summary>
|
||||||
|
public IWechatQueryServices WechatQueryServices = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@ namespace YooAsset
|
||||||
private ResourceAssist _assist;
|
private ResourceAssist _assist;
|
||||||
private IBuildinQueryServices _buildinQueryServices;
|
private IBuildinQueryServices _buildinQueryServices;
|
||||||
private IRemoteServices _remoteServices;
|
private IRemoteServices _remoteServices;
|
||||||
|
private IWechatQueryServices _wechatQueryServices;
|
||||||
|
|
||||||
public readonly string PackageName;
|
public readonly string PackageName;
|
||||||
public DownloadManager Download
|
public DownloadManager Download
|
||||||
|
@ -34,11 +35,12 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步初始化
|
/// 异步初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitializationOperation InitializeAsync(ResourceAssist assist, IBuildinQueryServices buildinQueryServices, IRemoteServices remoteServices)
|
public InitializationOperation InitializeAsync(ResourceAssist assist, IBuildinQueryServices buildinQueryServices, IRemoteServices remoteServices, IWechatQueryServices wechatQueryServices)
|
||||||
{
|
{
|
||||||
_assist = assist;
|
_assist = assist;
|
||||||
_buildinQueryServices = buildinQueryServices;
|
_buildinQueryServices = buildinQueryServices;
|
||||||
_remoteServices = remoteServices;
|
_remoteServices = remoteServices;
|
||||||
|
_wechatQueryServices = wechatQueryServices;
|
||||||
|
|
||||||
var operation = new WebPlayModeInitializationOperation(this);
|
var operation = new WebPlayModeInitializationOperation(this);
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
|
@ -65,23 +67,13 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询相关
|
// 查询相关
|
||||||
#if UNITY_WECHAT_GAME
|
|
||||||
private WeChatWASM.WXFileSystemManager _wxFileSystemMgr;
|
|
||||||
private bool IsCachedPackageBundle(PackageBundle packageBundle)
|
|
||||||
{
|
|
||||||
if (_wxFileSystemMgr == null)
|
|
||||||
_wxFileSystemMgr = WeChatWASM.WX.GetFileSystemManager();
|
|
||||||
string filePath = WeChatWASM.WX.env.USER_DATA_PATH + packageBundle.FileName;
|
|
||||||
string result = _wxFileSystemMgr.AccessSync(filePath);
|
|
||||||
return result.Equals("access:ok");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
private bool IsCachedPackageBundle(PackageBundle packageBundle)
|
private bool IsCachedPackageBundle(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
|
if (_wechatQueryServices != null)
|
||||||
|
return _wechatQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
|
||||||
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
|
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
return _buildinQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
|
return _buildinQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
|
||||||
|
|
|
@ -184,7 +184,8 @@ namespace YooAsset
|
||||||
var initializeParameters = parameters as WebPlayModeParameters;
|
var initializeParameters = parameters as WebPlayModeParameters;
|
||||||
initializeOperation = webPlayModeImpl.InitializeAsync(assist,
|
initializeOperation = webPlayModeImpl.InitializeAsync(assist,
|
||||||
initializeParameters.BuildinQueryServices,
|
initializeParameters.BuildinQueryServices,
|
||||||
initializeParameters.RemoteServices);
|
initializeParameters.RemoteServices,
|
||||||
|
initializeParameters.WechatQueryServices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
public interface IWechatQueryServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询是否为微信缓存的资源文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageName">包裹名称</param>
|
||||||
|
/// <param name="fileName">文件名称(包含文件的后缀格式)</param>
|
||||||
|
/// <param name="fileCRC">文件哈希值</param>
|
||||||
|
/// <returns>返回查询结果</returns>
|
||||||
|
bool Query(string packageName, string fileName, string fileCRC);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e6b28ce9425f5eb4f972dcda9fd864f3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue