diff --git a/Assets/YooAsset/Runtime/InitializeParameters.cs b/Assets/YooAsset/Runtime/InitializeParameters.cs index 6a61716..f013415 100644 --- a/Assets/YooAsset/Runtime/InitializeParameters.cs +++ b/Assets/YooAsset/Runtime/InitializeParameters.cs @@ -220,7 +220,6 @@ namespace YooAsset public class HostPlayModeParameters : InitializeParameters { public FileSystemParameters BuildinFileSystemParameters; - public FileSystemParameters DeliveryFileSystemParameters; public FileSystemParameters CacheFileSystemParameters; } diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs index 8cb33ce..a721bcb 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs @@ -171,9 +171,9 @@ namespace YooAsset private enum ESteps { None, - CreateFileSystem, + CreateBuildinFileSystem, InitBuildinFileSystem, - InitDeliveryFileSystem, + CreateCacheFileSystem, InitCacheFileSystem, Done, } @@ -181,7 +181,6 @@ namespace YooAsset private readonly HostPlayModeImpl _impl; private readonly HostPlayModeParameters _parameters; private FSInitializeFileSystemOperation _initBuildinFileSystemOp; - private FSInitializeFileSystemOperation _initDeliveryFileSystemOp; private FSInitializeFileSystemOperation _initCacheFileSystemOp; private ESteps _steps = ESteps.None; @@ -192,14 +191,55 @@ namespace YooAsset } internal override void InternalOnStart() { - _steps = ESteps.CreateFileSystem; + _steps = ESteps.CreateBuildinFileSystem; } internal override void InternalOnUpdate() { if (_steps == ESteps.None || _steps == ESteps.Done) return; - if (_steps == ESteps.CreateFileSystem) + if (_steps == ESteps.CreateBuildinFileSystem) + { + if (_parameters.BuildinFileSystemParameters == null) + { + _steps = ESteps.CreateCacheFileSystem; + return; + } + + _impl.BuildinFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.BuildinFileSystemParameters); + 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(); + + 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) { @@ -209,30 +249,6 @@ namespace YooAsset return; } - if (_parameters.BuildinFileSystemParameters != null) - { - _impl.BuildinFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.BuildinFileSystemParameters); - if (_impl.BuildinFileSystem == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = "Failed to create buildin file system"; - return; - } - } - - if (_parameters.DeliveryFileSystemParameters != null) - { - _impl.DeliveryFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.DeliveryFileSystemParameters); - if (_impl.DeliveryFileSystem == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = "Failed to create delivery file system"; - return; - } - } - _impl.CacheFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.CacheFileSystemParameters); if (_impl.CacheFileSystem == null) { @@ -242,63 +258,7 @@ namespace YooAsset return; } - _steps = ESteps.InitBuildinFileSystem; - } - - if (_steps == ESteps.InitBuildinFileSystem) - { - // 注意:内置文件系统可以为空 - if (_impl.BuildinFileSystem == null) - { - _steps = ESteps.InitDeliveryFileSystem; - return; - } - - if (_initBuildinFileSystemOp == null) - _initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync(); - - Progress = _initBuildinFileSystemOp.Progress; - if (_initBuildinFileSystemOp.IsDone == false) - return; - - if (_initBuildinFileSystemOp.Status == EOperationStatus.Succeed) - { - _steps = ESteps.InitDeliveryFileSystem; - } - else - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = _initBuildinFileSystemOp.Error; - } - } - - if (_steps == ESteps.InitDeliveryFileSystem) - { - // 注意:分发文件系统可以为空 - if (_impl.DeliveryFileSystem == null) - { - _steps = ESteps.InitCacheFileSystem; - return; - } - - Progress = _initDeliveryFileSystemOp.Progress; - if (_initDeliveryFileSystemOp == null) - _initDeliveryFileSystemOp = _impl.DeliveryFileSystem.InitializeFileSystemAsync(); - - if (_initDeliveryFileSystemOp.IsDone == false) - return; - - if (_initDeliveryFileSystemOp.Status == EOperationStatus.Succeed) - { - _steps = ESteps.InitCacheFileSystem; - } - else - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = _initDeliveryFileSystemOp.Error; - } + _steps = ESteps.InitCacheFileSystem; } if (_steps == ESteps.InitCacheFileSystem) @@ -445,7 +405,7 @@ namespace YooAsset if (_steps == ESteps.CheckResult) { - if(_impl.WebServerFileSystem == null && _impl.WebRemoteFileSystem == null) + if (_impl.WebServerFileSystem == null && _impl.WebRemoteFileSystem == null) { _steps = ESteps.Done; Status = EOperationStatus.Failed; diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs index 5b2abf6..1d9c3fc 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs @@ -225,7 +225,7 @@ namespace YooAsset return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout); } - List downloadList = PlayModeHelper.GetDownloadListByAll(_manifest, _impl.BuildinFileSystem, _impl.DeliveryFileSystem, _impl.CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByAll(_manifest, _impl.BuildinFileSystem, _impl.CacheFileSystem); var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } @@ -237,7 +237,7 @@ namespace YooAsset return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout); } - List downloadList = PlayModeHelper.GetDownloadListByTags(_manifest, new string[] { tag }, _impl.BuildinFileSystem, _impl.DeliveryFileSystem, _impl.CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByTags(_manifest, new string[] { tag }, _impl.BuildinFileSystem, _impl.CacheFileSystem); var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } @@ -249,7 +249,7 @@ namespace YooAsset return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout); } - List downloadList = PlayModeHelper.GetDownloadListByTags(_manifest, tags, _impl.BuildinFileSystem, _impl.DeliveryFileSystem, _impl.CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByTags(_manifest, tags, _impl.BuildinFileSystem, _impl.CacheFileSystem); var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } @@ -265,7 +265,7 @@ namespace YooAsset var assetInfo = _manifest.ConvertLocationToAssetInfo(location, null); assetInfos.Add(assetInfo); - List downloadList = PlayModeHelper.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), _impl.BuildinFileSystem, _impl.DeliveryFileSystem, _impl.CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), _impl.BuildinFileSystem, _impl.CacheFileSystem); var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } @@ -284,7 +284,7 @@ namespace YooAsset assetInfos.Add(assetInfo); } - List downloadList = PlayModeHelper.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), _impl.BuildinFileSystem, _impl.DeliveryFileSystem, _impl.CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), _impl.BuildinFileSystem, _impl.CacheFileSystem); var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs index 4daf812..1e89e51 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs @@ -8,7 +8,6 @@ namespace YooAsset { public readonly string PackageName; public IFileSystem BuildinFileSystem { set; get; } //可以为空! - public IFileSystem DeliveryFileSystem { set; get; } //可以为空! public IFileSystem CacheFileSystem { set; get; } @@ -35,9 +34,6 @@ namespace YooAsset if (BuildinFileSystem != null) BuildinFileSystem.OnUpdate(); - if (DeliveryFileSystem != null) - DeliveryFileSystem.OnUpdate(); - if (CacheFileSystem != null) CacheFileSystem.OnUpdate(); } @@ -63,50 +59,50 @@ namespace YooAsset ClearAllBundleFilesOperation IPlayMode.ClearAllBundleFilesAsync() { - var operation = new ClearAllBundleFilesImplOperation(this, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + var operation = new ClearAllBundleFilesImplOperation(this, BuildinFileSystem, CacheFileSystem, null); OperationSystem.StartOperation(PackageName, operation); return operation; } ClearUnusedBundleFilesOperation IPlayMode.ClearUnusedBundleFilesAsync() { - var operation = new ClearUnusedBundleFilesImplOperation(this, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + var operation = new ClearUnusedBundleFilesImplOperation(this, BuildinFileSystem, CacheFileSystem, null); OperationSystem.StartOperation(PackageName, operation); return operation; } ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout) { - List downloadList = PlayModeHelper.GetDownloadListByAll(ActiveManifest, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByAll(ActiveManifest, BuildinFileSystem, CacheFileSystem); var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout) { - List downloadList = PlayModeHelper.GetDownloadListByTags(ActiveManifest, tags, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByTags(ActiveManifest, tags, BuildinFileSystem, CacheFileSystem); var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout) { - List downloadList = PlayModeHelper.GetDownloadListByPaths(ActiveManifest, assetInfos, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + List downloadList = PlayModeHelper.GetDownloadListByPaths(ActiveManifest, assetInfos, BuildinFileSystem, CacheFileSystem); var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout); return operation; } ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout) { - List unpcakList = PlayModeHelper.GetUnpackListByAll(ActiveManifest, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + List unpcakList = PlayModeHelper.GetUnpackListByAll(ActiveManifest, BuildinFileSystem, CacheFileSystem); var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain, timeout); return operation; } ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout) { - List unpcakList = PlayModeHelper.GetUnpackListByTags(ActiveManifest, tags, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + List unpcakList = PlayModeHelper.GetUnpackListByTags(ActiveManifest, tags, BuildinFileSystem, CacheFileSystem); var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain, timeout); return operation; } ResourceImporterOperation IPlayMode.CreateResourceImporterByFilePaths(string[] filePaths, int importerMaxNumber, int failedTryAgain, int timeout) { - List importerList = PlayModeHelper.GetImporterListByFilePaths(ActiveManifest, filePaths, BuildinFileSystem, DeliveryFileSystem, CacheFileSystem); + List importerList = PlayModeHelper.GetImporterListByFilePaths(ActiveManifest, filePaths, BuildinFileSystem, CacheFileSystem); var operation = new ResourceImporterOperation(PackageName, importerList, importerMaxNumber, failedTryAgain, timeout); return operation; } @@ -123,11 +119,6 @@ namespace YooAsset BundleInfo bundleInfo = new BundleInfo(BuildinFileSystem, packageBundle); return bundleInfo; } - if (DeliveryFileSystem != null && DeliveryFileSystem.Belong(packageBundle)) - { - BundleInfo bundleInfo = new BundleInfo(DeliveryFileSystem, packageBundle); - return bundleInfo; - } if (CacheFileSystem.Belong(packageBundle)) { BundleInfo bundleInfo = new BundleInfo(CacheFileSystem, packageBundle);