mirror of https://github.com/tuyoogame/YooAsset
parent
3f786bca3b
commit
cf05254121
|
@ -58,6 +58,11 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public EFileVerifyLevel FileVerifyLevel { private set; get; } = EFileVerifyLevel.Middle;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:覆盖安装缓存清理模式
|
||||
/// </summary>
|
||||
public EOverwriteInstallClearMode InstallClearMode { private set; get; } = EOverwriteInstallClearMode.ClearAllManifestFiles;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:数据文件追加文件格式
|
||||
/// </summary>
|
||||
|
@ -145,6 +150,10 @@ namespace YooAsset
|
|||
{
|
||||
FileVerifyLevel = (EFileVerifyLevel)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.INSTALL_CLEAR_MODE)
|
||||
{
|
||||
InstallClearMode = (EOverwriteInstallClearMode)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
|
||||
{
|
||||
AppendFileExtension = Convert.ToBoolean(value);
|
||||
|
@ -184,6 +193,7 @@ namespace YooAsset
|
|||
_unpackFileSystem = new DefaultUnpackFileSystem();
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.FILE_VERIFY_LEVEL, FileVerifyLevel);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.INSTALL_CLEAR_MODE, InstallClearMode);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
|
||||
_unpackFileSystem.OnCreate(packageName, null);
|
||||
|
|
|
@ -65,6 +65,11 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public EFileVerifyLevel FileVerifyLevel { private set; get; } = EFileVerifyLevel.Middle;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:覆盖安装缓存清理模式
|
||||
/// </summary>
|
||||
public EOverwriteInstallClearMode InstallClearMode { private set; get; } = EOverwriteInstallClearMode.ClearAllManifestFiles;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:数据文件追加文件格式
|
||||
/// </summary>
|
||||
|
@ -188,6 +193,10 @@ namespace YooAsset
|
|||
{
|
||||
FileVerifyLevel = (EFileVerifyLevel)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.INSTALL_CLEAR_MODE)
|
||||
{
|
||||
InstallClearMode = (EOverwriteInstallClearMode)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
|
||||
{
|
||||
AppendFileExtension = Convert.ToBoolean(value);
|
||||
|
@ -227,8 +236,8 @@ namespace YooAsset
|
|||
_packageRoot = packageRoot;
|
||||
|
||||
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.BundleFilesFolderName);
|
||||
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
|
||||
_cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
|
||||
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
|
||||
}
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
|
@ -500,7 +509,18 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除所有清单文件
|
||||
/// 删除所有缓存的资源文件
|
||||
/// </summary>
|
||||
public void DeleteAllBundleFiles()
|
||||
{
|
||||
if (Directory.Exists(_cacheBundleFilesRoot))
|
||||
{
|
||||
Directory.Delete(_cacheBundleFilesRoot, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除所有缓存的清单文件
|
||||
/// </summary>
|
||||
public void DeleteAllManifestFiles()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 覆盖安装清理模式
|
||||
/// </summary>
|
||||
public enum EOverwriteInstallClearMode
|
||||
{
|
||||
/// <summary>
|
||||
/// 不做任何处理
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有缓存文件(包含资源文件和清单文件)
|
||||
/// </summary>
|
||||
ClearAllCacheFiles = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有缓存的资源文件
|
||||
/// </summary>
|
||||
ClearAllBundleFiles = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有缓存的清单文件
|
||||
/// </summary>
|
||||
ClearAllManifestFiles = 3,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c61fdc079dca97548a0158b8100ec258
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -46,9 +46,32 @@ namespace YooAsset
|
|||
// 如果水印发生变化,则说明覆盖安装后首次打开游戏
|
||||
if (appFootPrint.IsDirty())
|
||||
{
|
||||
_fileSystem.DeleteAllManifestFiles();
|
||||
if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.None)
|
||||
{
|
||||
YooLogger.Warning("Do nothing when overwrite install application !");
|
||||
}
|
||||
else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllCacheFiles)
|
||||
{
|
||||
_fileSystem.DeleteAllBundleFiles();
|
||||
_fileSystem.DeleteAllManifestFiles();
|
||||
YooLogger.Warning("Delete all cache files when overwrite install application !");
|
||||
}
|
||||
else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllBundleFiles)
|
||||
{
|
||||
_fileSystem.DeleteAllBundleFiles();
|
||||
YooLogger.Warning("Delete all bundle files when overwrite install application !");
|
||||
}
|
||||
else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllManifestFiles)
|
||||
{
|
||||
_fileSystem.DeleteAllManifestFiles();
|
||||
YooLogger.Warning("Delete all manifest files when overwrite install application !");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.NotImplementedException(_fileSystem.InstallClearMode.ToString());
|
||||
}
|
||||
|
||||
appFootPrint.Coverage(_fileSystem.PackageName);
|
||||
YooLogger.Warning("Delete manifest files when application foot print dirty !");
|
||||
}
|
||||
|
||||
_steps = ESteps.SearchCacheFiles;
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace YooAsset
|
|||
base.OnCreate(packageName, rootDirectory);
|
||||
|
||||
// 注意:重写保存根目录和临时目录
|
||||
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveFilesFolderName);
|
||||
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveBundleFilesFolderName);
|
||||
_cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveManifestFilesFolderName);
|
||||
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.TempFilesFolderName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,13 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 保存的资源文件的文件夹名称
|
||||
/// </summary>
|
||||
public const string SaveFilesFolderName = "UnpackFiles";
|
||||
|
||||
public const string SaveBundleFilesFolderName = "UnpackBundleFiles";
|
||||
|
||||
/// <summary>
|
||||
/// 保存的清单文件的文件夹名称
|
||||
/// </summary>
|
||||
public const string SaveManifestFilesFolderName = "UnpackManifestFiles";
|
||||
|
||||
/// <summary>
|
||||
/// 下载的临时文件的文件夹名称
|
||||
/// </summary>
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace YooAsset
|
|||
public class FileSystemParametersDefine
|
||||
{
|
||||
public const string FILE_VERIFY_LEVEL = "FILE_VERIFY_LEVEL";
|
||||
public const string INSTALL_CLEAR_MODE = "INSTALL_CLEAR_MODE";
|
||||
public const string REMOTE_SERVICES = "REMOTE_SERVICES";
|
||||
public const string DECRYPTION_SERVICES = "DECRYPTION_SERVICES";
|
||||
public const string APPEND_FILE_EXTENSION = "APPEND_FILE_EXTENSION";
|
||||
|
|
Loading…
Reference in New Issue