mirror of https://github.com/tuyoogame/YooAsset
feat : builtin file system can be empty in host play mode.
HostPlayMode模式下内置文件系统可以为空。pull/342/head
parent
b7b375092f
commit
79ac231df2
|
@ -45,6 +45,12 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.ClearFileSystemA)
|
if (_steps == ESteps.ClearFileSystemA)
|
||||||
{
|
{
|
||||||
|
if (_fileSystemA == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.ClearFileSystemB;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_clearAllBundleFilesOpA == null)
|
if (_clearAllBundleFilesOpA == null)
|
||||||
_clearAllBundleFilesOpA = _fileSystemA.ClearAllBundleFilesAsync();
|
_clearAllBundleFilesOpA = _fileSystemA.ClearAllBundleFilesAsync();
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,12 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.ClearFileSystemA)
|
if (_steps == ESteps.ClearFileSystemA)
|
||||||
{
|
{
|
||||||
|
if (_fileSystemA == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.ClearFileSystemB;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_clearUnusedBundleFilesOpA == null)
|
if (_clearUnusedBundleFilesOpA == null)
|
||||||
_clearUnusedBundleFilesOpA = _fileSystemA.ClearUnusedBundleFilesAsync(_impl.ActiveManifest);
|
_clearUnusedBundleFilesOpA = _fileSystemA.ClearUnusedBundleFilesAsync(_impl.ActiveManifest);
|
||||||
|
|
||||||
|
|
|
@ -201,14 +201,6 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.CreateFileSystem)
|
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)
|
if (_parameters.CacheFileSystemParameters == null)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
@ -217,6 +209,19 @@ namespace YooAsset
|
||||||
return;
|
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)
|
if (_parameters.DeliveryFileSystemParameters != null)
|
||||||
{
|
{
|
||||||
_impl.DeliveryFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.DeliveryFileSystemParameters);
|
_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);
|
_impl.CacheFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.CacheFileSystemParameters);
|
||||||
if (_impl.CacheFileSystem == null)
|
if (_impl.CacheFileSystem == null)
|
||||||
{
|
{
|
||||||
|
@ -252,6 +248,13 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.InitBuildinFileSystem)
|
if (_steps == ESteps.InitBuildinFileSystem)
|
||||||
{
|
{
|
||||||
|
// 注意:内置文件系统可以为空
|
||||||
|
if (_impl.BuildinFileSystem == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.InitDeliveryFileSystem;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_initBuildinFileSystemOp == null)
|
if (_initBuildinFileSystemOp == null)
|
||||||
_initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
|
_initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace YooAsset
|
||||||
internal class HostPlayModeImpl : IPlayMode, IBundleQuery
|
internal class HostPlayModeImpl : IPlayMode, IBundleQuery
|
||||||
{
|
{
|
||||||
public readonly string PackageName;
|
public readonly string PackageName;
|
||||||
public IFileSystem BuildinFileSystem { set; get; }
|
public IFileSystem BuildinFileSystem { set; get; } //可以为空!
|
||||||
public IFileSystem DeliveryFileSystem { set; get; } //可以为空!
|
public IFileSystem DeliveryFileSystem { set; get; } //可以为空!
|
||||||
public IFileSystem CacheFileSystem { set; get; }
|
public IFileSystem CacheFileSystem { set; get; }
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ namespace YooAsset
|
||||||
if (packageBundle == null)
|
if (packageBundle == null)
|
||||||
throw new Exception("Should never get here !");
|
throw new Exception("Should never get here !");
|
||||||
|
|
||||||
if (BuildinFileSystem.Belong(packageBundle))
|
if (BuildinFileSystem != null && BuildinFileSystem.Belong(packageBundle))
|
||||||
{
|
{
|
||||||
BundleInfo bundleInfo = new BundleInfo(BuildinFileSystem, packageBundle);
|
BundleInfo bundleInfo = new BundleInfo(BuildinFileSystem, packageBundle);
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
|
|
Loading…
Reference in New Issue