feat : builtin file system can be empty in host play mode.

HostPlayMode模式下内置文件系统可以为空。
pull/342/head
何冠峰 2024-08-12 19:10:57 +08:00
parent b7b375092f
commit 79ac231df2
4 changed files with 34 additions and 19 deletions

View File

@ -45,6 +45,12 @@ namespace YooAsset
if (_steps == ESteps.ClearFileSystemA)
{
if (_fileSystemA == null)
{
_steps = ESteps.ClearFileSystemB;
return;
}
if (_clearAllBundleFilesOpA == null)
_clearAllBundleFilesOpA = _fileSystemA.ClearAllBundleFilesAsync();

View File

@ -45,6 +45,12 @@ namespace YooAsset
if (_steps == ESteps.ClearFileSystemA)
{
if (_fileSystemA == null)
{
_steps = ESteps.ClearFileSystemB;
return;
}
if (_clearUnusedBundleFilesOpA == null)
_clearUnusedBundleFilesOpA = _fileSystemA.ClearUnusedBundleFilesAsync(_impl.ActiveManifest);

View File

@ -201,14 +201,6 @@ namespace YooAsset
if (_steps == ESteps.CreateFileSystem)
{
if (_parameters.BuildinFileSystemParameters == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = "Buildin file system parameters is null";
return;
}
if (_parameters.CacheFileSystemParameters == null)
{
_steps = ESteps.Done;
@ -217,6 +209,19 @@ 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;
}
return;
}
if (_parameters.DeliveryFileSystemParameters != null)
{
_impl.DeliveryFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.DeliveryFileSystemParameters);
@ -229,15 +234,6 @@ namespace YooAsset
}
}
_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;
}
_impl.CacheFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.CacheFileSystemParameters);
if (_impl.CacheFileSystem == null)
{
@ -252,6 +248,13 @@ namespace YooAsset
if (_steps == ESteps.InitBuildinFileSystem)
{
// 注意:内置文件系统可以为空
if (_impl.BuildinFileSystem == null)
{
_steps = ESteps.InitDeliveryFileSystem;
return;
}
if (_initBuildinFileSystemOp == null)
_initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();

View File

@ -7,7 +7,7 @@ namespace YooAsset
internal class HostPlayModeImpl : IPlayMode, IBundleQuery
{
public readonly string PackageName;
public IFileSystem BuildinFileSystem { set; get; }
public IFileSystem BuildinFileSystem { set; get; } //可以为空!
public IFileSystem DeliveryFileSystem { set; get; } //可以为空!
public IFileSystem CacheFileSystem { set; get; }
@ -118,7 +118,7 @@ namespace YooAsset
if (packageBundle == null)
throw new Exception("Should never get here !");
if (BuildinFileSystem.Belong(packageBundle))
if (BuildinFileSystem != null && BuildinFileSystem.Belong(packageBundle))
{
BundleInfo bundleInfo = new BundleInfo(BuildinFileSystem, packageBundle);
return bundleInfo;