update resource package
增加CustomPlayMode运行模式
This commit is contained in:
@@ -1,144 +1,102 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
public abstract class ClearCacheFilesOperation : AsyncOperationBase
|
||||
{
|
||||
}
|
||||
internal sealed class ClearCacheFilesImplOperation : ClearCacheFilesOperation
|
||||
public sealed class ClearCacheFilesOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
ClearFileSystemA,
|
||||
ClearFileSystemB,
|
||||
ClearFileSystemC,
|
||||
Prepare,
|
||||
ClearCacheFiles,
|
||||
CheckClearResult,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly IPlayMode _impl;
|
||||
private readonly IFileSystem _fileSystemA;
|
||||
private readonly IFileSystem _fileSystemB;
|
||||
private readonly IFileSystem _fileSystemC;
|
||||
private readonly PlayModeImpl _impl;
|
||||
private readonly string _clearMode;
|
||||
private readonly object _clearParam;
|
||||
private FSClearCacheFilesOperation _clearCacheFilesOpA;
|
||||
private FSClearCacheFilesOperation _clearCacheFilesOpB;
|
||||
private FSClearCacheFilesOperation _clearCacheFilesOpC;
|
||||
private List<IFileSystem> _cloneList;
|
||||
private FSClearCacheFilesOperation _clearCacheFilesOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal ClearCacheFilesImplOperation(IPlayMode impl, IFileSystem fileSystemA, IFileSystem fileSystemB, IFileSystem fileSystemC, string clearMode, object clearParam)
|
||||
internal ClearCacheFilesOperation(PlayModeImpl impl, string clearMode, object clearParam)
|
||||
{
|
||||
_impl = impl;
|
||||
_fileSystemA = fileSystemA;
|
||||
_fileSystemB = fileSystemB;
|
||||
_fileSystemC = fileSystemC;
|
||||
_clearMode = clearMode;
|
||||
_clearParam = clearParam;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.ClearFileSystemA;
|
||||
_steps = ESteps.Prepare;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.ClearFileSystemA)
|
||||
if (_steps == ESteps.Prepare)
|
||||
{
|
||||
if (_fileSystemA == null)
|
||||
{
|
||||
_steps = ESteps.ClearFileSystemB;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clearCacheFilesOpA == null)
|
||||
{
|
||||
_clearCacheFilesOpA = _fileSystemA.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOpA.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOpA);
|
||||
}
|
||||
|
||||
_clearCacheFilesOpA.UpdateOperation();
|
||||
Progress = _clearCacheFilesOpA.Progress;
|
||||
if (_clearCacheFilesOpA.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_clearCacheFilesOpA.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.ClearFileSystemB;
|
||||
}
|
||||
else
|
||||
var fileSytems = _impl.FileSystems;
|
||||
if (fileSytems == null || fileSytems.Count == 0)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _clearCacheFilesOpA.Error;
|
||||
Error = "The file system is empty !";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var fileSystem in fileSytems)
|
||||
{
|
||||
if (fileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "An empty object exists in the list!";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_cloneList = fileSytems.ToList();
|
||||
_steps = ESteps.ClearCacheFiles;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.ClearFileSystemB)
|
||||
if (_steps == ESteps.ClearCacheFiles)
|
||||
{
|
||||
if (_fileSystemB == null)
|
||||
{
|
||||
_steps = ESteps.ClearFileSystemC;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clearCacheFilesOpB == null)
|
||||
{
|
||||
_clearCacheFilesOpB = _fileSystemB.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOpB.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOpB);
|
||||
}
|
||||
|
||||
_clearCacheFilesOpB.UpdateOperation();
|
||||
Progress = _clearCacheFilesOpB.Progress;
|
||||
if (_clearCacheFilesOpB.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_clearCacheFilesOpB.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.ClearFileSystemC;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _clearCacheFilesOpB.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.ClearFileSystemC)
|
||||
{
|
||||
if (_fileSystemC == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clearCacheFilesOpC == null)
|
||||
{
|
||||
_clearCacheFilesOpC = _fileSystemC.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOpC.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOpC);
|
||||
}
|
||||
|
||||
_clearCacheFilesOpC.UpdateOperation();
|
||||
Progress = _clearCacheFilesOpC.Progress;
|
||||
if (_clearCacheFilesOpC.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_clearCacheFilesOpC.Status == EOperationStatus.Succeed)
|
||||
if (_cloneList.Count == 0)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
var fileSystem = _cloneList[0];
|
||||
_cloneList.RemoveAt(0);
|
||||
|
||||
_clearCacheFilesOp = fileSystem.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOp.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOp);
|
||||
_steps = ESteps.CheckClearResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.CheckClearResult)
|
||||
{
|
||||
_clearCacheFilesOp.UpdateOperation();
|
||||
Progress = _clearCacheFilesOp.Progress;
|
||||
if (_clearCacheFilesOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_clearCacheFilesOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.ClearCacheFiles;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _clearCacheFilesOpC.Error;
|
||||
Error = _clearCacheFilesOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +1,108 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化操作
|
||||
/// </summary>
|
||||
public abstract class InitializationOperation : AsyncOperationBase
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑器下模拟模式
|
||||
/// </summary>
|
||||
internal sealed class EditorSimulateModeInitializationOperation : InitializationOperation
|
||||
public class InitializationOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
CreateFileSystem,
|
||||
Prepare,
|
||||
ClearOldFileSystem,
|
||||
InitFileSystem,
|
||||
CheckInitResult,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly EditorSimulateModeImpl _impl;
|
||||
private readonly EditorSimulateModeParameters _parameters;
|
||||
private readonly PlayModeImpl _impl;
|
||||
private readonly List<FileSystemParameters> _parametersList;
|
||||
private List<FileSystemParameters> _cloneList;
|
||||
private FSInitializeFileSystemOperation _initFileSystemOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal EditorSimulateModeInitializationOperation(EditorSimulateModeImpl impl, EditorSimulateModeParameters parameters)
|
||||
internal InitializationOperation(PlayModeImpl impl, List<FileSystemParameters> parametersList)
|
||||
{
|
||||
_impl = impl;
|
||||
_parameters = parameters;
|
||||
_parametersList = parametersList;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateFileSystem;
|
||||
_steps = ESteps.Prepare;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.CreateFileSystem)
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.Prepare)
|
||||
{
|
||||
if (_parameters.EditorFileSystemParameters == null)
|
||||
if (_parametersList == null || _parametersList.Count == 0)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Editor file system parameters is null";
|
||||
Error = "The file system parameters is empty !";
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.EditorFileSystem = _parameters.EditorFileSystemParameters.CreateFileSystem(_impl.PackageName);
|
||||
if (_impl.EditorFileSystem == null)
|
||||
foreach (var fileSystemParam in _parametersList)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create editor file system";
|
||||
return;
|
||||
if (fileSystemParam == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "An empty object exists in the list!";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_cloneList = _parametersList.ToList();
|
||||
_steps = ESteps.ClearOldFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.ClearOldFileSystem)
|
||||
{
|
||||
// 注意:初始化失败后可能会残存一些旧的文件系统!
|
||||
foreach (var fileSystem in _impl.FileSystems)
|
||||
{
|
||||
fileSystem.OnDestroy();
|
||||
}
|
||||
|
||||
_impl.FileSystems.Clear();
|
||||
_steps = ESteps.InitFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.InitFileSystem)
|
||||
{
|
||||
if (_initFileSystemOp == null)
|
||||
if (_cloneList.Count == 0)
|
||||
{
|
||||
_initFileSystemOp = _impl.EditorFileSystem.InitializeFileSystemAsync();
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
var fileSystemParams = _cloneList[0];
|
||||
_cloneList.RemoveAt(0);
|
||||
|
||||
IFileSystem fileSystemInstance = fileSystemParams.CreateFileSystem(_impl.PackageName);
|
||||
if (fileSystemInstance == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create file system instance !";
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.FileSystems.Add(fileSystemInstance);
|
||||
_initFileSystemOp = fileSystemInstance.InitializeFileSystemAsync();
|
||||
_initFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initFileSystemOp);
|
||||
_steps = ESteps.CheckInitResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.CheckInitResult)
|
||||
{
|
||||
_initFileSystemOp.UpdateOperation();
|
||||
Progress = _initFileSystemOp.Progress;
|
||||
if (_initFileSystemOp.IsDone == false)
|
||||
@@ -75,375 +110,15 @@ namespace YooAsset
|
||||
|
||||
if (_initFileSystemOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
_steps = ESteps.InitFileSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _initFileSystemOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离线运行模式
|
||||
/// </summary>
|
||||
internal sealed class OfflinePlayModeInitializationOperation : InitializationOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
CreateFileSystem,
|
||||
InitFileSystem,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly OfflinePlayModeImpl _impl;
|
||||
private readonly OfflinePlayModeParameters _parameters;
|
||||
private FSInitializeFileSystemOperation _initFileSystemOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal OfflinePlayModeInitializationOperation(OfflinePlayModeImpl impl, OfflinePlayModeParameters parameters)
|
||||
{
|
||||
_impl = impl;
|
||||
_parameters = parameters;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateFileSystem;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.CreateFileSystem)
|
||||
{
|
||||
if (_parameters.BuildinFileSystemParameters == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Buildin file system parameters is null";
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.BuildinFileSystem = _parameters.BuildinFileSystemParameters.CreateFileSystem(_impl.PackageName);
|
||||
if (_impl.BuildinFileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create buildin file system";
|
||||
return;
|
||||
}
|
||||
|
||||
_steps = ESteps.InitFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.InitFileSystem)
|
||||
{
|
||||
if (_initFileSystemOp == null)
|
||||
{
|
||||
_initFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
|
||||
_initFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initFileSystemOp);
|
||||
}
|
||||
|
||||
_initFileSystemOp.UpdateOperation();
|
||||
Progress = _initFileSystemOp.Progress;
|
||||
if (_initFileSystemOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_initFileSystemOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _initFileSystemOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 联机运行模式
|
||||
/// </summary>
|
||||
internal sealed class HostPlayModeInitializationOperation : InitializationOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
CreateBuildinFileSystem,
|
||||
InitBuildinFileSystem,
|
||||
CreateCacheFileSystem,
|
||||
InitCacheFileSystem,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly HostPlayModeImpl _impl;
|
||||
private readonly HostPlayModeParameters _parameters;
|
||||
private FSInitializeFileSystemOperation _initBuildinFileSystemOp;
|
||||
private FSInitializeFileSystemOperation _initCacheFileSystemOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal HostPlayModeInitializationOperation(HostPlayModeImpl impl, HostPlayModeParameters parameters)
|
||||
{
|
||||
_impl = impl;
|
||||
_parameters = parameters;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateBuildinFileSystem;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.CreateBuildinFileSystem)
|
||||
{
|
||||
if (_parameters.BuildinFileSystemParameters == null)
|
||||
{
|
||||
_steps = ESteps.CreateCacheFileSystem;
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.BuildinFileSystem = _parameters.BuildinFileSystemParameters.CreateFileSystem(_impl.PackageName);
|
||||
if (_impl.BuildinFileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create buildin file system";
|
||||
return;
|
||||
}
|
||||
|
||||
_steps = ESteps.InitBuildinFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.InitBuildinFileSystem)
|
||||
{
|
||||
if (_initBuildinFileSystemOp == null)
|
||||
{
|
||||
_initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
|
||||
_initBuildinFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initBuildinFileSystemOp);
|
||||
}
|
||||
|
||||
_initBuildinFileSystemOp.UpdateOperation();
|
||||
Progress = _initBuildinFileSystemOp.Progress;
|
||||
if (_initBuildinFileSystemOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_initBuildinFileSystemOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.CreateCacheFileSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _initBuildinFileSystemOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.CreateCacheFileSystem)
|
||||
{
|
||||
if (_parameters.CacheFileSystemParameters == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Cache file system parameters is null";
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.CacheFileSystem = _parameters.CacheFileSystemParameters.CreateFileSystem(_impl.PackageName);
|
||||
if (_impl.CacheFileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create cache file system";
|
||||
return;
|
||||
}
|
||||
|
||||
_steps = ESteps.InitCacheFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.InitCacheFileSystem)
|
||||
{
|
||||
if (_initCacheFileSystemOp == null)
|
||||
{
|
||||
_initCacheFileSystemOp = _impl.CacheFileSystem.InitializeFileSystemAsync();
|
||||
_initCacheFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initCacheFileSystemOp);
|
||||
}
|
||||
|
||||
_initCacheFileSystemOp.UpdateOperation();
|
||||
Progress = _initCacheFileSystemOp.Progress;
|
||||
if (_initCacheFileSystemOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_initCacheFileSystemOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _initCacheFileSystemOp.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WebGL运行模式
|
||||
/// </summary>
|
||||
internal sealed class WebPlayModeInitializationOperation : InitializationOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
CreateWebServerFileSystem,
|
||||
InitWebServerFileSystem,
|
||||
CreateWebRemoteFileSystem,
|
||||
InitWebRemoteFileSystem,
|
||||
CheckResult,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly WebPlayModeImpl _impl;
|
||||
private readonly WebPlayModeParameters _parameters;
|
||||
private FSInitializeFileSystemOperation _initWebServerFileSystemOp;
|
||||
private FSInitializeFileSystemOperation _initWebRemoteFileSystemOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal WebPlayModeInitializationOperation(WebPlayModeImpl impl, WebPlayModeParameters parameters)
|
||||
{
|
||||
_impl = impl;
|
||||
_parameters = parameters;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateWebServerFileSystem;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.CreateWebServerFileSystem)
|
||||
{
|
||||
if (_parameters.WebServerFileSystemParameters == null)
|
||||
{
|
||||
_steps = ESteps.CreateWebRemoteFileSystem;
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.WebServerFileSystem = _parameters.WebServerFileSystemParameters.CreateFileSystem(_impl.PackageName);
|
||||
if (_impl.WebServerFileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create web server file system";
|
||||
return;
|
||||
}
|
||||
|
||||
_steps = ESteps.InitWebServerFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.InitWebServerFileSystem)
|
||||
{
|
||||
if (_initWebServerFileSystemOp == null)
|
||||
{
|
||||
_initWebServerFileSystemOp = _impl.WebServerFileSystem.InitializeFileSystemAsync();
|
||||
_initWebServerFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initWebServerFileSystemOp);
|
||||
}
|
||||
|
||||
_initWebServerFileSystemOp.UpdateOperation();
|
||||
Progress = _initWebServerFileSystemOp.Progress;
|
||||
if (_initWebServerFileSystemOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_initWebServerFileSystemOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.CreateWebRemoteFileSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _initWebServerFileSystemOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.CreateWebRemoteFileSystem)
|
||||
{
|
||||
if (_parameters.WebRemoteFileSystemParameters == null)
|
||||
{
|
||||
_steps = ESteps.CheckResult;
|
||||
return;
|
||||
}
|
||||
|
||||
_impl.WebRemoteFileSystem = _parameters.WebRemoteFileSystemParameters.CreateFileSystem(_impl.PackageName);
|
||||
if (_impl.WebRemoteFileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create web remote file system";
|
||||
return;
|
||||
}
|
||||
|
||||
_steps = ESteps.InitWebRemoteFileSystem;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.InitWebRemoteFileSystem)
|
||||
{
|
||||
if (_initWebRemoteFileSystemOp == null)
|
||||
{
|
||||
_initWebRemoteFileSystemOp = _impl.WebRemoteFileSystem.InitializeFileSystemAsync();
|
||||
_initWebRemoteFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initWebRemoteFileSystemOp);
|
||||
}
|
||||
|
||||
_initWebRemoteFileSystemOp.UpdateOperation();
|
||||
Progress = _initWebRemoteFileSystemOp.Progress;
|
||||
if (_initWebRemoteFileSystemOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_initWebRemoteFileSystemOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.CheckResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _initWebRemoteFileSystemOp.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.CheckResult)
|
||||
{
|
||||
if (_impl.WebServerFileSystem == null && _impl.WebRemoteFileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Not found any file system !";
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,132 +4,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 预下载内容
|
||||
/// 说明:目前只支持联机模式
|
||||
/// </summary>
|
||||
public abstract class PreDownloadContentOperation : AsyncOperationBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载当前资源版本所有的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public abstract ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60);
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源标签关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tag">资源标签</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public abstract ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60);
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源标签列表关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tags">资源标签列表</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public abstract ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60);
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源依赖的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="location">资源定位地址</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public abstract ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60);
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源列表依赖的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="locations">资源定位地址列表</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public abstract ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60);
|
||||
}
|
||||
|
||||
internal class EditorSimulateModePreDownloadContentOperation : PreDownloadContentOperation
|
||||
{
|
||||
private readonly EditorSimulateModeImpl _impl;
|
||||
|
||||
public EditorSimulateModePreDownloadContentOperation(EditorSimulateModeImpl impl)
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
}
|
||||
internal class OfflinePlayModePreDownloadContentOperation : PreDownloadContentOperation
|
||||
{
|
||||
private readonly OfflinePlayModeImpl _impl;
|
||||
|
||||
public OfflinePlayModePreDownloadContentOperation(OfflinePlayModeImpl impl)
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
}
|
||||
internal class HostPlayModePreDownloadContentOperation : PreDownloadContentOperation
|
||||
public sealed class PreDownloadContentOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
@@ -140,7 +15,7 @@ namespace YooAsset
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly HostPlayModeImpl _impl;
|
||||
private readonly PlayModeImpl _impl;
|
||||
private readonly string _packageVersion;
|
||||
private readonly int _timeout;
|
||||
private FSLoadPackageManifestOperation _loadPackageManifestOp;
|
||||
@@ -148,7 +23,7 @@ namespace YooAsset
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal HostPlayModePreDownloadContentOperation(HostPlayModeImpl impl, string packageVersion, int timeout)
|
||||
internal PreDownloadContentOperation(PlayModeImpl impl, string packageVersion, int timeout)
|
||||
{
|
||||
_impl = impl;
|
||||
_packageVersion = packageVersion;
|
||||
@@ -196,7 +71,8 @@ namespace YooAsset
|
||||
{
|
||||
if (_loadPackageManifestOp == null)
|
||||
{
|
||||
_loadPackageManifestOp = _impl.CacheFileSystem.LoadPackageManifestAsync(_packageVersion, _timeout);
|
||||
var mainFileSystem = _impl.GetMainFileSystem();
|
||||
_loadPackageManifestOp = mainFileSystem.LoadPackageManifestAsync(_packageVersion, _timeout);
|
||||
_loadPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadPackageManifestOp);
|
||||
}
|
||||
@@ -220,7 +96,13 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载当前资源版本所有的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
@@ -228,11 +110,19 @@ namespace YooAsset
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
|
||||
List<BundleInfo> downloadList = PlayModeHelper.GetDownloadListByAll(_manifest, _impl.BuildinFileSystem, _impl.CacheFileSystem);
|
||||
List<BundleInfo> downloadList = _impl.GetDownloadListByAll(_manifest);
|
||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源标签关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tag">资源标签</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
@@ -240,11 +130,19 @@ namespace YooAsset
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
|
||||
List<BundleInfo> downloadList = PlayModeHelper.GetDownloadListByTags(_manifest, new string[] { tag }, _impl.BuildinFileSystem, _impl.CacheFileSystem);
|
||||
List<BundleInfo> downloadList = _impl.GetDownloadListByTags(_manifest, new string[] { tag });
|
||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源标签列表关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tags">资源标签列表</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
@@ -252,11 +150,19 @@ namespace YooAsset
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
|
||||
List<BundleInfo> downloadList = PlayModeHelper.GetDownloadListByTags(_manifest, tags, _impl.BuildinFileSystem, _impl.CacheFileSystem);
|
||||
List<BundleInfo> downloadList = _impl.GetDownloadListByTags(_manifest, tags);
|
||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源依赖的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="location">资源定位地址</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
@@ -268,11 +174,19 @@ namespace YooAsset
|
||||
var assetInfo = _manifest.ConvertLocationToAssetInfo(location, null);
|
||||
assetInfos.Add(assetInfo);
|
||||
|
||||
List<BundleInfo> downloadList = PlayModeHelper.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload, _impl.BuildinFileSystem, _impl.CacheFileSystem);
|
||||
List<BundleInfo> downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
|
||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源列表依赖的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="locations">资源定位地址列表</param>
|
||||
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
|
||||
/// <param name="failedTryAgain">下载失败的重试次数</param>
|
||||
/// <param name="timeout">超时时间</param>
|
||||
public ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
@@ -287,46 +201,9 @@ namespace YooAsset
|
||||
assetInfos.Add(assetInfo);
|
||||
}
|
||||
|
||||
List<BundleInfo> downloadList = PlayModeHelper.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload, _impl.BuildinFileSystem, _impl.CacheFileSystem);
|
||||
List<BundleInfo> downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
|
||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
internal class WebPlayModePreDownloadContentOperation : PreDownloadContentOperation
|
||||
{
|
||||
private readonly WebPlayModeImpl _impl;
|
||||
|
||||
public WebPlayModePreDownloadContentOperation(WebPlayModeImpl impl)
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
public override ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||
{
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询远端包裹的最新版本
|
||||
/// </summary>
|
||||
public abstract class RequestPackageVersionOperation : AsyncOperationBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -20,15 +17,15 @@ namespace YooAsset
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly PlayModeImpl _impl;
|
||||
private readonly bool _appendTimeTicks;
|
||||
private readonly int _timeout;
|
||||
private FSRequestPackageVersionOperation _requestPackageVersionOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal RequestPackageVersionImplOperation(IFileSystem fileSystem, bool appendTimeTicks, int timeout)
|
||||
internal RequestPackageVersionImplOperation(PlayModeImpl impl, bool appendTimeTicks, int timeout)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_impl = impl;
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
@@ -45,7 +42,8 @@ namespace YooAsset
|
||||
{
|
||||
if (_requestPackageVersionOp == null)
|
||||
{
|
||||
_requestPackageVersionOp = _fileSystem.RequestPackageVersionAsync(_appendTimeTicks, _timeout);
|
||||
var mainFileSystem = _impl.GetMainFileSystem();
|
||||
_requestPackageVersionOp = mainFileSystem.RequestPackageVersionAsync(_appendTimeTicks, _timeout);
|
||||
_requestPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestPackageVersionOp);
|
||||
}
|
||||
|
||||
+6
-14
@@ -1,13 +1,7 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 向远端请求并更新清单
|
||||
/// </summary>
|
||||
public abstract class UpdatePackageManifestOperation : AsyncOperationBase
|
||||
{
|
||||
}
|
||||
internal sealed class UpdatePackageManifestImplOperation : UpdatePackageManifestOperation
|
||||
public sealed class UpdatePackageManifestOperation : AsyncOperationBase
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
@@ -17,19 +11,16 @@ namespace YooAsset
|
||||
LoadPackageManifest,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly IPlayMode _impl;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
private readonly PlayModeImpl _impl;
|
||||
private readonly string _packageVersion;
|
||||
private readonly int _timeout;
|
||||
private FSLoadPackageManifestOperation _loadPackageManifestOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal UpdatePackageManifestImplOperation(IPlayMode impl, IFileSystem fileSystem, string packageVersion, int timeout)
|
||||
internal UpdatePackageManifestOperation(PlayModeImpl impl, string packageVersion, int timeout)
|
||||
{
|
||||
_impl = impl;
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
@@ -74,7 +65,8 @@ namespace YooAsset
|
||||
{
|
||||
if (_loadPackageManifestOp == null)
|
||||
{
|
||||
_loadPackageManifestOp = _fileSystem.LoadPackageManifestAsync(_packageVersion, _timeout);
|
||||
var mainFileSystem = _impl.GetMainFileSystem();
|
||||
_loadPackageManifestOp = mainFileSystem.LoadPackageManifestAsync(_packageVersion, _timeout);
|
||||
_loadPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadPackageManifestOp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user