mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 21:48:47 +00:00
fix #562
This commit is contained in:
@@ -559,6 +559,21 @@ namespace YooAsset
|
|||||||
};
|
};
|
||||||
return DecryptionServices.LoadAssetBundleAsync(fileInfo);
|
return DecryptionServices.LoadAssetBundleAsync(fileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载加密资源文件
|
||||||
|
/// </summary>
|
||||||
|
public DecryptResult LoadEncryptedAssetBundleFallback(PackageBundle bundle)
|
||||||
|
{
|
||||||
|
string filePath = GetCacheBundleFileLoadPath(bundle);
|
||||||
|
var fileInfo = new DecryptFileInfo()
|
||||||
|
{
|
||||||
|
BundleName = bundle.BundleName,
|
||||||
|
FileLoadCRC = bundle.UnityCRC,
|
||||||
|
FileLoadPath = filePath,
|
||||||
|
};
|
||||||
|
return DecryptionServices.LoadAssetBundleFallback(fileInfo);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,6 +163,17 @@ namespace YooAsset
|
|||||||
if (verifyResult == EFileVerifyResult.Succeed)
|
if (verifyResult == EFileVerifyResult.Succeed)
|
||||||
{
|
{
|
||||||
if (_bundle.Encrypted)
|
if (_bundle.Encrypted)
|
||||||
|
{
|
||||||
|
var decryptResult = _fileSystem.LoadEncryptedAssetBundleFallback(_bundle);
|
||||||
|
_assetBundle = decryptResult.Result;
|
||||||
|
if (_assetBundle != null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Result = new AssetBundleResult(_fileSystem, _bundle, _assetBundle, _managedStream);
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
@@ -170,6 +181,7 @@ namespace YooAsset
|
|||||||
YooLogger.Error(Error);
|
YooLogger.Error(Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 注意:在安卓移动平台,华为和三星真机上有极小概率加载资源包失败。
|
// 注意:在安卓移动平台,华为和三星真机上有极小概率加载资源包失败。
|
||||||
// 说明:大多数情况在首次安装下载资源到沙盒内,游戏过程中切换到后台再回到游戏内有很大概率触发!
|
// 说明:大多数情况在首次安装下载资源到沙盒内,游戏过程中切换到后台再回到游戏内有很大概率触发!
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
DecryptResult LoadAssetBundleAsync(DecryptFileInfo fileInfo);
|
DecryptResult LoadAssetBundleAsync(DecryptFileInfo fileInfo);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 后备方式获取解密的资源包对象
|
||||||
|
/// 注意:当正常解密方法失败后,会触发后备加载!
|
||||||
|
/// 说明:建议通过LoadFromMemory()方法加载资源对象作为保底机制。
|
||||||
|
/// issues : https://github.com/tuyoogame/YooAsset/issues/562
|
||||||
|
/// </summary>
|
||||||
|
DecryptResult LoadAssetBundleFallback(DecryptFileInfo fileInfo);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取解密的字节数据
|
/// 获取解密的字节数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -147,6 +147,14 @@ public class FileStreamTestDecryption : IDecryptionServices
|
|||||||
return decryptResult;
|
return decryptResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 后备方式获取解密的资源包对象
|
||||||
|
/// </summary>
|
||||||
|
DecryptResult IDecryptionServices.LoadAssetBundleFallback(DecryptFileInfo fileInfo)
|
||||||
|
{
|
||||||
|
return new DecryptResult();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取解密的字节数据
|
/// 获取解密的字节数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -198,6 +206,14 @@ public class FileOffsetTestDecryption : IDecryptionServices
|
|||||||
return decryptResult;
|
return decryptResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 后备方式获取解密的资源包对象
|
||||||
|
/// </summary>
|
||||||
|
DecryptResult IDecryptionServices.LoadAssetBundleFallback(DecryptFileInfo fileInfo)
|
||||||
|
{
|
||||||
|
return new DecryptResult();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取解密的字节数据
|
/// 获取解密的字节数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user