mirror of https://github.com/tuyoogame/YooAsset
update file system
parent
481711fd75
commit
bafd15571a
|
@ -0,0 +1,30 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DownloadParam
|
||||
{
|
||||
public readonly int FailedTryAgain;
|
||||
public readonly int Timeout;
|
||||
|
||||
/// <summary>
|
||||
/// 导入的本地文件路径
|
||||
/// </summary>
|
||||
public string ImportFilePath { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 主资源地址
|
||||
/// </summary>
|
||||
public string MainURL { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 备用资源地址
|
||||
/// </summary>
|
||||
public string FallbackURL { set; get; }
|
||||
|
||||
public DownloadParam(int failedTryAgain, int timeout)
|
||||
{
|
||||
FailedTryAgain = failedTryAgain;
|
||||
Timeout = timeout;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2c2153284d246964fb2146f9fdda311c
|
||||
guid: 56ea224b45d314e4a86b558404e9b6c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
|
@ -41,7 +41,7 @@ namespace YooAsset
|
|||
#elif UNITY_STANDALONE
|
||||
return StringUtility.Format("file:///{0}", path);
|
||||
#elif UNITY_OPENHARMONY
|
||||
return path;
|
||||
return StringUtility.Format("file://{0}", path);
|
||||
#else
|
||||
return path;
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,36 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
internal class DefaultBuildinFileSystem : IFileSystem
|
||||
{
|
||||
private class UnpackRemoteServices : IRemoteServices
|
||||
{
|
||||
private readonly string _buildinPackageRoot;
|
||||
protected readonly Dictionary<string, string> _mapping = new Dictionary<string, string>(10000);
|
||||
|
||||
public UnpackRemoteServices(string buildinPackRoot)
|
||||
{
|
||||
_buildinPackageRoot = buildinPackRoot;
|
||||
}
|
||||
string IRemoteServices.GetRemoteMainURL(string fileName)
|
||||
{
|
||||
return GetFileLoadURL(fileName);
|
||||
}
|
||||
string IRemoteServices.GetRemoteFallbackURL(string fileName)
|
||||
{
|
||||
return GetFileLoadURL(fileName);
|
||||
}
|
||||
|
||||
private string GetFileLoadURL(string fileName)
|
||||
{
|
||||
if (_mapping.TryGetValue(fileName, out string url) == false)
|
||||
{
|
||||
string filePath = PathUtility.Combine(_buildinPackageRoot, fileName);
|
||||
url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_mapping.Add(fileName, url);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
public class FileWrapper
|
||||
{
|
||||
public string FileName { private set; get; }
|
||||
|
@ -23,11 +53,9 @@ namespace YooAsset
|
|||
protected readonly Dictionary<string, FileWrapper> _wrappers = new Dictionary<string, FileWrapper>(10000);
|
||||
protected readonly Dictionary<string, Stream> _loadedStream = new Dictionary<string, Stream>(10000);
|
||||
protected readonly Dictionary<string, string> _buildinFilePaths = new Dictionary<string, string>(10000);
|
||||
protected IFileSystem _unpackFileSystem;
|
||||
protected string _packageRoot;
|
||||
|
||||
// 解压文件系统
|
||||
public IFileSystem UnpackFileSystem { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 包裹名称
|
||||
/// </summary>
|
||||
|
@ -99,37 +127,38 @@ namespace YooAsset
|
|||
return operation;
|
||||
#endif
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(params object[] args)
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DBFSLoadPackageManifestOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(params object[] args)
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DBFSRequestPackageVersionOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync()
|
||||
{
|
||||
return UnpackFileSystem.ClearAllBundleFilesAsync();
|
||||
return _unpackFileSystem.ClearAllBundleFilesAsync();
|
||||
}
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(PackageManifest manifest)
|
||||
{
|
||||
PackageManifest manifest = args[0] as PackageManifest;
|
||||
return UnpackFileSystem.ClearUnusedBundleFilesAsync(manifest);
|
||||
return _unpackFileSystem.ClearUnusedBundleFilesAsync(manifest);
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(params object[] args)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
{
|
||||
PackageBundle bundle = args[0] as PackageBundle;
|
||||
int failedTryAgain = (int)args[2];
|
||||
int timeout = (int)args[3];
|
||||
string buidlinFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return UnpackFileSystem.DownloadFileAsync(bundle, buidlinFilePath, failedTryAgain, timeout);
|
||||
param.ImportFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(bundle, param);
|
||||
}
|
||||
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
{
|
||||
if (NeedUnpack(bundle))
|
||||
{
|
||||
return _unpackFileSystem.LoadBundleFile(bundle);
|
||||
}
|
||||
|
||||
if (RawFileBuildPipeline)
|
||||
{
|
||||
var operation = new DBFSLoadRawBundleOperation(this, bundle);
|
||||
|
@ -149,9 +178,9 @@ namespace YooAsset
|
|||
if (assetBundle == null)
|
||||
return;
|
||||
|
||||
if (UnpackFileSystem.Exists(bundle))
|
||||
if (_unpackFileSystem.Exists(bundle))
|
||||
{
|
||||
UnpackFileSystem.UnloadBundleFile(bundle, assetBundle);
|
||||
_unpackFileSystem.UnloadBundleFile(bundle, assetBundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -196,11 +225,13 @@ namespace YooAsset
|
|||
_packageRoot = PathUtility.Combine(rootDirectory, packageName);
|
||||
|
||||
// 创建解压文件系统
|
||||
UnpackFileSystem = new DefaultUnpackFileSystem();
|
||||
UnpackFileSystem.SetParameter("FILE_VERIFY_LEVEL", FileVerifyLevel);
|
||||
UnpackFileSystem.SetParameter("APPEND_FILE_EXTENSION", AppendFileExtension);
|
||||
UnpackFileSystem.SetParameter("RAW_FILE_BUILD_PIPELINE", RawFileBuildPipeline);
|
||||
UnpackFileSystem.OnCreate(packageName, null);
|
||||
var remoteServices = new UnpackRemoteServices(_packageRoot);
|
||||
_unpackFileSystem = new DefaultUnpackFileSystem();
|
||||
_unpackFileSystem.SetParameter("REMOTE_SERVICES", remoteServices);
|
||||
_unpackFileSystem.SetParameter("FILE_VERIFY_LEVEL", FileVerifyLevel);
|
||||
_unpackFileSystem.SetParameter("APPEND_FILE_EXTENSION", AppendFileExtension);
|
||||
_unpackFileSystem.SetParameter("RAW_FILE_BUILD_PIPELINE", RawFileBuildPipeline);
|
||||
_unpackFileSystem.OnCreate(packageName, null);
|
||||
}
|
||||
public virtual void OnUpdate()
|
||||
{
|
||||
|
@ -237,12 +268,7 @@ namespace YooAsset
|
|||
#region 内部方法
|
||||
protected string GetDefaultRoot()
|
||||
{
|
||||
string path = PathUtility.Combine(UnityEngine.Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
||||
#if UNITY_OPENHARMONY
|
||||
return $"file://{path}";
|
||||
#else
|
||||
return path;
|
||||
#endif
|
||||
return PathUtility.Combine(Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
||||
}
|
||||
public string GetBuildinFileLoadPath(PackageBundle bundle)
|
||||
{
|
||||
|
@ -288,6 +314,14 @@ namespace YooAsset
|
|||
_wrappers.Add(bundleGUID, wrapper);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化解压文件系统
|
||||
/// </summary>
|
||||
public FSInitializeFileSystemOperation InitializeUpackFileSystem()
|
||||
{
|
||||
return _unpackFileSystem.InitializeFileSystemAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -10,8 +10,8 @@ namespace YooAsset
|
|||
public int callbackOrder { get { return 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// 在构建应用程序前自动生成内置资源清单。
|
||||
/// 原理:搜索StreamingAssets目录下的所有资源文件,然后将这些文件信息写入内置资源清单,并存储在Resources目录下。
|
||||
/// 在构建应用程序前自动生成内置资源目录文件。
|
||||
/// 原理:搜索StreamingAssets目录下的所有资源文件,然后将这些文件信息写入文件,并存储在Resources目录下。
|
||||
/// </summary>
|
||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace YooAsset
|
|||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||
if (rootDirectory.Exists == false)
|
||||
{
|
||||
Debug.LogWarning($"Not found buildin root folder : {rootPath}");
|
||||
Debug.LogWarning($"Can not found buildin root folder : {rootPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace YooAsset
|
|||
string versionFilePath = $"{pacakgeDirectory}/{versionFileName}";
|
||||
if (File.Exists(versionFilePath) == false)
|
||||
{
|
||||
Debug.LogWarning($"Not found package version file : {versionFilePath}");
|
||||
Debug.LogWarning($"Can not found package version file : {versionFilePath}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace YooAsset
|
|||
string manifestFilePath = $"{pacakgeDirectory}/{manifestFileName}";
|
||||
if (File.Exists(manifestFilePath) == false)
|
||||
{
|
||||
Debug.LogWarning($"Not found package manifest file : {manifestFilePath}");
|
||||
Debug.LogWarning($"Can not found package manifest file : {manifestFilePath}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ namespace YooAsset
|
|||
UnityEditor.AssetDatabase.CreateAsset(buildinFileCatalog, saveFilePath);
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
UnityEditor.AssetDatabase.Refresh();
|
||||
Debug.Log($"一共记录{buildinFileCatalog.Wrappers.Count}个内置资源文件,内置资源目录文件保存成功 : {saveFilePath}");
|
||||
Debug.Log($"Succeed to save buildin file catalog : {saveFilePath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace YooAsset
|
|||
if (_steps == ESteps.InitUnpackFileSystem)
|
||||
{
|
||||
if (_initUnpackFIleSystemOp == null)
|
||||
_initUnpackFIleSystemOp = _fileSystem.UnpackFileSystem.InitializeFileSystemAsync();
|
||||
_initUnpackFIleSystemOp = _fileSystem.InitializeUpackFileSystem();
|
||||
|
||||
Progress = _initUnpackFIleSystemOp.Progress;
|
||||
if (_initUnpackFIleSystemOp.IsDone == false)
|
||||
|
@ -113,7 +113,7 @@ namespace YooAsset
|
|||
if (_steps == ESteps.InitUnpackFileSystem)
|
||||
{
|
||||
if (_initUnpackFIleSystemOp == null)
|
||||
_initUnpackFIleSystemOp = _fileSystem.UnpackFileSystem.InitializeFileSystemAsync();
|
||||
_initUnpackFIleSystemOp = _fileSystem.InitializeUpackFileSystem();
|
||||
|
||||
Progress = _initUnpackFIleSystemOp.Progress;
|
||||
if (_initUnpackFIleSystemOp.IsDone == false)
|
||||
|
@ -156,7 +156,7 @@ namespace YooAsset
|
|||
|
||||
if (_steps == ESteps.RecordFiles)
|
||||
{
|
||||
PackageManifest manifest = _loadPackageManifestOp.Result;
|
||||
PackageManifest manifest = _loadPackageManifestOp.Manifest;
|
||||
string pacakgeDirectory = _fileSystem.FileRoot;
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(pacakgeDirectory);
|
||||
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
||||
|
@ -174,7 +174,7 @@ namespace YooAsset
|
|||
}
|
||||
else
|
||||
{
|
||||
YooLogger.Warning($"Failed mapping file : {fileName}");
|
||||
YooLogger.Warning($"Failed to mapping buildin bundle file : {fileName}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,14 @@ using UnityEngine;
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载AssetBundle文件
|
||||
/// </summary>
|
||||
internal class DBFSLoadAssetBundleOperation : FSLoadBundleOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
UnpackAssetBundleFile,
|
||||
LoadUnpackAssetBundle,
|
||||
LoadBuidlinAssetBundle,
|
||||
CheckLoadBuildinResult,
|
||||
Done,
|
||||
|
@ -17,8 +18,6 @@ namespace YooAsset
|
|||
|
||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
||||
private readonly PackageBundle _bundle;
|
||||
private FSLoadBundleOperation _loadUnpackBundleOp;
|
||||
private FSDownloadFileOperation _unpackBundleOp;
|
||||
private AssetBundleCreateRequest _createRequest;
|
||||
private bool _isWaitForAsyncComplete = false;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
@ -33,67 +32,13 @@ namespace YooAsset
|
|||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
|
||||
if (_fileSystem.NeedUnpack(_bundle))
|
||||
{
|
||||
_steps = ESteps.UnpackAssetBundleFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.LoadBuidlinAssetBundle;
|
||||
}
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.UnpackAssetBundleFile)
|
||||
{
|
||||
if (_unpackBundleOp == null)
|
||||
{
|
||||
int failedTryAgain = 0;
|
||||
int timeout = int.MaxValue;
|
||||
_unpackBundleOp = _fileSystem.DownloadFileAsync(_bundle, null, failedTryAgain, timeout);
|
||||
}
|
||||
|
||||
if (_unpackBundleOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_unpackBundleOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.LoadUnpackAssetBundle;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _unpackBundleOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadUnpackAssetBundle)
|
||||
{
|
||||
if (_loadUnpackBundleOp == null)
|
||||
_loadUnpackBundleOp = _fileSystem.UnpackFileSystem.LoadBundleFile(_bundle);
|
||||
|
||||
if (_loadUnpackBundleOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_loadUnpackBundleOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadUnpackBundleOp.Result;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _loadUnpackBundleOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadBuidlinAssetBundle)
|
||||
{
|
||||
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
|
||||
|
@ -146,18 +91,6 @@ namespace YooAsset
|
|||
|
||||
while (true)
|
||||
{
|
||||
if (_unpackBundleOp != null)
|
||||
{
|
||||
if (_unpackBundleOp.IsDone == false)
|
||||
_unpackBundleOp.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
if (_loadUnpackBundleOp != null)
|
||||
{
|
||||
if (_loadUnpackBundleOp.IsDone == false)
|
||||
_loadUnpackBundleOp.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
// 驱动流程
|
||||
InternalOnUpdate();
|
||||
|
||||
|
@ -168,21 +101,17 @@ namespace YooAsset
|
|||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
if (_steps == ESteps.UnpackAssetBundleFile)
|
||||
{
|
||||
if (_unpackBundleOp != null)
|
||||
_unpackBundleOp.SetAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载原生文件
|
||||
/// </summary>
|
||||
internal class DBFSLoadRawBundleOperation : FSLoadBundleOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
UnpackRawBundleFile,
|
||||
LoadUnpackRawBundle,
|
||||
LoadBuildinRawBundle,
|
||||
CheckLoadBuildinResult,
|
||||
Done,
|
||||
|
@ -190,8 +119,6 @@ namespace YooAsset
|
|||
|
||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
||||
private readonly PackageBundle _bundle;
|
||||
private FSLoadBundleOperation _loadUnpackBundleOp;
|
||||
private FSDownloadFileOperation _unpackBundleOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
|
@ -204,67 +131,13 @@ namespace YooAsset
|
|||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
|
||||
if (_fileSystem.NeedUnpack(_bundle))
|
||||
{
|
||||
_steps = ESteps.UnpackRawBundleFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.LoadBuildinRawBundle;
|
||||
}
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.UnpackRawBundleFile)
|
||||
{
|
||||
if (_unpackBundleOp == null)
|
||||
{
|
||||
int failedTryAgain = 0;
|
||||
int timeout = int.MaxValue;
|
||||
_unpackBundleOp = _fileSystem.DownloadFileAsync(_bundle, null, failedTryAgain, timeout);
|
||||
}
|
||||
|
||||
if (_unpackBundleOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_unpackBundleOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.LoadUnpackRawBundle;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _unpackBundleOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadUnpackRawBundle)
|
||||
{
|
||||
if (_loadUnpackBundleOp == null)
|
||||
_loadUnpackBundleOp = _fileSystem.UnpackFileSystem.LoadBundleFile(_bundle);
|
||||
|
||||
if (_loadUnpackBundleOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_loadUnpackBundleOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadUnpackBundleOp.Result;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _loadUnpackBundleOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadBuildinRawBundle)
|
||||
{
|
||||
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
|
||||
|
@ -302,18 +175,6 @@ namespace YooAsset
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
if (_unpackBundleOp != null)
|
||||
{
|
||||
if (_unpackBundleOp.IsDone == false)
|
||||
_unpackBundleOp.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
if (_loadUnpackBundleOp != null)
|
||||
{
|
||||
if (_loadUnpackBundleOp.IsDone == false)
|
||||
_loadUnpackBundleOp.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
// 驱动流程
|
||||
InternalOnUpdate();
|
||||
|
||||
|
@ -324,11 +185,6 @@ namespace YooAsset
|
|||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
if (_steps == ESteps.UnpackRawBundleFile)
|
||||
{
|
||||
if (_unpackBundleOp != null)
|
||||
_unpackBundleOp.SetAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -95,7 +95,7 @@ namespace YooAsset
|
|||
if (_loadBuildinPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadBuildinPackageManifestOp.Manifest;
|
||||
Manifest = _loadBuildinPackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace YooAsset
|
|||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
GetPackageVersion,
|
||||
RequestPackageVersion,
|
||||
Done,
|
||||
}
|
||||
|
||||
|
@ -21,14 +21,14 @@ namespace YooAsset
|
|||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.GetPackageVersion;
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.GetPackageVersion)
|
||||
if (_steps == ESteps.RequestPackageVersion)
|
||||
{
|
||||
if (_requestBuildinPackageVersionOp == null)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
||||
Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace YooAsset
|
|||
_fileSystem.RecordFile(wrapper.BundleGUID, fileWrapper);
|
||||
}
|
||||
|
||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' catalog files count : {catalog.Wrappers.Count}");
|
||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 加载的清单实例
|
||||
/// 包裹清单
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
|
||||
|
|
|
@ -120,42 +120,32 @@ namespace YooAsset
|
|||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(params object[] args)
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
string packageVersion = args[0] as string;
|
||||
int timeout = (int)args[1];
|
||||
var operation = new DCFSLoadPackageManifestOperation(this, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(params object[] args)
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
bool appendTimeTicks = (bool)args[0];
|
||||
int timeout = (int)args[1];
|
||||
var operation = new DCFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new DCFSClearAllBundleFilesOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(PackageManifest manifest)
|
||||
{
|
||||
PackageManifest manifest = args[0] as PackageManifest;
|
||||
var operation = new DCFSClearUnusedBundleFilesOperation(this, manifest);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(params object[] args)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
{
|
||||
PackageBundle bundle = args[0] as PackageBundle;
|
||||
string localCopyFilePath = (string)args[1];
|
||||
int failedTryAgain = (int)args[2];
|
||||
int timeout = (int)args[3];
|
||||
|
||||
// 查询旧的下载器
|
||||
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
|
||||
{
|
||||
|
@ -165,23 +155,21 @@ namespace YooAsset
|
|||
|
||||
// 创建新的下载器
|
||||
{
|
||||
string mainURL;
|
||||
string fallbackURL;
|
||||
if (string.IsNullOrEmpty(localCopyFilePath))
|
||||
if (string.IsNullOrEmpty(param.ImportFilePath))
|
||||
{
|
||||
mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 注意:把本地文件路径指定为远端下载地址
|
||||
mainURL = DownloadSystemHelper.ConvertToWWWPath(localCopyFilePath);
|
||||
fallbackURL = mainURL;
|
||||
param.MainURL = DownloadSystemHelper.ConvertToWWWPath(param.ImportFilePath);
|
||||
param.FallbackURL = param.MainURL;
|
||||
}
|
||||
|
||||
if (bundle.FileSize >= ResumeDownloadMinimumSize)
|
||||
{
|
||||
var newDownloader = new DCFSDownloadResumeFileOperation(this, bundle, mainURL, fallbackURL, failedTryAgain, timeout);
|
||||
var newDownloader = new DCFSDownloadResumeFileOperation(this, bundle, param);
|
||||
newDownloader.Reference();
|
||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||
OperationSystem.StartOperation(PackageName, newDownloader);
|
||||
|
@ -189,7 +177,7 @@ namespace YooAsset
|
|||
}
|
||||
else
|
||||
{
|
||||
var newDownloader = new DCFSDownloadNormalFileOperation(this, bundle, mainURL, fallbackURL, failedTryAgain, timeout);
|
||||
var newDownloader = new DCFSDownloadNormalFileOperation(this, bundle, param);
|
||||
newDownloader.Reference();
|
||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||
OperationSystem.StartOperation(PackageName, newDownloader);
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace YooAsset
|
|||
{
|
||||
_allBundleGUIDs = _fileSystem.GetAllCachedBundleGUIDs();
|
||||
_fileTotalCount = _allBundleGUIDs.Count;
|
||||
YooLogger.Log($"Found all cache file count : {_fileTotalCount}");
|
||||
_steps = ESteps.ClearAllCacheFiles;
|
||||
YooLogger.Log($"Found all cache files count : {_fileTotalCount}");
|
||||
}
|
||||
|
||||
if (_steps == ESteps.ClearAllCacheFiles)
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace YooAsset
|
|||
|
||||
if (_steps == ESteps.GetUnusedCacheFiles)
|
||||
{
|
||||
_steps = ESteps.ClearUnusedCacheFiles;
|
||||
_unusedBundleGUIDs = GetUnusedBundleGUIDs();
|
||||
_unusedFileTotalCount = _unusedBundleGUIDs.Count;
|
||||
YooLogger.Log($"Found unused cache file count : {_unusedFileTotalCount}");
|
||||
_steps = ESteps.ClearUnusedCacheFiles;
|
||||
YooLogger.Log($"Found unused cache files count : {_unusedFileTotalCount}");
|
||||
}
|
||||
|
||||
if (_steps == ESteps.ClearUnusedCacheFiles)
|
||||
|
|
|
@ -11,9 +11,7 @@ namespace YooAsset
|
|||
private string _tempFilePath;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DCFSDownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle,
|
||||
string mainURL, string fallbackURL, int failedTryAgain, int timeout)
|
||||
: base(bundle, mainURL, fallbackURL, failedTryAgain, timeout)
|
||||
internal DCFSDownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
@ -110,7 +108,7 @@ namespace YooAsset
|
|||
}
|
||||
else
|
||||
{
|
||||
Error = $"{_fileSystem.GetType().FullName} write file failed !";
|
||||
Error = $"{_fileSystem.GetType().FullName} failed to write file !";
|
||||
Status = EOperationStatus.Failed;
|
||||
_steps = ESteps.Done;
|
||||
YooLogger.Error(Error);
|
||||
|
@ -198,19 +196,17 @@ namespace YooAsset
|
|||
private DownloadHandlerFileRange _downloadHandle;
|
||||
private VerifyTempFileOperation _verifyOperation;
|
||||
private long _fileOriginLength = 0;
|
||||
private string _fileSavePath;
|
||||
private string _tempFilePath;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal DCFSDownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle,
|
||||
string mainURL, string fallbackURL, int failedTryAgain, int timeout)
|
||||
: base(bundle, mainURL, fallbackURL, failedTryAgain, timeout)
|
||||
internal DCFSDownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_fileSavePath = _fileSystem.GetTempFilePath(Bundle);
|
||||
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
|
||||
_steps = ESteps.CheckExists;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
|
@ -235,7 +231,7 @@ namespace YooAsset
|
|||
// 创建下载器
|
||||
if (_steps == ESteps.CreateRequest)
|
||||
{
|
||||
FileUtility.CreateFileDirectory(_fileSavePath);
|
||||
FileUtility.CreateFileDirectory(_tempFilePath);
|
||||
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
|
@ -246,9 +242,9 @@ namespace YooAsset
|
|||
// 获取下载起始位置
|
||||
_fileOriginLength = 0;
|
||||
long fileBeginLength = -1;
|
||||
if (File.Exists(_fileSavePath))
|
||||
if (File.Exists(_tempFilePath))
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(_fileSavePath);
|
||||
FileInfo fileInfo = new FileInfo(_tempFilePath);
|
||||
fileBeginLength = fileInfo.Length;
|
||||
_fileOriginLength = fileBeginLength;
|
||||
DownloadedBytes = _fileOriginLength;
|
||||
|
@ -258,8 +254,8 @@ namespace YooAsset
|
|||
if (fileBeginLength >= Bundle.FileSize)
|
||||
{
|
||||
// 删除临时文件
|
||||
if (File.Exists(_fileSavePath))
|
||||
File.Delete(_fileSavePath);
|
||||
if (File.Exists(_tempFilePath))
|
||||
File.Delete(_tempFilePath);
|
||||
}
|
||||
|
||||
// 创建下载器
|
||||
|
@ -295,7 +291,7 @@ namespace YooAsset
|
|||
// 验证下载文件
|
||||
if (_steps == ESteps.VerifyTempFile)
|
||||
{
|
||||
var element = new TempFileElement(_fileSavePath, Bundle.FileCRC, Bundle.FileSize);
|
||||
var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize);
|
||||
_verifyOperation = new VerifyTempFileOperation(element);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _verifyOperation);
|
||||
_steps = ESteps.CheckVerifyTempFile;
|
||||
|
@ -309,14 +305,14 @@ namespace YooAsset
|
|||
|
||||
if (_verifyOperation.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
if (_fileSystem.WriteCacheFile(Bundle, _fileSavePath))
|
||||
if (_fileSystem.WriteCacheFile(Bundle, _tempFilePath))
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
_steps = ESteps.Done;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = $"{_fileSystem.GetType().FullName} write file failed : {_fileSavePath}";
|
||||
Error = $"{_fileSystem.GetType().FullName} failed to write file !";
|
||||
Status = EOperationStatus.Failed;
|
||||
_steps = ESteps.Done;
|
||||
}
|
||||
|
@ -328,8 +324,8 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
// 注意:验证完成后直接删除文件
|
||||
if (File.Exists(_fileSavePath))
|
||||
File.Delete(_fileSavePath);
|
||||
if (File.Exists(_tempFilePath))
|
||||
File.Delete(_tempFilePath);
|
||||
}
|
||||
|
||||
// 重新尝试下载
|
||||
|
@ -381,7 +377,7 @@ namespace YooAsset
|
|||
{
|
||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||
#if UNITY_2019_4_OR_NEWER
|
||||
var handler = new DownloadHandlerFile(_fileSavePath, true);
|
||||
var handler = new DownloadHandlerFile(_tempFilePath, true);
|
||||
handler.removeFileOnAbort = false;
|
||||
#else
|
||||
var handler = new DownloadHandlerFileRange(FileSavePath, Bundle.FileSize, _webRequest);
|
||||
|
@ -416,8 +412,8 @@ namespace YooAsset
|
|||
//说明:如果遇到以下错误返回码,验证失败直接删除文件
|
||||
if (_fileSystem.ResumeDownloadResponseCodes.Contains(HttpCode))
|
||||
{
|
||||
if (File.Exists(_fileSavePath))
|
||||
File.Delete(_fileSavePath);
|
||||
if (File.Exists(_tempFilePath))
|
||||
File.Delete(_tempFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DCFSInitializeOperation : FSInitializeFileSystemOperation
|
||||
|
@ -43,7 +41,7 @@ namespace YooAsset
|
|||
{
|
||||
_fileSytem.DeleteAllManifestFiles();
|
||||
appFootPrint.Coverage(_fileSytem.PackageName);
|
||||
YooLogger.Log("Delete manifest files when application foot print dirty !");
|
||||
YooLogger.Warning("Delete manifest files when application foot print dirty !");
|
||||
}
|
||||
|
||||
_steps = ESteps.SearchCacheFiles;
|
||||
|
@ -76,12 +74,19 @@ namespace YooAsset
|
|||
if (_verifyCacheFilesOp.IsDone == false)
|
||||
return;
|
||||
|
||||
// 注意:总是返回成功
|
||||
if (_verifyCacheFilesOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
|
||||
YooLogger.Log($"Package '{_fileSytem.PackageName}' cached files count : {_fileSytem.FileCount}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _verifyCacheFilesOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,21 +5,22 @@ namespace YooAsset
|
|||
{
|
||||
internal class DCFSLoadAssetBundleOperation : FSLoadBundleOperation
|
||||
{
|
||||
private enum ESteps
|
||||
protected enum ESteps
|
||||
{
|
||||
None,
|
||||
CheckExist,
|
||||
DownloadFile,
|
||||
LoadAssetBundle,
|
||||
CheckResult,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly DefaultCacheFileSystem _fileSystem;
|
||||
private readonly PackageBundle _bundle;
|
||||
private FSDownloadFileOperation _downloadFileOp;
|
||||
private AssetBundleCreateRequest _createRequest;
|
||||
private bool _isWaitForAsyncComplete = false;
|
||||
private ESteps _steps = ESteps.None;
|
||||
protected readonly DefaultCacheFileSystem _fileSystem;
|
||||
protected readonly PackageBundle _bundle;
|
||||
protected FSDownloadFileOperation _downloadFileOp;
|
||||
protected AssetBundleCreateRequest _createRequest;
|
||||
protected bool _isWaitForAsyncComplete = false;
|
||||
protected ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal DCFSLoadAssetBundleOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle)
|
||||
|
@ -29,29 +30,33 @@ namespace YooAsset
|
|||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
if (_fileSystem.NeedDownload(_bundle))
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
_steps = ESteps.LoadAssetBundle;
|
||||
}
|
||||
_steps = ESteps.CheckExist;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.CheckExist)
|
||||
{
|
||||
if (_fileSystem.Exists(_bundle))
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
_steps = ESteps.LoadAssetBundle;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
if (_downloadFileOp == null)
|
||||
{
|
||||
int failedTryAgain = int.MaxValue;
|
||||
int timeout = 60;
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, null, failedTryAgain, timeout);
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||
}
|
||||
|
||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||
|
@ -112,8 +117,8 @@ namespace YooAsset
|
|||
{
|
||||
// 注意:当缓存文件的校验等级为Low的时候,并不能保证缓存文件的完整性。
|
||||
// 说明:在AssetBundle文件加载失败的情况下,我们需要重新验证文件的完整性!
|
||||
EFileVerifyResult result = _fileSystem.VerifyCacheFile(_bundle);
|
||||
if (result == EFileVerifyResult.Succeed)
|
||||
EFileVerifyResult verifyResult = _fileSystem.VerifyCacheFile(_bundle);
|
||||
if (verifyResult == EFileVerifyResult.Succeed)
|
||||
{
|
||||
// 注意:在安卓移动平台,华为和三星真机上有极小概率加载资源包失败。
|
||||
// 说明:大多数情况在首次安装下载资源到沙盒内,游戏过程中切换到后台再回到游戏内有很大概率触发!
|
||||
|
@ -193,19 +198,20 @@ namespace YooAsset
|
|||
|
||||
internal class DCFSLoadRawBundleOperation : FSLoadBundleOperation
|
||||
{
|
||||
private enum ESteps
|
||||
protected enum ESteps
|
||||
{
|
||||
None,
|
||||
CheckExist,
|
||||
DownloadFile,
|
||||
LoadRawBundle,
|
||||
CheckResult,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly DefaultCacheFileSystem _fileSystem;
|
||||
private readonly PackageBundle _bundle;
|
||||
private FSDownloadFileOperation _downloadFileOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
protected readonly DefaultCacheFileSystem _fileSystem;
|
||||
protected readonly PackageBundle _bundle;
|
||||
protected FSDownloadFileOperation _downloadFileOp;
|
||||
protected ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal DCFSLoadRawBundleOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle)
|
||||
|
@ -215,29 +221,33 @@ namespace YooAsset
|
|||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
if (_fileSystem.NeedDownload(_bundle))
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
_steps = ESteps.LoadRawBundle;
|
||||
}
|
||||
_steps = ESteps.CheckExist;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.CheckExist)
|
||||
{
|
||||
if (_fileSystem.Exists(_bundle))
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
_steps = ESteps.LoadRawBundle;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
if (_downloadFileOp == null)
|
||||
{
|
||||
int failedTryAgain = int.MaxValue;
|
||||
int timeout = 60;
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, null, failedTryAgain, timeout);
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||
}
|
||||
|
||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||
|
@ -278,14 +288,14 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Can not found raw bundle file : {filePath}";
|
||||
Error = $"Can not found cache raw bundle file : {filePath}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed load raw bundle file : {_bundle.BundleName}";
|
||||
Error = $"Failed to load cache raw bundle file : {_bundle.BundleName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace YooAsset
|
|||
if (_loadCachePackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadCachePackageManifestOp.Manifest;
|
||||
Manifest = _loadCachePackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
@ -144,7 +144,6 @@ namespace YooAsset
|
|||
string manifestFilePath = _fileSystem.GetCachePackageManifestFilePath(_packageVersion);
|
||||
if (File.Exists(manifestFilePath))
|
||||
{
|
||||
YooLogger.Warning($"Failed to load cache manifest file : {Error}");
|
||||
YooLogger.Warning($"Invalid cache manifest file have been removed : {manifestFilePath}");
|
||||
File.Delete(manifestFilePath);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace YooAsset
|
|||
private readonly DefaultCacheFileSystem _fileSystem;
|
||||
private readonly bool _appendTimeTicks;
|
||||
private readonly int _timeout;
|
||||
private DefaultGetRemotePackageVersionOperation _getRemotePackageVersionOp;
|
||||
private RequestRemotePackageVersionOperation _requestRemotePackageVersionOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
|
@ -34,31 +34,27 @@ namespace YooAsset
|
|||
|
||||
if (_steps == ESteps.GetPackageVersion)
|
||||
{
|
||||
if (_getRemotePackageVersionOp == null)
|
||||
if (_requestRemotePackageVersionOp == null)
|
||||
{
|
||||
string packageName = _fileSystem.PackageName;
|
||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
||||
string mainURL = _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
||||
string fallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
||||
_getRemotePackageVersionOp = new DefaultGetRemotePackageVersionOperation(packageName, mainURL, fallbackURL, _appendTimeTicks, _timeout);
|
||||
OperationSystem.StartOperation(packageName, _getRemotePackageVersionOp);
|
||||
_requestRemotePackageVersionOp = new RequestRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestRemotePackageVersionOp);
|
||||
}
|
||||
|
||||
Progress = _getRemotePackageVersionOp.Progress;
|
||||
if (_getRemotePackageVersionOp.IsDone == false)
|
||||
Progress = _requestRemotePackageVersionOp.Progress;
|
||||
if (_requestRemotePackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_getRemotePackageVersionOp.Status == EOperationStatus.Succeed)
|
||||
if (_requestRemotePackageVersionOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
PackageVersion = _getRemotePackageVersionOp.PackageVersion;
|
||||
PackageVersion = _requestRemotePackageVersionOp.PackageVersion;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _getRemotePackageVersionOp.Error;
|
||||
Error = _requestRemotePackageVersionOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace YooAsset
|
|||
string savePath = _fileSystem.GetCachePackageHashFilePath(_packageVersion);
|
||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string webURL = GetWebRequestURL(fileName);
|
||||
YooLogger.Log($"Beginning to download package hash file : {webURL}");
|
||||
_webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webFileRequestOp);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace YooAsset
|
|||
string savePath = _fileSystem.GetCachePackageManifestFilePath(_packageVersion);
|
||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string webURL = GetDownloadRequestURL(fileName);
|
||||
YooLogger.Log($"Beginning to download package manifest file : {webURL}");
|
||||
_webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webFileRequestOp);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Cache package hash file not found : {filePath}";
|
||||
Error = $"Can not found cache package hash file : {filePath}";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 加载的清单实例
|
||||
/// 包裹清单
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Cache manifest file not found : {manifestFilePath}";
|
||||
Error = $"Can not found cache manifest file : {manifestFilePath}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DefaultGetRemotePackageVersionOperation : AsyncOperationBase
|
||||
internal class RequestRemotePackageVersionOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -10,9 +10,7 @@ namespace YooAsset
|
|||
Done,
|
||||
}
|
||||
|
||||
private readonly string _packageName;
|
||||
private readonly string _mainURL;
|
||||
private readonly string _fallbackURL;
|
||||
private readonly DefaultCacheFileSystem _fileSystem;
|
||||
private readonly bool _appendTimeTicks;
|
||||
private readonly int _timeout;
|
||||
private UnityWebTextRequestOperation _webTextRequestOp;
|
||||
|
@ -20,22 +18,20 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 查询的远端版本信息
|
||||
/// 包裹版本
|
||||
/// </summary>
|
||||
internal string PackageVersion { set; get; }
|
||||
|
||||
|
||||
internal DefaultGetRemotePackageVersionOperation(string packageName, string mainURL, string fallbackURL, bool appendTimeTicks, int timeout)
|
||||
internal RequestRemotePackageVersionOperation(DefaultCacheFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||
{
|
||||
_packageName = packageName;
|
||||
_mainURL = mainURL;
|
||||
_fallbackURL = fallbackURL;
|
||||
_fileSystem = fileSystem;
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_packageName, nameof(DefaultGetRemotePackageVersionOperation));
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestRemotePackageVersionOperation));
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
|
@ -47,24 +43,17 @@ namespace YooAsset
|
|||
{
|
||||
if (_webTextRequestOp == null)
|
||||
{
|
||||
string url = GetPackageVersionRequestURL();
|
||||
YooLogger.Log($"Beginning to request package version : {url}");
|
||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
|
||||
string url = GetWebRequestURL(fileName);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_packageName, _webTextRequestOp);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
}
|
||||
|
||||
Progress = _webTextRequestOp.Progress;
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_webTextRequestOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
WebRequestCounter.RecordRequestFailed(_packageName, nameof(DefaultGetRemotePackageVersionOperation));
|
||||
}
|
||||
else
|
||||
if (_webTextRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
PackageVersion = _webTextRequestOp.Result;
|
||||
if (string.IsNullOrEmpty(PackageVersion))
|
||||
|
@ -79,18 +68,25 @@ namespace YooAsset
|
|||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
WebRequestCounter.RecordRequestFailed(_fileSystem.PackageName, nameof(RequestRemotePackageVersionOperation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPackageVersionRequestURL()
|
||||
private string GetWebRequestURL(string fileName)
|
||||
{
|
||||
string url;
|
||||
|
||||
// 轮流返回请求地址
|
||||
if (_requestCount % 2 == 0)
|
||||
url = _mainURL;
|
||||
url = _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
||||
else
|
||||
url = _fallbackURL;
|
||||
url = _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
||||
|
||||
// 在URL末尾添加时间戳
|
||||
if (_appendTimeTicks)
|
|
@ -56,7 +56,6 @@ namespace YooAsset
|
|||
if (SearchFiles())
|
||||
return;
|
||||
|
||||
// 注意:总是返回成功
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyStartTime;
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace YooAsset
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
YooLogger.Warning($"Failed delete cache bundle folder : {e}");
|
||||
YooLogger.Warning($"Failed to delete cache bundle folder : {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ namespace YooAsset
|
|||
{
|
||||
_failedCount++;
|
||||
|
||||
YooLogger.Warning($"Failed verify file {element.Result} and delete files : {element.FileRootPath}");
|
||||
YooLogger.Warning($"Failed to verify file {element.Result} and delete files : {element.FileRootPath}");
|
||||
element.DeleteFiles();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed verify file : {_element.TempFilePath} ! ErrorCode : {VerifyResult}";
|
||||
Error = $"Failed to verify file : {_element.TempFilePath} ! ErrorCode : {VerifyResult}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,31 +63,31 @@ namespace YooAsset
|
|||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(params object[] args)
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DEFSLoadPackageManifestOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(params object[] args)
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DEFSRequestPackageVersionOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new FSClearAllBundleFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(PackageManifest manifest)
|
||||
{
|
||||
var operation = new FSClearUnusedBundleFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(params object[] args)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace YooAsset
|
|||
if (_loadEditorPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadEditorPackageManifestOp.Manifest;
|
||||
Manifest = _loadEditorPackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace YooAsset
|
|||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
GetPackageVersion,
|
||||
LoadPackageVersion,
|
||||
Done,
|
||||
}
|
||||
|
||||
|
@ -21,14 +21,14 @@ namespace YooAsset
|
|||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.GetPackageVersion;
|
||||
_steps = ESteps.LoadPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.GetPackageVersion)
|
||||
if (_steps == ESteps.LoadPackageVersion)
|
||||
{
|
||||
if (_loadEditorPackageVersionOp == null)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 加载的清单实例
|
||||
/// 包裹清单
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Simulation package manifest file not found : {manifestFilePath}";
|
||||
Error = $"Can not found simulation package manifest file : {manifestFilePath}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace YooAsset
|
|||
private readonly DefaultEditorFileSystem _fileSystem;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 包裹版本
|
||||
/// </summary>
|
||||
public string PackageVersion { private set; get; }
|
||||
|
||||
|
||||
|
@ -43,7 +46,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Simulation package version file not found : {versionFilePath}";
|
||||
Error = $"Can not found simulation package version file : {versionFilePath}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存文件系统
|
||||
/// 解压文件系统
|
||||
/// </summary>
|
||||
internal class DefaultUnpackFileSystem : DefaultCacheFileSystem
|
||||
{
|
||||
|
@ -17,5 +17,20 @@ namespace YooAsset
|
|||
_saveFileRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveFilesFolderName);
|
||||
_tempFileRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.TempFilesFolderName);
|
||||
}
|
||||
public override FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
{
|
||||
if (RawFileBuildPipeline)
|
||||
{
|
||||
var operation = new DUFSLoadRawBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
var operation = new DUFSLoadAssetBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 59b123e460757694180175970bf28826
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DUFSLoadAssetBundleOperation : DCFSLoadAssetBundleOperation
|
||||
{
|
||||
public DUFSLoadAssetBundleOperation(DefaultUnpackFileSystem fileSystem, PackageBundle bundle) : base(fileSystem, bundle)
|
||||
{
|
||||
}
|
||||
public override void WaitForAsyncComplete()
|
||||
{
|
||||
_isWaitForAsyncComplete = true;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// 文件解压
|
||||
if (_downloadFileOp != null)
|
||||
{
|
||||
if (_downloadFileOp.IsDone == false)
|
||||
_downloadFileOp.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
// 驱动流程
|
||||
InternalOnUpdate();
|
||||
|
||||
// 完成后退出
|
||||
if (IsDone)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DUFSLoadRawBundleOperation : DCFSLoadRawBundleOperation
|
||||
{
|
||||
public DUFSLoadRawBundleOperation(DefaultUnpackFileSystem fileSystem, PackageBundle bundle) : base(fileSystem, bundle)
|
||||
{
|
||||
}
|
||||
public override void WaitForAsyncComplete()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
// 文件解压
|
||||
if (_downloadFileOp != null)
|
||||
{
|
||||
if (_downloadFileOp.IsDone == false)
|
||||
_downloadFileOp.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
// 驱动流程
|
||||
InternalOnUpdate();
|
||||
|
||||
// 完成后退出
|
||||
if (IsDone)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3f8269507a575884f935f9fbc71396ea
|
||||
guid: 47f6fe3a815d28e49815db7c09c1fa76
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
|
@ -63,20 +63,10 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
#region 自定义参数
|
||||
/// <summary>
|
||||
/// 自定义参数:远程服务接口
|
||||
/// </summary>
|
||||
public IRemoteServices RemoteServices { private set; get; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// 禁用Unity的网络缓存
|
||||
/// </summary>
|
||||
public bool DisableUnityWebCache { private set; get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 允许跨域访问和下载
|
||||
/// </summary>
|
||||
public bool AllowCrossAccess { private set; get; } = false;
|
||||
#endregion
|
||||
|
||||
|
||||
|
@ -89,45 +79,31 @@ namespace YooAsset
|
|||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(params object[] args)
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
string packageVersion = args[0] as string;
|
||||
int timeout = (int)args[1];
|
||||
|
||||
if (AllowCrossAccess)
|
||||
{
|
||||
var operation = new DWFSLoadRemotePackageManifestOperation(this, packageVersion, timeout);
|
||||
var operation = new DWFSLoadPackageManifestOperation(this, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DWFSLoadWebPackageManifestOperation(this, timeout);
|
||||
var operation = new DWFSRequestPackageVersionOperation(this, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(params object[] args)
|
||||
{
|
||||
bool appendTimeTicks = (bool)args[0];
|
||||
int timeout = (int)args[1];
|
||||
var operation = new DWFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new FSClearAllBundleFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(params object[] args)
|
||||
public virtual FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(PackageManifest manifest)
|
||||
{
|
||||
var operation = new FSClearUnusedBundleFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(params object[] args)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
@ -149,18 +125,10 @@ namespace YooAsset
|
|||
|
||||
public virtual void SetParameter(string name, object value)
|
||||
{
|
||||
if (name == "REMOTE_SERVICES")
|
||||
{
|
||||
RemoteServices = (IRemoteServices)value;
|
||||
}
|
||||
else if (name == "DISABLE_UNITY_WEB_CACHE")
|
||||
if (name == "DISABLE_UNITY_WEB_CACHE")
|
||||
{
|
||||
DisableUnityWebCache = (bool)value;
|
||||
}
|
||||
else if (name == "ALLOW_CROSS_ACCESS")
|
||||
{
|
||||
AllowCrossAccess = (bool)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
YooLogger.Warning($"Invalid parameter : {name}");
|
||||
|
@ -189,10 +157,7 @@ namespace YooAsset
|
|||
}
|
||||
public virtual bool NeedDownload(PackageBundle bundle)
|
||||
{
|
||||
if (Belong(bundle) == false)
|
||||
return false;
|
||||
|
||||
return Exists(bundle) == false;
|
||||
}
|
||||
public virtual bool NeedUnpack(PackageBundle bundle)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal partial class DWFSInitializeOperation : FSInitializeFileSystemOperation
|
||||
internal class DWFSInitializeOperation : FSInitializeFileSystemOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -39,11 +39,18 @@ namespace YooAsset
|
|||
if (_loadCatalogFileOp.IsDone == false)
|
||||
return;
|
||||
|
||||
// 说明:应用程序内不一定存在序列化文件
|
||||
// 注意:总是返回成功
|
||||
if (_loadCatalogFileOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _loadCatalogFileOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,22 +34,11 @@ namespace YooAsset
|
|||
{
|
||||
if (_downloadhanlderAssetBundleOp == null)
|
||||
{
|
||||
int failedTryAgain = int.MaxValue;
|
||||
int timeout = 60;
|
||||
string mainURL;
|
||||
string fallbackURL;
|
||||
if (_fileSystem.AllowCrossAccess)
|
||||
{
|
||||
mainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
|
||||
fallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
string fileLoadPath = _fileSystem.GetWebFileLoadPath(_bundle);
|
||||
mainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
|
||||
fallbackURL = mainURL;
|
||||
}
|
||||
_downloadhanlderAssetBundleOp = new DownloadHandlerAssetBundleOperation(_fileSystem, _bundle, mainURL, fallbackURL, failedTryAgain, timeout);
|
||||
downloadParam.MainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
|
||||
downloadParam.FallbackURL = downloadParam.MainURL;
|
||||
_downloadhanlderAssetBundleOp = new DownloadHandlerAssetBundleOperation(_fileSystem, _bundle, downloadParam);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadhanlderAssetBundleOp);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DWFSLoadWebPackageManifestOperation : FSLoadPackageManifestOperation
|
||||
internal class DWFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
public DWFSLoadWebPackageManifestOperation(DefaultWebFileSystem fileSystem, int timeout)
|
||||
public DWFSLoadPackageManifestOperation(DefaultWebFileSystem fileSystem, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_timeout = timeout;
|
||||
|
@ -98,7 +98,7 @@ namespace YooAsset
|
|||
if (_loadWebPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadWebPackageManifestOp.Manifest;
|
||||
Manifest = _loadWebPackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
@ -110,89 +110,4 @@ namespace YooAsset
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DWFSLoadRemotePackageManifestOperation : FSLoadPackageManifestOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
RequestRemotePackageHash,
|
||||
LoadRemotePackageManifest,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly DefaultWebFileSystem _fileSystem;
|
||||
private readonly string _packageVersion;
|
||||
private readonly int _timeout;
|
||||
private RequestRemotePackageHashOperation _requestRemotePackageHashOp;
|
||||
private LoadRemotePackageManifestOperation _loadRemotePackageManifestOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
public DWFSLoadRemotePackageManifestOperation(DefaultWebFileSystem fileSystem, string packageVersion, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.RequestRemotePackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.RequestRemotePackageHash)
|
||||
{
|
||||
if (_requestRemotePackageHashOp == null)
|
||||
{
|
||||
_requestRemotePackageHashOp = new RequestRemotePackageHashOperation(_fileSystem, _packageVersion, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestRemotePackageHashOp);
|
||||
}
|
||||
|
||||
if (_requestRemotePackageHashOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_requestRemotePackageHashOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.LoadRemotePackageManifest;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _requestRemotePackageHashOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadRemotePackageManifest)
|
||||
{
|
||||
if (_loadRemotePackageManifestOp == null)
|
||||
{
|
||||
string packageHash = _requestRemotePackageHashOp.PackageHash;
|
||||
_loadRemotePackageManifestOp = new LoadRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadRemotePackageManifestOp);
|
||||
}
|
||||
|
||||
Progress = _loadRemotePackageManifestOp.Progress;
|
||||
if (_loadRemotePackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_loadRemotePackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _loadRemotePackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _loadRemotePackageManifestOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,70 +6,53 @@ namespace YooAsset
|
|||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
GetPackageVersion,
|
||||
RequestPackageVersion,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly DefaultWebFileSystem _fileSystem;
|
||||
private readonly bool _appendTimeTicks;
|
||||
private readonly int _timeout;
|
||||
private DefaultGetRemotePackageVersionOperation _getRemotePackageVersionOp;
|
||||
private RequestWebPackageVersionOperation _requestWebPackageVersionOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal DWFSRequestPackageVersionOperation(DefaultWebFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||
internal DWFSRequestPackageVersionOperation(DefaultWebFileSystem fileSystem, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.GetPackageVersion;
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.GetPackageVersion)
|
||||
if (_steps == ESteps.RequestPackageVersion)
|
||||
{
|
||||
if (_getRemotePackageVersionOp == null)
|
||||
if (_requestWebPackageVersionOp == null)
|
||||
{
|
||||
string packageName = _fileSystem.PackageName;
|
||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
||||
string mainURL;
|
||||
string fallbackURL;
|
||||
if (_fileSystem.AllowCrossAccess)
|
||||
{
|
||||
mainURL = _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
||||
fallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
string filePath = _fileSystem.GetWebPackageVersionFilePath();
|
||||
mainURL = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
fallbackURL = mainURL;
|
||||
}
|
||||
_getRemotePackageVersionOp = new DefaultGetRemotePackageVersionOperation(packageName, mainURL, fallbackURL, _appendTimeTicks, _timeout);
|
||||
OperationSystem.StartOperation(packageName, _getRemotePackageVersionOp);
|
||||
_requestWebPackageVersionOp = new RequestWebPackageVersionOperation(_fileSystem, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageVersionOp);
|
||||
}
|
||||
|
||||
Progress = _getRemotePackageVersionOp.Progress;
|
||||
if (_getRemotePackageVersionOp.IsDone == false)
|
||||
Progress = _requestWebPackageVersionOp.Progress;
|
||||
if (_requestWebPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_getRemotePackageVersionOp.Status == EOperationStatus.Succeed)
|
||||
if (_requestWebPackageVersionOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
PackageVersion = _getRemotePackageVersionOp.PackageVersion;
|
||||
PackageVersion = _requestWebPackageVersionOp.PackageVersion;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _getRemotePackageVersionOp.Error;
|
||||
Error = _requestWebPackageVersionOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ namespace YooAsset
|
|||
public AssetBundle Result { private set; get; }
|
||||
|
||||
|
||||
internal DownloadHandlerAssetBundleOperation(DefaultWebFileSystem fileSystem, PackageBundle bundle,
|
||||
string mainURL, string fallbackURL, int failedTryAgain, int timeout)
|
||||
: base(bundle, mainURL, fallbackURL, failedTryAgain, timeout)
|
||||
internal DownloadHandlerAssetBundleOperation(DefaultWebFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class LoadRemotePackageManifestOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
RequestFileData,
|
||||
VerifyFileData,
|
||||
LoadManifest,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly DefaultWebFileSystem _fileSystem;
|
||||
private readonly string _packageVersion;
|
||||
private readonly string _packageHash;
|
||||
private readonly int _timeout;
|
||||
private UnityWebDataRequestOperation _webDataRequestOp;
|
||||
private DeserializeManifestOperation _deserializer;
|
||||
private int _requestCount = 0;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 加载的清单实例
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
|
||||
|
||||
internal LoadRemotePackageManifestOperation(DefaultWebFileSystem fileSystem, string packageVersion, string packageHash, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
_packageHash = packageHash;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(LoadRemotePackageManifestOperation));
|
||||
_steps = ESteps.RequestFileData;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.RequestFileData)
|
||||
{
|
||||
if (_webDataRequestOp == null)
|
||||
{
|
||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string url = GetDownloadRequestURL(fileName);
|
||||
_webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
|
||||
}
|
||||
|
||||
Progress = _webDataRequestOp.Progress;
|
||||
if (_webDataRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_webDataRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.VerifyFileData;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webDataRequestOp.Error;
|
||||
WebRequestCounter.RecordRequestFailed(_fileSystem.PackageName, nameof(LoadRemotePackageManifestOperation));
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.VerifyFileData)
|
||||
{
|
||||
string fileHash = HashUtility.BytesMD5(_webDataRequestOp.Result);
|
||||
if (fileHash == _packageHash)
|
||||
{
|
||||
_steps = ESteps.LoadManifest;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to verify remote package manifest file!";
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadManifest)
|
||||
{
|
||||
if (_deserializer == null)
|
||||
{
|
||||
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
|
||||
}
|
||||
|
||||
Progress = _deserializer.Progress;
|
||||
if (_deserializer.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_deserializer.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Manifest = _deserializer.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _deserializer.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetDownloadRequestURL(string fileName)
|
||||
{
|
||||
// 轮流返回请求地址
|
||||
if (_requestCount % 2 == 0)
|
||||
return _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
||||
else
|
||||
return _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed to load catalog file : {catalogFilePath}";
|
||||
Error = $"Failed to load web catalog file : {catalogFilePath}";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
||||
Error = $"Web catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,11 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 加载的清单实例
|
||||
/// 包裹清单
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
|
||||
|
||||
internal LoadWebPackageManifestOperation(DefaultWebFileSystem fileSystem, string packageVersion, string packageHash)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class RequestRemotePackageHashOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
RequestPackageHash,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly DefaultWebFileSystem _fileSystem;
|
||||
private readonly string _packageVersion;
|
||||
private readonly int _timeout;
|
||||
private UnityWebTextRequestOperation _webTextRequestOp;
|
||||
private int _requestCount = 0;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
/// <summary>
|
||||
/// 包裹哈希值
|
||||
/// </summary>
|
||||
public string PackageHash { private set; get; }
|
||||
|
||||
|
||||
public RequestRemotePackageHashOperation(DefaultWebFileSystem fileSystem, string packageVersion, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestRemotePackageHashOperation));
|
||||
_steps = ESteps.RequestPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.RequestPackageHash)
|
||||
{
|
||||
if (_webTextRequestOp == null)
|
||||
{
|
||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string url = GetDownloadRequestURL(fileName);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
}
|
||||
|
||||
Progress = _webTextRequestOp.Progress;
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_webTextRequestOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
WebRequestCounter.RecordRequestFailed(_fileSystem.PackageName, nameof(RequestRemotePackageHashOperation));
|
||||
}
|
||||
else
|
||||
{
|
||||
PackageHash = _webTextRequestOp.Result;
|
||||
if (string.IsNullOrEmpty(PackageHash))
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Remote package hash file content is empty !";
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetDownloadRequestURL(string fileName)
|
||||
{
|
||||
// 轮流返回请求地址
|
||||
if (_requestCount % 2 == 0)
|
||||
return _fileSystem.RemoteServices.GetRemoteMainURL(fileName);
|
||||
else
|
||||
return _fileSystem.RemoteServices.GetRemoteFallbackURL(fileName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,13 +51,7 @@ namespace YooAsset
|
|||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_webTextRequestOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
}
|
||||
else
|
||||
if (_webTextRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
PackageHash = _webTextRequestOp.Result;
|
||||
if (string.IsNullOrEmpty(PackageHash))
|
||||
|
@ -72,6 +66,12 @@ namespace YooAsset
|
|||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,13 +48,7 @@ namespace YooAsset
|
|||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_webTextRequestOp.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
}
|
||||
else
|
||||
if (_webTextRequestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
PackageVersion = _webTextRequestOp.Result;
|
||||
if (string.IsNullOrEmpty(PackageVersion))
|
||||
|
@ -69,6 +63,12 @@ namespace YooAsset
|
|||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _webTextRequestOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,27 +32,27 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 加载包裹清单
|
||||
/// </summary>
|
||||
FSLoadPackageManifestOperation LoadPackageManifestAsync(params object[] args);
|
||||
FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout);
|
||||
|
||||
/// <summary>
|
||||
/// 查询最新的版本
|
||||
/// </summary>
|
||||
FSRequestPackageVersionOperation RequestPackageVersionAsync(params object[] args);
|
||||
FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout);
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有的文件
|
||||
/// </summary>
|
||||
FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args);
|
||||
FSClearAllBundleFilesOperation ClearAllBundleFilesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 清空未使用的文件
|
||||
/// </summary>
|
||||
FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(params object[] args);
|
||||
FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(PackageManifest manifest);
|
||||
|
||||
/// <summary>
|
||||
/// 下载远端文件
|
||||
/// </summary>
|
||||
FSDownloadFileOperation DownloadFileAsync(params object[] args);
|
||||
FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param);
|
||||
|
||||
/// <summary>
|
||||
/// 加载Bundle文件
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace YooAsset
|
|||
internal abstract class FSLoadPackageManifestOperation : AsyncOperationBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载结果
|
||||
/// 资源清单
|
||||
/// </summary>
|
||||
internal PackageManifest Result { set; get; }
|
||||
internal PackageManifest Manifest { set; get; }
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace YooAsset
|
|||
internal abstract class FSRequestPackageVersionOperation : AsyncOperationBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询的最新版本信息
|
||||
/// 资源版本
|
||||
/// </summary>
|
||||
internal string PackageVersion { set; get; }
|
||||
}
|
||||
|
|
|
@ -17,11 +17,8 @@ namespace YooAsset
|
|||
Done,
|
||||
}
|
||||
|
||||
// 初始参数
|
||||
protected readonly string _mainURL;
|
||||
protected readonly string _fallbackURL;
|
||||
protected readonly int _failedTryAgain;
|
||||
protected readonly int _timeout;
|
||||
// 下载参数
|
||||
protected readonly DownloadParam Param;
|
||||
|
||||
// 请求相关
|
||||
protected UnityWebRequest _webRequest;
|
||||
|
@ -38,15 +35,10 @@ namespace YooAsset
|
|||
protected int FailedTryAgain;
|
||||
|
||||
|
||||
internal DefaultDownloadFileOperation(PackageBundle bundle,
|
||||
string mainURL, string fallbackURL, int failedTryAgain, int timeout) : base(bundle)
|
||||
internal DefaultDownloadFileOperation(PackageBundle bundle, DownloadParam param) : base(bundle)
|
||||
{
|
||||
_mainURL = mainURL;
|
||||
_fallbackURL = fallbackURL;
|
||||
_failedTryAgain = failedTryAgain;
|
||||
_timeout = timeout;
|
||||
|
||||
FailedTryAgain = failedTryAgain;
|
||||
Param = param;
|
||||
FailedTryAgain = param.FailedTryAgain;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -57,9 +49,9 @@ namespace YooAsset
|
|||
// 轮流返回请求地址
|
||||
_requestCount++;
|
||||
if (_requestCount % 2 == 0)
|
||||
return _fallbackURL;
|
||||
return Param.FallbackURL;
|
||||
else
|
||||
return _mainURL;
|
||||
return Param.MainURL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -95,7 +87,7 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
float offset = UnityEngine.Time.realtimeSinceStartup - _latestDownloadRealtime;
|
||||
if (offset > _timeout)
|
||||
if (offset > Param.Timeout)
|
||||
{
|
||||
YooLogger.Warning($"Web file request timeout : {_requestURL}");
|
||||
if (_webRequest != null)
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace YooAsset
|
|||
|
||||
/// <summary>
|
||||
/// 创建默认的编辑器文件系统参数
|
||||
/// <param name="SimulateBuildResult">模拟构建结果</param>
|
||||
/// <param name="simulateBuildResult">模拟构建结果</param>
|
||||
/// </summary>
|
||||
public static FileSystemParameters CreateDefaultEditorFileSystemParameters(SimulateBuildResult simulateBuildResult)
|
||||
{
|
||||
|
@ -160,26 +160,12 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 创建默认的Web文件系统参数
|
||||
/// </summary>
|
||||
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
||||
public static FileSystemParameters CreateDefaultWebFileSystemParameters(bool disableUnityWebCache = false)
|
||||
{
|
||||
string fileSystemClass = typeof(DefaultWebFileSystem).FullName;
|
||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
|
||||
fileSystemParams.AddParameter("DISABLE_UNITY_WEB_CACHE", disableUnityWebCache);
|
||||
fileSystemParams.AddParameter("ALLOW_CROSS_ACCESS", false);
|
||||
return fileSystemParams;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建默认的Web文件系统参数
|
||||
/// </summary>
|
||||
/// <param name="remoteServices">远端资源地址查询服务类</param>
|
||||
public static FileSystemParameters CreateDefaultWebFileSystemParameters(IRemoteServices remoteServices, bool disableUnityWebCache = false)
|
||||
{
|
||||
string fileSystemClass = typeof(DefaultWebFileSystem).FullName;
|
||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
|
||||
fileSystemParams.AddParameter("REMOTE_SERVICES", remoteServices);
|
||||
fileSystemParams.AddParameter("DISABLE_UNITY_WEB_CACHE", disableUnityWebCache);
|
||||
fileSystemParams.AddParameter("ALLOW_CROSS_ACCESS", true);
|
||||
return fileSystemParams;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class BundleInfo
|
||||
|
@ -54,7 +51,9 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public FSDownloadFileOperation CreateDownloader(int failedTryAgain, int timeout)
|
||||
{
|
||||
return _fileSystem.DownloadFileAsync(Bundle, _importFilePath, failedTryAgain, timeout);
|
||||
DownloadParam downloadParam = new DownloadParam(failedTryAgain, timeout);
|
||||
downloadParam.ImportFilePath = _importFilePath;
|
||||
return _fileSystem.DownloadFileAsync(Bundle, downloadParam);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -7,11 +7,7 @@ namespace YooAsset
|
|||
public abstract class ClearAllBundleFilesOperation : AsyncOperationBase
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用类
|
||||
/// </summary>
|
||||
internal sealed class DefaultClearAllBundleFilesOperation : ClearAllBundleFilesOperation
|
||||
internal sealed class ClearAllBundleFilesImplOperation : ClearAllBundleFilesOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -31,7 +27,7 @@ namespace YooAsset
|
|||
private FSClearAllBundleFilesOperation _clearAllBundleFilesOpC;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DefaultClearAllBundleFilesOperation(IPlayMode impl, IFileSystem fileSystemA, IFileSystem fileSystemB, IFileSystem fileSystemC)
|
||||
internal ClearAllBundleFilesImplOperation(IPlayMode impl, IFileSystem fileSystemA, IFileSystem fileSystemB, IFileSystem fileSystemC)
|
||||
{
|
||||
_impl = impl;
|
||||
_fileSystemA = fileSystemA;
|
||||
|
|
|
@ -7,11 +7,7 @@ namespace YooAsset
|
|||
public abstract class ClearUnusedBundleFilesOperation : AsyncOperationBase
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用类
|
||||
/// </summary>
|
||||
internal sealed class DefaultClearUnusedBundleFilesOperation : ClearUnusedBundleFilesOperation
|
||||
internal sealed class ClearUnusedBundleFilesImplOperation : ClearUnusedBundleFilesOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -31,7 +27,7 @@ namespace YooAsset
|
|||
private FSClearUnusedBundleFilesOperation _clearUnusedBundleFilesOpC;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DefaultClearUnusedBundleFilesOperation(IPlayMode impl, IFileSystem fileSystemA, IFileSystem fileSystemB, IFileSystem fileSystemC)
|
||||
internal ClearUnusedBundleFilesImplOperation(IPlayMode impl, IFileSystem fileSystemA, IFileSystem fileSystemB, IFileSystem fileSystemC)
|
||||
{
|
||||
_impl = impl;
|
||||
_fileSystemA = fileSystemA;
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace YooAsset
|
|||
if (_steps == ESteps.LoadManifestFile)
|
||||
{
|
||||
if (_loadPackageManifestOp == null)
|
||||
_loadPackageManifestOp = _impl.EditorFileSystem.LoadPackageManifestAsync(null);
|
||||
_loadPackageManifestOp = _impl.EditorFileSystem.LoadPackageManifestAsync(null, int.MaxValue);
|
||||
|
||||
Progress = _loadPackageManifestOp.Progress;
|
||||
if (_loadPackageManifestOp.IsDone == false)
|
||||
|
@ -94,7 +94,7 @@ namespace YooAsset
|
|||
if (_loadPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
_impl.ActiveManifest = _loadPackageManifestOp.Result;
|
||||
_impl.ActiveManifest = _loadPackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
@ -187,7 +187,7 @@ namespace YooAsset
|
|||
if (_steps == ESteps.LoadManifestFile)
|
||||
{
|
||||
if (_loadPackageManifestOp == null)
|
||||
_loadPackageManifestOp = _impl.BuildinFileSystem.LoadPackageManifestAsync(null);
|
||||
_loadPackageManifestOp = _impl.BuildinFileSystem.LoadPackageManifestAsync(null, int.MaxValue);
|
||||
|
||||
Progress = _loadPackageManifestOp.Progress;
|
||||
if (_loadPackageManifestOp.IsDone == false)
|
||||
|
@ -196,7 +196,7 @@ namespace YooAsset
|
|||
if (_loadPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
_impl.ActiveManifest = _loadPackageManifestOp.Result;
|
||||
_impl.ActiveManifest = _loadPackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace YooAsset
|
|||
|
||||
if (_loadPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_manifest = _loadPackageManifestOp.Result;
|
||||
_manifest = _loadPackageManifestOp.Manifest;
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
|
|
|
@ -11,11 +11,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public string PackageVersion { protected set; get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用类
|
||||
/// </summary>
|
||||
internal sealed class DefaultRequestPackageVersionOperation : RequestPackageVersionOperation
|
||||
internal sealed class RequestPackageVersionImplOperation : RequestPackageVersionOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -30,7 +26,7 @@ namespace YooAsset
|
|||
private FSRequestPackageVersionOperation _requestPackageVersionOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DefaultRequestPackageVersionOperation(IFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||
internal RequestPackageVersionImplOperation(IFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
|
|
|
@ -7,11 +7,7 @@ namespace YooAsset
|
|||
public abstract class UpdatePackageManifestOperation : AsyncOperationBase
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用类
|
||||
/// </summary>
|
||||
internal sealed class DefaultUpdatePackageManifestOperation : UpdatePackageManifestOperation
|
||||
internal sealed class UpdatePackageManifestImplOperation : UpdatePackageManifestOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
|
@ -30,7 +26,7 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal DefaultUpdatePackageManifestOperation(IPlayMode impl, IFileSystem fileSystem, string packageVersion, int timeout)
|
||||
internal UpdatePackageManifestImplOperation(IPlayMode impl, IFileSystem fileSystem, string packageVersion, int timeout)
|
||||
{
|
||||
_impl = impl;
|
||||
_fileSystem = fileSystem;
|
||||
|
@ -85,7 +81,7 @@ namespace YooAsset
|
|||
if (_loadPackageManifestOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
_impl.ActiveManifest = _loadPackageManifestOp.Result;
|
||||
_impl.ActiveManifest = _loadPackageManifestOp.Manifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -36,13 +36,13 @@ namespace YooAsset
|
|||
|
||||
RequestPackageVersionOperation IPlayMode.RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DefaultRequestPackageVersionOperation(EditorFileSystem, appendTimeTicks, timeout);
|
||||
var operation = new RequestPackageVersionImplOperation(EditorFileSystem, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
UpdatePackageManifestOperation IPlayMode.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DefaultUpdatePackageManifestOperation(this, EditorFileSystem, packageVersion, timeout);
|
||||
var operation = new UpdatePackageManifestImplOperation(this, EditorFileSystem, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
@ -55,13 +55,13 @@ namespace YooAsset
|
|||
|
||||
ClearAllBundleFilesOperation IPlayMode.ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearAllBundleFilesOperation(this, EditorFileSystem, null, null);
|
||||
var operation = new ClearAllBundleFilesImplOperation(this, EditorFileSystem, null, null);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
ClearUnusedBundleFilesOperation IPlayMode.ClearUnusedBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearUnusedBundleFilesOperation(this, EditorFileSystem, null, null);
|
||||
var operation = new ClearUnusedBundleFilesImplOperation(this, EditorFileSystem, null, null);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
|
|
@ -44,13 +44,13 @@ namespace YooAsset
|
|||
|
||||
RequestPackageVersionOperation IPlayMode.RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DefaultRequestPackageVersionOperation(CacheFileSystem, appendTimeTicks, timeout);
|
||||
var operation = new RequestPackageVersionImplOperation(CacheFileSystem, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
UpdatePackageManifestOperation IPlayMode.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DefaultUpdatePackageManifestOperation(this, CacheFileSystem, packageVersion, timeout);
|
||||
var operation = new UpdatePackageManifestImplOperation(this, CacheFileSystem, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
@ -63,13 +63,13 @@ namespace YooAsset
|
|||
|
||||
ClearAllBundleFilesOperation IPlayMode.ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearAllBundleFilesOperation(this, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem);
|
||||
var operation = new ClearAllBundleFilesImplOperation(this, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
ClearUnusedBundleFilesOperation IPlayMode.ClearUnusedBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearUnusedBundleFilesOperation(this, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem);
|
||||
var operation = new ClearUnusedBundleFilesImplOperation(this, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ namespace YooAsset
|
|||
|
||||
RequestPackageVersionOperation IPlayMode.RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DefaultRequestPackageVersionOperation(BuildinFileSystem, appendTimeTicks, timeout);
|
||||
var operation = new RequestPackageVersionImplOperation(BuildinFileSystem, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
UpdatePackageManifestOperation IPlayMode.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DefaultUpdatePackageManifestOperation(this, BuildinFileSystem, packageVersion, timeout);
|
||||
var operation = new UpdatePackageManifestImplOperation(this, BuildinFileSystem, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
@ -55,13 +55,13 @@ namespace YooAsset
|
|||
|
||||
ClearAllBundleFilesOperation IPlayMode.ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearAllBundleFilesOperation(this, BuildinFileSystem, null, null);
|
||||
var operation = new ClearAllBundleFilesImplOperation(this, BuildinFileSystem, null, null);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
ClearUnusedBundleFilesOperation IPlayMode.ClearUnusedBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearUnusedBundleFilesOperation(this, BuildinFileSystem, null, null);
|
||||
var operation = new ClearUnusedBundleFilesImplOperation(this, BuildinFileSystem, null, null);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace YooAsset
|
|||
Type classType = Type.GetType(parameters.FileSystemClass);
|
||||
if (classType == null)
|
||||
{
|
||||
YooLogger.Error($"Not found file system class type {parameters.FileSystemClass}");
|
||||
YooLogger.Error($"Can not found file system class type {parameters.FileSystemClass}");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ namespace YooAsset
|
|||
|
||||
RequestPackageVersionOperation IPlayMode.RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DefaultRequestPackageVersionOperation(WebFileSystem, appendTimeTicks, timeout);
|
||||
var operation = new RequestPackageVersionImplOperation(WebFileSystem, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
UpdatePackageManifestOperation IPlayMode.UpdatePackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DefaultUpdatePackageManifestOperation(this, WebFileSystem, packageVersion, timeout);;
|
||||
var operation = new UpdatePackageManifestImplOperation(this, WebFileSystem, packageVersion, timeout);;
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
@ -55,13 +55,13 @@ namespace YooAsset
|
|||
|
||||
ClearAllBundleFilesOperation IPlayMode.ClearAllBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearAllBundleFilesOperation(this, WebFileSystem, null, null);
|
||||
var operation = new ClearAllBundleFilesImplOperation(this, WebFileSystem, null, null);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
ClearUnusedBundleFilesOperation IPlayMode.ClearUnusedBundleFilesAsync()
|
||||
{
|
||||
var operation = new DefaultClearUnusedBundleFilesOperation(this, WebFileSystem, null, null);
|
||||
var operation = new ClearUnusedBundleFilesImplOperation(this, WebFileSystem, null, null);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
|
|
|
@ -1047,7 +1047,7 @@ namespace YooAsset
|
|||
if (checkActiveManifest)
|
||||
{
|
||||
if (_playModeImpl.ActiveManifest == null)
|
||||
throw new Exception("Not found active package manifest !");
|
||||
throw new Exception("Can not found active package manifest !");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace YooAsset
|
|||
CheckException(packageName);
|
||||
var package = GetPackageInternal(packageName);
|
||||
if (package == null)
|
||||
YooLogger.Error($"Not found resource package : {packageName}");
|
||||
YooLogger.Error($"Can not found resource package : {packageName}");
|
||||
return package;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue