refactor : 重构代码

This commit is contained in:
何冠峰
2026-01-16 10:28:01 +08:00
parent 2b6e7856e7
commit b0e85017d2
100 changed files with 1042 additions and 1582 deletions
@@ -13,9 +13,8 @@ namespace YooAsset
Done,
}
private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options;
private readonly IWebDecryptionServices _decryptionServices;
private readonly IWebBundleDecryptionServices _decryptionServices;
private readonly IDownloadBackend _downloadBackend;
private IDownloadBytesRequest _unityWebDataRequestOp;
@@ -24,9 +23,8 @@ namespace YooAsset
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
internal LoadWebEncryptAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, IWebDecryptionServices decryptionServices, IDownloadBackend downloadBackend)
internal LoadWebEncryptAssetBundleOperation(DownloadFileOptions options, IWebBundleDecryptionServices decryptionServices, IDownloadBackend downloadBackend)
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
_decryptionServices = decryptionServices;
@@ -48,7 +46,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"The {nameof(IWebDecryptionServices)} is null !";
Error = $"The {nameof(IWebBundleDecryptionServices)} is null !";
YooLogger.Error(Error);
return;
}
@@ -124,11 +122,11 @@ namespace YooAsset
/// </summary>
private AssetBundle LoadEncryptedAssetBundle(byte[] fileData)
{
var fileInfo = new WebDecryptFileInfo();
fileInfo.BundleName = _bundle.BundleName;
fileInfo.FileLoadCRC = _bundle.UnityCRC;
var fileInfo = new WebDecryptBundleInfo();
fileInfo.BundleName = _options.Bundle.BundleName;
fileInfo.FileLoadCRC = _options.Bundle.UnityCRC;
fileInfo.FileData = fileData;
var decryptResult = _decryptionServices.LoadAssetBundle(fileInfo);
var decryptResult = _decryptionServices.LoadAssetBundleSync(fileInfo);
return decryptResult.Result;
}