diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadParam.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadParam.cs
new file mode 100644
index 0000000..08efef4
--- /dev/null
+++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadParam.cs
@@ -0,0 +1,30 @@
+
+namespace YooAsset
+{
+ internal class DownloadParam
+ {
+ public readonly int FailedTryAgain;
+ public readonly int Timeout;
+
+ ///
+ /// 导入的本地文件路径
+ ///
+ public string ImportFilePath { set; get; }
+
+ ///
+ /// 主资源地址
+ ///
+ public string MainURL { set; get; }
+
+ ///
+ /// 备用资源地址
+ ///
+ public string FallbackURL { set; get; }
+
+ public DownloadParam(int failedTryAgain, int timeout)
+ {
+ FailedTryAgain = failedTryAgain;
+ Timeout = timeout;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadRemotePackageManifestOperation.cs.meta b/Assets/YooAsset/Runtime/DownloadSystem/DownloadParam.cs.meta
similarity index 83%
rename from Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadRemotePackageManifestOperation.cs.meta
rename to Assets/YooAsset/Runtime/DownloadSystem/DownloadParam.cs.meta
index 183900f..8528620 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadRemotePackageManifestOperation.cs.meta
+++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadParam.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 2c2153284d246964fb2146f9fdda311c
+guid: 56ea224b45d314e4a86b558404e9b6c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
index 736ec55..16534c6 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
@@ -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
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
index ac439b1..f538faa 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
@@ -10,6 +10,36 @@ namespace YooAsset
///
internal class DefaultBuildinFileSystem : IFileSystem
{
+ private class UnpackRemoteServices : IRemoteServices
+ {
+ private readonly string _buildinPackageRoot;
+ protected readonly Dictionary _mapping = new Dictionary(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 _wrappers = new Dictionary(10000);
protected readonly Dictionary _loadedStream = new Dictionary(10000);
protected readonly Dictionary _buildinFilePaths = new Dictionary(10000);
+ protected IFileSystem _unpackFileSystem;
protected string _packageRoot;
- // 解压文件系统
- public IFileSystem UnpackFileSystem { private set; get; }
-
///
/// 包裹名称
///
@@ -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;
}
+
+ ///
+ /// 初始化解压文件系统
+ ///
+ public FSInitializeFileSystemOperation InitializeUpackFileSystem()
+ {
+ return _unpackFileSystem.InitializeFileSystemAsync();
+ }
#endregion
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs
index 720983d..0e56114 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs
@@ -10,8 +10,8 @@ namespace YooAsset
public int callbackOrder { get { return 0; } }
///
- /// 在构建应用程序前自动生成内置资源清单。
- /// 原理:搜索StreamingAssets目录下的所有资源文件,然后将这些文件信息写入内置资源清单,并存储在Resources目录下。
+ /// 在构建应用程序前自动生成内置资源目录文件。
+ /// 原理:搜索StreamingAssets目录下的所有资源文件,然后将这些文件信息写入文件,并存储在Resources目录下。
///
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}");
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs
index 84d7f83..10dc76a 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs
@@ -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}");
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
index 5ec3b40..e17ef8e 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
@@ -3,13 +3,14 @@ using UnityEngine;
namespace YooAsset
{
+ ///
+ /// 加载AssetBundle文件
+ ///
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;
- }
+ _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();
- }
}
}
+ ///
+ /// 加载原生文件
+ ///
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;
- }
+ _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();
- }
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadPackageManifestOperation.cs
index 37772c6..f33bf74 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadPackageManifestOperation.cs
@@ -95,7 +95,7 @@ namespace YooAsset
if (_loadBuildinPackageManifestOp.Status == EOperationStatus.Succeed)
{
_steps = ESteps.Done;
- Result = _loadBuildinPackageManifestOp.Manifest;
+ Manifest = _loadBuildinPackageManifestOp.Manifest;
Status = EOperationStatus.Succeed;
}
else
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSRequestPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSRequestPackageVersionOperation.cs
index e5cd53b..7cf31ba 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSRequestPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSRequestPackageVersionOperation.cs
@@ -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)
{
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
index 58e7870..7b3bf54 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
index 555c694..514358a 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
@@ -20,7 +20,7 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
///
- /// 加载的清单实例
+ /// 包裹清单
///
public PackageManifest Manifest { private set; get; }
@@ -76,7 +76,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = "Failed to verify buildin package manifest file!";
+ Error = "Failed to verify buildin package manifest file !";
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
index aa737e8..c0837a9 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
@@ -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);
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearAllBundleFilesOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearAllBundleFilesOperation.cs
index 8c0d8bd..de0f39f 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearAllBundleFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearAllBundleFilesOperation.cs
@@ -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)
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearUnusedBundleFilesOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearUnusedBundleFilesOperation.cs
index 5036f4f..c4201c9 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearUnusedBundleFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSClearUnusedBundleFilesOperation.cs
@@ -35,11 +35,11 @@ namespace YooAsset
return;
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)
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs
index 7f6cf81..fefeb0a 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs
@@ -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);
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs
index 8243a34..d27fb38 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs
@@ -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,11 +74,18 @@ namespace YooAsset
if (_verifyCacheFilesOp.IsDone == false)
return;
- // 注意:总是返回成功
- _steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
-
- YooLogger.Log($"Package '{_fileSytem.PackageName}' cached files count : {_fileSytem.FileCount}");
+ 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;
+ }
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
index 237400a..879d726 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
@@ -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;
@@ -67,7 +72,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = _downloadFileOp.Error;
+ Error = _downloadFileOp.Error;
}
}
@@ -106,14 +111,14 @@ namespace YooAsset
if (Result != null)
{
_steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
+ Status = EOperationStatus.Succeed;
}
else
{
// 注意:当缓存文件的校验等级为Low的时候,并不能保证缓存文件的完整性。
// 说明:在AssetBundle文件加载失败的情况下,我们需要重新验证文件的完整性!
- EFileVerifyResult result = _fileSystem.VerifyCacheFile(_bundle);
- if (result == EFileVerifyResult.Succeed)
+ EFileVerifyResult verifyResult = _fileSystem.VerifyCacheFile(_bundle);
+ if (verifyResult == EFileVerifyResult.Succeed)
{
// 注意:在安卓移动平台,华为和三星真机上有极小概率加载资源包失败。
// 说明:大多数情况在首次安装下载资源到沙盒内,游戏过程中切换到后台再回到游戏内有很大概率触发!
@@ -126,20 +131,20 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"Failed to load assetBundle from memory : {_bundle.BundleName}";
+ Error = $"Failed to load assetBundle from memory : {_bundle.BundleName}";
YooLogger.Error(Error);
}
else
{
_steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
+ Status = EOperationStatus.Succeed;
}
}
else
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"Failed to read assetBundle file bytes : {_bundle.BundleName}";
+ Error = $"Failed to read assetBundle file bytes : {_bundle.BundleName}";
YooLogger.Error(Error);
}
}
@@ -148,7 +153,7 @@ namespace YooAsset
_steps = ESteps.Done;
_fileSystem.DeleteCacheFile(_bundle.BundleGUID);
Status = EOperationStatus.Failed;
- Error = $"Find corrupted file and delete the file : {_bundle.BundleName}";
+ Error = $"Find corrupted file and delete the file : {_bundle.BundleName}";
YooLogger.Error(Error);
}
}
@@ -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;
@@ -253,7 +263,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = _downloadFileOp.Error;
+ Error = _downloadFileOp.Error;
}
}
@@ -272,20 +282,20 @@ namespace YooAsset
if (File.Exists(filePath))
{
_steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
+ Status = EOperationStatus.Succeed;
}
else
{
_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}";
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadPackageManifestOperation.cs
index c55fe37..37bf7b5 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadPackageManifestOperation.cs
@@ -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);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSRequestPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSRequestPackageVersionOperation.cs
index 228f5b1..3724c90 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSRequestPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSRequestPackageVersionOperation.cs
@@ -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;
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageHashOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageHashOperation.cs
index 39fb946..655eebc 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageHashOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageHashOperation.cs
@@ -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);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageManifestOperation.cs
index e14bc2c..18858f7 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageManifestOperation.cs
@@ -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);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageHashOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageHashOperation.cs
index 94d1bc3..b383a37 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageHashOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageHashOperation.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
index 1d2df41..eeb6b90 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
@@ -21,7 +21,7 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
///
- /// 加载的清单实例
+ /// 包裹清单
///
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}";
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultGetRemotePackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/RequestRemotePackageVersionOperation.cs
similarity index 68%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultGetRemotePackageVersionOperation.cs
rename to Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/RequestRemotePackageVersionOperation.cs
index 9ba2ee6..25ef85d 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultGetRemotePackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/RequestRemotePackageVersionOperation.cs
@@ -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;
///
- /// 查询的远端版本信息
+ /// 包裹版本
///
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)
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultGetRemotePackageVersionOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/RequestRemotePackageVersionOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultGetRemotePackageVersionOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/RequestRemotePackageVersionOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs
index 5844862..bdb79fd 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs
@@ -56,7 +56,6 @@ namespace YooAsset
if (SearchFiles())
return;
- // 注意:总是返回成功
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyStartTime;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyCacheFilesOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyCacheFilesOperation.cs
index 2ad7a4a..943cee9 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyCacheFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyCacheFilesOperation.cs
@@ -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();
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyTempFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyTempFileOperation.cs
index b3fa80a..18e4888 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyTempFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/VerifyTempFileOperation.cs
@@ -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}";
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
index 77ea595..a013154 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
@@ -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();
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadPackageManifestOperation.cs
index bf65e44..2dde91f 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadPackageManifestOperation.cs
@@ -43,7 +43,7 @@ namespace YooAsset
if (_loadEditorPackageManifestOp.Status == EOperationStatus.Succeed)
{
_steps = ESteps.Done;
- Result = _loadEditorPackageManifestOp.Manifest;
+ Manifest = _loadEditorPackageManifestOp.Manifest;
Status = EOperationStatus.Succeed;
}
else
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSRequestPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSRequestPackageVersionOperation.cs
index 7be8793..5836420 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSRequestPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSRequestPackageVersionOperation.cs
@@ -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)
{
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
index 95f9462..1afc80c 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
@@ -18,7 +18,7 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
///
- /// 加载的清单实例
+ /// 包裹清单
///
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}";
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageVersionOperation.cs
index 814c4b8..3624325 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageVersionOperation.cs
@@ -14,6 +14,9 @@ namespace YooAsset
private readonly DefaultEditorFileSystem _fileSystem;
private ESteps _steps = ESteps.None;
+ ///
+ /// 包裹版本
+ ///
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}";
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs
index 0d6fbaa..ebb6776 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs
@@ -2,7 +2,7 @@
namespace YooAsset
{
///
- /// 缓存文件系统
+ /// 解压文件系统
///
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;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation.meta b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation.meta
new file mode 100644
index 0000000..ab868c7
--- /dev/null
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 59b123e460757694180175970bf28826
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation/DUFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation/DUFSLoadBundleOperation.cs
new file mode 100644
index 0000000..c2bab46
--- /dev/null
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation/DUFSLoadBundleOperation.cs
@@ -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;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestRemotePackageHashOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation/DUFSLoadBundleOperation.cs.meta
similarity index 83%
rename from Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestRemotePackageHashOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation/DUFSLoadBundleOperation.cs.meta
index c2f4ed9..2015b9e 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestRemotePackageHashOperation.cs.meta
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/Operation/DUFSLoadBundleOperation.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 3f8269507a575884f935f9fbc71396ea
+guid: 47f6fe3a815d28e49815db7c09c1fa76
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/DefaultWebFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/DefaultWebFileSystem.cs
index a784a82..6f50a97 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/DefaultWebFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/DefaultWebFileSystem.cs
@@ -63,20 +63,10 @@ namespace YooAsset
}
#region 自定义参数
- ///
- /// 自定义参数:远程服务接口
- ///
- public IRemoteServices RemoteServices { private set; get; } = null;
-
///
/// 禁用Unity的网络缓存
///
public bool DisableUnityWebCache { private set; get; } = false;
-
- ///
- /// 允许跨域访问和下载
- ///
- 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);
- OperationSystem.StartOperation(PackageName, operation);
- return operation;
- }
- else
- {
- var operation = new DWFSLoadWebPackageManifestOperation(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);
+ var operation = new DWFSLoadPackageManifestOperation(this, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
- public virtual FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args)
+ public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
+ {
+ var operation = new DWFSRequestPackageVersionOperation(this, timeout);
+ OperationSystem.StartOperation(PackageName, operation);
+ return operation;
+ }
+ 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;
+ return false;
}
public virtual bool NeedUnpack(PackageBundle bundle)
{
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSInitializeOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSInitializeOperation.cs
index f46ce37..ac471b1 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSInitializeOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSInitializeOperation.cs
@@ -1,7 +1,7 @@
namespace YooAsset
{
- internal partial class DWFSInitializeOperation : FSInitializeFileSystemOperation
+ internal class DWFSInitializeOperation : FSInitializeFileSystemOperation
{
private enum ESteps
{
@@ -39,10 +39,17 @@ namespace YooAsset
if (_loadCatalogFileOp.IsDone == false)
return;
- // 说明:应用程序内不一定存在序列化文件
- // 注意:总是返回成功
- _steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
+ if (_loadCatalogFileOp.Status == EOperationStatus.Succeed)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Succeed;
+ }
+ else
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = _loadCatalogFileOp.Error;
+ }
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadBundleOperation.cs
index 2375d15..ed99327 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadBundleOperation.cs
@@ -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
- {
- string fileLoadPath = _fileSystem.GetWebFileLoadPath(_bundle);
- mainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
- fallbackURL = mainURL;
- }
- _downloadhanlderAssetBundleOp = new DownloadHandlerAssetBundleOperation(_fileSystem, _bundle, mainURL, fallbackURL, failedTryAgain, timeout);
+ DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
+ string fileLoadPath = _fileSystem.GetWebFileLoadPath(_bundle);
+ downloadParam.MainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
+ downloadParam.FallbackURL = downloadParam.MainURL;
+ _downloadhanlderAssetBundleOp = new DownloadHandlerAssetBundleOperation(_fileSystem, _bundle, downloadParam);
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadhanlderAssetBundleOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadPackageManifestOperation.cs
index 12ca51d..1752115 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSLoadPackageManifestOperation.cs
@@ -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;
- }
- }
- }
- }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSRequestPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSRequestPackageVersionOperation.cs
index ce396c9..00685eb 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSRequestPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/DWFSRequestPackageVersionOperation.cs
@@ -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;
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/DownloadHandlerAssetBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/DownloadHandlerAssetBundleOperation.cs
index 0d0eefe..d969959 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/DownloadHandlerAssetBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/DownloadHandlerAssetBundleOperation.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadRemotePackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadRemotePackageManifestOperation.cs
deleted file mode 100644
index 42edc56..0000000
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadRemotePackageManifestOperation.cs
+++ /dev/null
@@ -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;
-
- ///
- /// 加载的清单实例
- ///
- 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);
- }
- }
-}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebCatalogFileOperation.cs
index 531d52f..b3d920f 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebCatalogFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebCatalogFileOperation.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebPackageManifestOperation.cs
index 7b1a866..6d1cff2 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/LoadWebPackageManifestOperation.cs
@@ -20,10 +20,11 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
///
- /// 加载的清单实例
+ /// 包裹清单
///
public PackageManifest Manifest { private set; get; }
+
internal LoadWebPackageManifestOperation(DefaultWebFileSystem fileSystem, string packageVersion, string packageHash)
{
_fileSystem = fileSystem;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestRemotePackageHashOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestRemotePackageHashOperation.cs
deleted file mode 100644
index 0e9b1d7..0000000
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestRemotePackageHashOperation.cs
+++ /dev/null
@@ -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;
-
- ///
- /// 包裹哈希值
- ///
- 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);
- }
- }
-}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageHashOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageHashOperation.cs
index 5ef9cd2..6467366 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageHashOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageHashOperation.cs
@@ -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;
+ }
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageVersionOperation.cs
index 20f1fd2..c84ec91 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebFileSystem/Operation/internal/RequestWebPackageVersionOperation.cs
@@ -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;
+ }
}
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
index 4e87927..c0cf411 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
@@ -32,27 +32,27 @@ namespace YooAsset
///
/// 加载包裹清单
///
- FSLoadPackageManifestOperation LoadPackageManifestAsync(params object[] args);
+ FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout);
///
/// 查询最新的版本
///
- FSRequestPackageVersionOperation RequestPackageVersionAsync(params object[] args);
+ FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout);
///
/// 清空所有的文件
///
- FSClearAllBundleFilesOperation ClearAllBundleFilesAsync(params object[] args);
-
+ FSClearAllBundleFilesOperation ClearAllBundleFilesAsync();
+
///
/// 清空未使用的文件
///
- FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(params object[] args);
+ FSClearUnusedBundleFilesOperation ClearUnusedBundleFilesAsync(PackageManifest manifest);
///
/// 下载远端文件
///
- FSDownloadFileOperation DownloadFileAsync(params object[] args);
+ FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param);
///
/// 加载Bundle文件
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadPackageManifestOperation.cs
index a9aaf6b..72a9969 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadPackageManifestOperation.cs
@@ -4,8 +4,8 @@ namespace YooAsset
internal abstract class FSLoadPackageManifestOperation : AsyncOperationBase
{
///
- /// 加载结果
+ /// 资源清单
///
- internal PackageManifest Result { set; get; }
+ internal PackageManifest Manifest { set; get; }
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs
index 1f269da..a0cc5e4 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs
@@ -4,7 +4,7 @@ namespace YooAsset
internal abstract class FSRequestPackageVersionOperation : AsyncOperationBase
{
///
- /// 查询的最新版本信息
+ /// 资源版本
///
internal string PackageVersion { set; get; }
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs
index f26a336..c92ae04 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs
@@ -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;
}
///
@@ -57,9 +49,9 @@ namespace YooAsset
// 轮流返回请求地址
_requestCount++;
if (_requestCount % 2 == 0)
- return _fallbackURL;
+ return Param.FallbackURL;
else
- return _mainURL;
+ return Param.MainURL;
}
///
@@ -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)
diff --git a/Assets/YooAsset/Runtime/InitializeParameters.cs b/Assets/YooAsset/Runtime/InitializeParameters.cs
index 911e8c0..ebc63d6 100644
--- a/Assets/YooAsset/Runtime/InitializeParameters.cs
+++ b/Assets/YooAsset/Runtime/InitializeParameters.cs
@@ -87,7 +87,7 @@ namespace YooAsset
///
/// 创建默认的编辑器文件系统参数
- /// 模拟构建结果
+ /// 模拟构建结果
///
public static FileSystemParameters CreateDefaultEditorFileSystemParameters(SimulateBuildResult simulateBuildResult)
{
@@ -160,26 +160,12 @@ namespace YooAsset
///
/// 创建默认的Web文件系统参数
///
+ /// 禁用Unity的网络缓存
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;
- }
-
- ///
- /// 创建默认的Web文件系统参数
- ///
- /// 远端资源地址查询服务类
- 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;
}
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs b/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
index fb2adf3..cec9955 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
@@ -1,7 +1,4 @@
-using System.IO;
-using System.Collections.Generic;
-using UnityEngine;
-
+
namespace YooAsset
{
internal class BundleInfo
@@ -54,7 +51,9 @@ namespace YooAsset
///
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);
}
///
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs
index a23be0b..e332ab9 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs
@@ -7,11 +7,7 @@ namespace YooAsset
public abstract class ClearAllBundleFilesOperation : AsyncOperationBase
{
}
-
- ///
- /// 通用类
- ///
- 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;
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs
index a906e90..f7862d0 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs
@@ -7,11 +7,7 @@ namespace YooAsset
public abstract class ClearUnusedBundleFilesOperation : AsyncOperationBase
{
}
-
- ///
- /// 通用类
- ///
- 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;
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs
index 0d08152..0b7bee2 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs
@@ -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
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
index 63a267c..5b2abf6 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
@@ -204,7 +204,7 @@ namespace YooAsset
if (_loadPackageManifestOp.Status == EOperationStatus.Succeed)
{
- _manifest = _loadPackageManifestOp.Result;
+ _manifest = _loadPackageManifestOp.Manifest;
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs
index 4d3c9c6..86e9e60 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs
@@ -11,11 +11,7 @@ namespace YooAsset
///
public string PackageVersion { protected set; get; }
}
-
- ///
- /// 通用类
- ///
- 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;
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/UpdatePackageManifestOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/UpdatePackageManifestOperation.cs
index 57b53a5..d3d64f2 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/UpdatePackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/UpdatePackageManifestOperation.cs
@@ -7,11 +7,7 @@ namespace YooAsset
public abstract class UpdatePackageManifestOperation : AsyncOperationBase
{
}
-
- ///
- /// 通用类
- ///
- 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
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeImpl.cs
index 07aefc1..51f8168 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeImpl.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeImpl.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs
index af27ba3..4344371 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/OfflinePlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/OfflinePlayModeImpl.cs
index d15d1c1..7f8d1a8 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/OfflinePlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/OfflinePlayModeImpl.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeHelper.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeHelper.cs
index ad1e541..8eb66b5 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeHelper.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeHelper.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/WebPlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/WebPlayModeImpl.cs
index 1d3c965..14f42e1 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/WebPlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/WebPlayModeImpl.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
index 0502eaf..079fad8 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
@@ -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 !");
}
}
diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index cc9fc76..8a762d7 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -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;
}