Compare commits

..

17 Commits

Author SHA1 Message Date
何冠峰
4b6a8ca406 Update CHANGELOG.md 2025-12-04 18:30:51 +08:00
何冠峰
c8e45a6cae Update package.json 2025-12-04 18:30:46 +08:00
何冠峰
1fbc9d26a6 style : 修改注释说明 2025-12-04 18:16:40 +08:00
何冠峰
abb087b02e fix #700 2025-12-03 10:14:55 +08:00
何冠峰
aeaf03011f Merge pull request #694 from fslse/ClearBundleFilesByLocations
ClearBundleFilesByLocations
2025-11-22 09:39:21 +08:00
DESKTOP-FIVME83\Administrator
78d24ad3a6 清理指定地址的文件
(cherry picked from commit 41a1973be8f11c1629b334238546556f54101c35)
2025-11-21 16:29:21 +08:00
何冠峰
aab2c4625e feat #671 2025-11-13 15:54:08 +08:00
何冠峰
079ef75605 feat #682 2025-11-13 11:51:28 +08:00
何冠峰
75881b55f6 fix #683 2025-11-12 18:41:17 +08:00
何冠峰
2020c7d508 Merge pull request #687 from OpenLBE/dev
Localize UI strings to English in editor windows
2025-11-12 09:58:46 +08:00
lark
088d939346 Localize UI strings to English in editor windows
Replaced Chinese UI strings with English equivalents in various editor windows and dialogs, including AssetArtReporter, AssetArtScanner, and AssetBundleBuilder viewers. This improves accessibility for non-Chinese users and standardizes the language across the editor tools.
2025-11-11 14:43:49 +08:00
何冠峰
fa50e91c9f fix #684 2025-11-07 16:37:26 +08:00
何冠峰
2e7b992a4b Merge branch 'dev' of https://github.com/tuyoogame/YooAsset into dev 2025-11-07 16:23:54 +08:00
何冠峰
29fbbd97ff fix #678 2025-11-07 16:23:51 +08:00
何冠峰
abb150e33f Merge pull request #676 from coffeeofnosugar/dev
修复UniTask的扩展包问题
2025-11-04 15:59:20 +08:00
coffee
78e20f434e 修复UniTask的扩展包问题
Unity版本: 2021.3.45f1
yooasset版本:2.3.17
少了一个下划线
2025-11-01 23:24:03 +08:00
何冠峰
304222b788 Update EditorDefine.cs 2025-10-31 17:03:27 +08:00
41 changed files with 441 additions and 69 deletions

View File

@@ -2,6 +2,57 @@
All notable changes to this package will be documented in this file.
## [2.3.18] - 2025-12-04
### Fixed
- (#676) 修复了UniTask扩展包的编译报错。
- (#684) 修复了资源配置窗口Group列表数量过多的时候添加和删除按钮会变小的问题。
- (#700) [**严重**] 修复了小游戏扩展库的下载器再失败后重试逻辑不起效的问题。
### Added
- (#683) 新增了内置文件系统类初始化参数UNPACK_FILE_SYSTEM_ROOT
```csharp
class FileSystemParametersDefine
{
// 指定解压文件的根目录
public const string UNPACK_FILE_SYSTEM_ROOT = "UNPACK_FILE_SYSTEM_ROOT";
}
```
- (#682) 原生文件构建管线新增构建参数IncludePathInHash
```csharp
class RawFileBuildParameters : BuildParameters
{
/// <summary>
/// 文件哈希值计算包含路径信息
/// </summary>
public bool IncludePathInHash = false;
}
```
- (#671) 新增扩展工具,可以生成空的包裹内置资源目录文件。
```csharp
public class CreateEmptyCatalogWindow : EditorWindow
```
- (#694) 新增资源清理方式ClearBundleFilesByLocations
```csharp
public enum EFileClearMode
{
/// <summary>
/// 清理指定地址的文件
/// 说明需要指定参数可选string, string[], List<string>
/// </summary>
ClearBundleFilesByLocations,
}
```
## [2.3.17] - 2025-10-30
**非常重要**:修复了#627优化导致的资源清单CRC值为空的问题。
@@ -16,10 +67,6 @@ All notable changes to this package will be documented in this file.
影响范围:所有版本!
### Improvements
- 重构并统一了资源清单的反序列化逻辑。
### Fixed
- (#645) 修复了着色器变种收集工具,在极端情况下变种收集不完整的问题。
@@ -29,6 +76,7 @@ All notable changes to this package will be documented in this file.
### Improvements
- 重构并统一了资源清单的反序列化逻辑。
- (#650) 解决互相依赖的资源包无法卸载的问题。需要开启宏定义YOOASSET_EXPERIMENTAL
- (#655) 优化了初始化的时候缓存文件搜索效率。安卓平台性能提升1倍IOS平台性能提升3倍。

View File

@@ -261,14 +261,14 @@ namespace YooAsset.Editor
catch (System.Exception e)
{
_reportCombiner = null;
_titleLabel.text = "导入报告失败!";
_titleLabel.text = "Failed to import report!";
_descLabel.text = e.Message;
UnityEngine.Debug.LogError(e.StackTrace);
}
}
private void FixAllBtn_clicked()
{
if (EditorUtility.DisplayDialog("提示", "修复全部资源(排除白名单和隐藏元素)", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", "Fix all resources (excluding whitelist and hidden elements)", "Yes", "No"))
{
if (_reportCombiner != null)
_reportCombiner.FixAll();
@@ -276,7 +276,7 @@ namespace YooAsset.Editor
}
private void FixSelectBtn_clicked()
{
if (EditorUtility.DisplayDialog("提示", "修复勾选资源(包含白名单和隐藏元素)", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", "Fix selected resources (including whitelist and hidden elements)", "Yes", "No"))
{
if (_reportCombiner != null)
_reportCombiner.FixSelect();
@@ -302,7 +302,7 @@ namespace YooAsset.Editor
}
private void ExportFilesBtn_clicked()
{
string selectFolderPath = EditorUtility.OpenFolderPanel("导入所有选中资源", EditorTools.GetProjectPath(), string.Empty);
string selectFolderPath = EditorUtility.OpenFolderPanel("Export all selected resources", EditorTools.GetProjectPath(), string.Empty);
if (string.IsNullOrEmpty(selectFolderPath) == false)
{
if (_reportCombiner != null)

View File

@@ -240,7 +240,7 @@ namespace YooAsset.Editor
}
private void ScanAllBtn_clicked()
{
if (EditorUtility.DisplayDialog("提示", $"开始全面扫描!", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", $"Start full scan!", "Yes", "No"))
{
string searchKeyWord = _scannerSearchField.value;
AssetArtScannerSettingData.ScanAll(searchKeyWord);
@@ -248,7 +248,7 @@ namespace YooAsset.Editor
}
else
{
Debug.LogWarning("全面扫描已经取消");
Debug.LogWarning("Full scan has been canceled.");
}
}
private void ScanBtn_clicked()

View File

@@ -44,9 +44,9 @@ namespace YooAsset.Editor
{
bundleInfo.PackageUnityHash = GetUnityHash(bundleInfo, context);
bundleInfo.PackageUnityCRC = GetUnityCRC(bundleInfo, context);
bundleInfo.PackageFileHash = GetBundleFileHash(bundleInfo, buildParametersContext);
bundleInfo.PackageFileCRC = GetBundleFileCRC(bundleInfo, buildParametersContext);
bundleInfo.PackageFileSize = GetBundleFileSize(bundleInfo, buildParametersContext);
bundleInfo.PackageFileHash = GetBundleFileHash(bundleInfo, context);
bundleInfo.PackageFileCRC = GetBundleFileCRC(bundleInfo, context);
bundleInfo.PackageFileSize = GetBundleFileSize(bundleInfo, context);
}
// 4.更新补丁包输出的文件路径
@@ -62,8 +62,8 @@ namespace YooAsset.Editor
protected abstract string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context);
protected abstract uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context);
protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
protected abstract uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildContext context);
protected abstract uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildContext context);
protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildContext context);
}
}

View File

@@ -40,17 +40,17 @@ namespace YooAsset.Editor
throw new Exception(message);
}
}
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileMD5(filePath);
}
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileCRC32Value(filePath);
}
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return FileUtility.GetFileSize(filePath);

View File

@@ -19,16 +19,16 @@ namespace YooAsset.Editor
{
return 0;
}
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return GetFilePathTempHash(filePath);
}
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildContext context)
{
return 0;
}
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildContext context)
{
return GetBundleTempSize(bundleInfo);
}

View File

@@ -15,27 +15,55 @@ namespace YooAsset.Editor
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileMD5(filePath);
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var rawFileBuildParameters = buildParametersContext.Parameters as RawFileBuildParameters;
if (rawFileBuildParameters.IncludePathInHash)
{
string filePath = bundleInfo.PackageSourceFilePath;
return GetFileMD5IncludePath(filePath);
}
else
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileMD5(filePath);
}
}
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
{
return 0;
}
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileMD5(filePath);
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var rawFileBuildParameters = buildParametersContext.Parameters as RawFileBuildParameters;
if (rawFileBuildParameters.IncludePathInHash)
{
string filePath = bundleInfo.PackageSourceFilePath;
return GetFileMD5IncludePath(filePath);
}
else
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileMD5(filePath);
}
}
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileCRC32Value(filePath);
}
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return FileUtility.GetFileSize(filePath);
}
private string GetFileMD5IncludePath(string filePath)
{
string pathHash = HashUtility.StringMD5(filePath.ToLowerInvariant());
string contentHash = HashUtility.FileMD5(filePath);
string combined = pathHash + contentHash;
return HashUtility.StringMD5(combined);
}
}
}

View File

@@ -6,5 +6,9 @@ namespace YooAsset.Editor
{
public class RawFileBuildParameters : BuildParameters
{
/// <summary>
/// 文件哈希值计算包含路径信息
/// </summary>
public bool IncludePathInHash = false;
}
}

View File

@@ -40,17 +40,17 @@ namespace YooAsset.Editor
throw new Exception(message);
}
}
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileMD5(filePath);
}
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return HashUtility.FileCRC32Value(filePath);
}
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildContext context)
{
string filePath = bundleInfo.PackageSourceFilePath;
return FileUtility.GetFileSize(filePath);

View File

@@ -82,14 +82,14 @@ namespace YooAsset.Editor
}
private void BuildButton_clicked()
{
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{PackageName}]", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", $"Start building resource package [{PackageName}]!", "Yes", "No"))
{
EditorTools.ClearUnityConsole();
EditorApplication.delayCall += ExecuteBuild;
}
else
{
Debug.LogWarning("[Build] 打包已经取消");
Debug.LogWarning("[Build] Packaging has been canceled.");
}
}

View File

@@ -42,14 +42,14 @@ namespace YooAsset.Editor
}
private void BuildButton_clicked()
{
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{PackageName}]", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", $"Start building resource package [{PackageName}]!", "Yes", "No"))
{
EditorTools.ClearUnityConsole();
EditorApplication.delayCall += ExecuteBuild;
}
else
{
Debug.LogWarning("[Build] 打包已经取消");
Debug.LogWarning("[Build] Packaging has been canceled.");
}
}

View File

@@ -77,14 +77,14 @@ namespace YooAsset.Editor
}
private void BuildButton_clicked()
{
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{PackageName}]", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", $"Start building resource package [{PackageName}]!", "Yes", "No"))
{
EditorTools.ClearUnityConsole();
EditorApplication.delayCall += ExecuteBuild;
}
else
{
Debug.LogWarning("[Build] 打包已经取消");
Debug.LogWarning("[Build] Packaging has been canceled.");
}
}

View File

@@ -82,14 +82,14 @@ namespace YooAsset.Editor
}
private void BuildButton_clicked()
{
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{PackageName}]", "Yes", "No"))
if (EditorUtility.DisplayDialog("Info", $"Start building resource package [{PackageName}]!", "Yes", "No"))
{
EditorTools.ClearUnityConsole();
EditorApplication.delayCall += ExecuteBuild;
}
else
{
Debug.LogWarning("[Build] 打包已经取消");
Debug.LogWarning("[Build] Packaging has been canceled.");
}
}

View File

@@ -30,7 +30,7 @@
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" />
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center; flex-shrink: 0;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
</ui:VisualElement>
@@ -40,7 +40,7 @@
<ui:TextField picking-mode="Ignore" label="Package Name" name="PackageName" style="flex-direction: column;" />
<ui:TextField picking-mode="Ignore" label="Package Desc" name="PackageDesc" style="flex-direction: column;" />
<ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" />
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center; flex-shrink: 0;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
</ui:VisualElement>

View File

@@ -88,8 +88,8 @@ namespace YooAsset.Editor
}
catch (Exception ex)
{
ClearDatabase(true);
Debug.LogError($"Failed to load cache database : {ex.Message}");
ClearDatabase(true);
}
finally
{
@@ -169,7 +169,8 @@ namespace YooAsset.Editor
File.Delete(_databaseFilePath);
}
_database.Clear();
if (_database != null)
_database.Clear();
}
/// <summary>

View File

@@ -41,6 +41,8 @@ namespace YooAsset.Editor
Texture,
RenderTexture,
VideoClip,
PlayableAsset,
TimelineAsset
}
/// <summary>

View File

@@ -118,6 +118,34 @@ namespace YooAsset
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
return true;
}
/// <summary>
/// 生成空的包裹内置资源目录文件
/// </summary>
public static bool CreateEmptyCatalogFile(string packageName, string packageVersion, string outputPath)
{
// 创建内置清单实例
var buildinFileCatalog = new DefaultBuildinFileCatalog();
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
buildinFileCatalog.PackageName = packageName;
buildinFileCatalog.PackageVersion = packageVersion;
// 创建输出文件
string jsonFilePath = $"{outputPath}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
if (File.Exists(jsonFilePath))
File.Delete(jsonFilePath);
SerializeToJson(jsonFilePath, buildinFileCatalog);
// 创建输出文件
string binaryFilePath = $"{outputPath}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
if (File.Exists(binaryFilePath))
File.Delete(binaryFilePath);
SerializeToBinary(binaryFilePath, buildinFileCatalog);
UnityEditor.AssetDatabase.Refresh();
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
return true;
}
#endif
/// <summary>

View File

@@ -89,6 +89,11 @@ namespace YooAsset
/// </summary>
public string CopyBuildinPackageManifestDestRoot { private set; get; }
/// <summary>
/// 自定义参数:解压文件系统的根目录
/// </summary>
public string UnpackFileSystemRoot { private set; get; }
/// <summary>
/// 自定义参数:解密服务接口的实例类
/// </summary>
@@ -190,6 +195,10 @@ namespace YooAsset
{
CopyBuildinPackageManifestDestRoot = (string)value;
}
else if (name == FileSystemParametersDefine.UNPACK_FILE_SYSTEM_ROOT)
{
UnpackFileSystemRoot = (string)value;
}
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
{
DecryptionServices = (IDecryptionServices)value;
@@ -226,7 +235,7 @@ namespace YooAsset
_unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES, CopyLocalFileServices);
_unpackFileSystem.OnCreate(packageName, null);
_unpackFileSystem.OnCreate(packageName, UnpackFileSystemRoot);
}
public virtual void OnDestroy()
{

View File

@@ -158,6 +158,11 @@ namespace YooAsset
var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest);
return operation;
}
else if (options.ClearMode == EFileClearMode.ClearBundleFilesByLocations.ToString())
{
var operation = new ClearCacheBundleFilesByLocationsOperaiton(this, manifest, options.ClearParam);
return operation;
}
else if (options.ClearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
{
var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, options.ClearParam);

View File

@@ -0,0 +1,142 @@
using System.Collections.Generic;
namespace YooAsset
{
internal class ClearCacheBundleFilesByLocationsOperaiton : FSClearCacheFilesOperation
{
private enum ESteps
{
None,
CheckManifest,
CheckArgs,
GetClearCacheFiles,
ClearFilterCacheFiles,
Done,
}
private readonly DefaultCacheFileSystem _fileSystem;
private readonly PackageManifest _manifest;
private readonly object _clearParam;
private string[] _locations;
private List<string> _clearBundleGUIDs;
private int _clearFileTotalCount = 0;
private ESteps _steps = ESteps.None;
internal ClearCacheBundleFilesByLocationsOperaiton(DefaultCacheFileSystem fileSystem, PackageManifest manifest, object clearParam)
{
_fileSystem = fileSystem;
_manifest = manifest;
_clearParam = clearParam;
}
internal override void InternalStart()
{
_steps = ESteps.CheckManifest;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.CheckManifest)
{
if (_manifest == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = "Can not found active package manifest !";
}
else
{
_steps = ESteps.CheckArgs;
}
}
if (_steps == ESteps.CheckArgs)
{
if (_clearParam == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = "Clear param is null !";
return;
}
if (_clearParam is string)
{
_locations = new string[] { _clearParam as string };
}
else if (_clearParam is List<string>)
{
var tempList = _clearParam as List<string>;
_locations = tempList.ToArray();
}
else if (_clearParam is string[])
{
_locations = _clearParam as string[];
}
else
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Invalid clear param : {_clearParam.GetType().FullName}";
return;
}
_steps = ESteps.GetClearCacheFiles;
}
if (_steps == ESteps.GetClearCacheFiles)
{
_clearBundleGUIDs = GetBundleGUIDsByLocation();
_clearFileTotalCount = _clearBundleGUIDs.Count;
_steps = ESteps.ClearFilterCacheFiles;
}
if (_steps == ESteps.ClearFilterCacheFiles)
{
for (int i = _clearBundleGUIDs.Count - 1; i >= 0; i--)
{
string bundleGUID = _clearBundleGUIDs[i];
_fileSystem.DeleteCacheBundleFile(bundleGUID);
_clearBundleGUIDs.RemoveAt(i);
if (OperationSystem.IsBusy)
break;
}
if (_clearFileTotalCount == 0)
Progress = 1.0f;
else
Progress = 1.0f - (_clearBundleGUIDs.Count / _clearFileTotalCount);
if (_clearBundleGUIDs.Count == 0)
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
}
}
private List<string> GetBundleGUIDsByLocation()
{
List<string> result = new List<string>(_locations.Length);
foreach (var location in _locations)
{
string assetPath = _manifest.TryMappingToAssetPath(location);
if (_manifest.TryGetPackageAsset(assetPath, out PackageAsset packageAsset))
{
PackageBundle bundle = _manifest.GetMainPackageBundle(packageAsset.BundleID);
if (bundle != null)
{
result.Add(bundle.BundleGUID);
}
}
}
return result;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0be6ffd570645bf4a95126958a8e8a86
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -20,7 +20,7 @@ namespace YooAsset
private UnityDownloadFileOperation _unityDownloadFileOp;
protected int _requestCount = 0;
protected float _tryAgainTimer;
protected float _tryAgainTimer = 0;
protected int _failedTryAgain;
private ESteps _steps = ESteps.None;

View File

@@ -20,7 +20,7 @@ namespace YooAsset
protected UnityVirtualBundleRequestOperation _unityDownloadFileOp;
protected int _requestCount = 0;
protected float _tryAgainTimer;
protected float _tryAgainTimer = 0;
protected int _failedTryAgain;
private ESteps _steps = ESteps.None;

View File

@@ -16,6 +16,12 @@ namespace YooAsset
/// </summary>
ClearUnusedBundleFiles,
/// <summary>
/// 清理指定地址的文件
/// 说明需要指定参数可选string, string[], List<string>
/// </summary>
ClearBundleFilesByLocations,
/// <summary>
/// 清理指定标签的文件
/// 说明需要指定参数可选string, string[], List<string>

View File

@@ -26,5 +26,6 @@ namespace YooAsset
public const string COPY_BUILDIN_PACKAGE_MANIFEST = "COPY_BUILDIN_PACKAGE_MANIFEST";
public const string COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT = "COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT";
public const string COPY_LOCAL_FILE_SERVICES = "COPY_LOCAL_FILE_SERVICES";
public const string UNPACK_FILE_SYSTEM_ROOT = "UNPACK_FILE_SYSTEM_ROOT";
}
}

View File

@@ -18,15 +18,16 @@ namespace YooAsset
private readonly IWebDecryptionServices _decryptionServices;
private UnityWebDataRequestOperation _unityWebDataRequestOp;
protected int _requestCount = 0;
protected float _tryAgainTimer;
protected int _failedTryAgain;
private int _requestCount = 0;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
internal LoadWebEncryptAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, IWebDecryptionServices decryptionServices)
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
_decryptionServices = decryptionServices;
}
internal override void InternalStart()

View File

@@ -18,9 +18,9 @@ namespace YooAsset
private readonly bool _disableUnityWebCache;
private UnityAssetBundleRequestOperation _unityAssetBundleRequestOp;
protected int _requestCount = 0;
protected float _tryAgainTimer;
protected int _failedTryAgain;
private int _requestCount = 0;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
_disableUnityWebCache = disableUnityWebCache;
}
internal override void InternalStart()

View File

@@ -0,0 +1,62 @@
using System.IO;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
namespace YooAsset.Editor
{
public class CreateEmptyCatalogWindow : EditorWindow
{
static CreateEmptyCatalogWindow _thisInstance;
[MenuItem("Tools/空清单生成工具Catalog", false, 102)]
static void ShowWindow()
{
if (_thisInstance == null)
{
_thisInstance = EditorWindow.GetWindow(typeof(CreateEmptyCatalogWindow), false, "空清单生成工具", true) as CreateEmptyCatalogWindow;
_thisInstance.minSize = new Vector2(800, 600);
}
_thisInstance.Show();
}
private string _packageName = string.Empty;
private void OnGUI()
{
GUILayout.Space(10);
EditorGUILayout.BeginHorizontal();
_packageName = EditorGUILayout.TextField("Package Name", _packageName);
EditorGUILayout.EndHorizontal();
if (string.IsNullOrEmpty(_packageName) == false)
{
if (GUILayout.Button("生成空的Catalog文件", GUILayout.MaxWidth(150)))
{
string outputPath = EditorTools.OpenFolderPanel("输出目录", "Assets/");
if (string.IsNullOrEmpty(outputPath) == false)
{
CreateEmptyCatalogFile(outputPath);
}
}
}
}
private void CreateEmptyCatalogFile(string outputPath)
{
try
{
bool result = CatalogTools.CreateEmptyCatalogFile(_packageName, string.Empty, outputPath);
if (result == false)
{
Debug.LogError($"Create package {_packageName} catalog file failed ! See the detail error in console !");
}
}
catch (System.Exception ex)
{
Debug.LogError($"Create package {_packageName} catalog file failed ! {ex.Message}");
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 211aadfc630b2ec419d5efce05e8aabe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -10,7 +10,7 @@ namespace YooAsset.Editor
{
static PackageComparatorWindow _thisInstance;
[MenuItem("Tools/补丁包比对工具", false, 102)]
[MenuItem("Tools/补丁包比对工具", false, 103)]
static void ShowWindow()
{
if (_thisInstance == null)

View File

@@ -8,7 +8,7 @@ namespace YooAsset.Editor
{
static PackageImporterWindow _thisInstance;
[MenuItem("Tools/补丁包导入工具", false, 101)]
[MenuItem("Tools/补丁包导入工具", false, 104)]
static void ShowWindow()
{
if (_thisInstance == null)

View File

@@ -16,8 +16,9 @@ internal class APFSDownloadFileOperation : FSDownloadFileOperation
private readonly AlipayFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class APFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -20,7 +20,7 @@ namespace YooAsset
private UnityAlipayAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -29,6 +29,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -16,8 +16,9 @@ internal class TPFSDownloadFileOperation : FSDownloadFileOperation
private readonly TaptapFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class TPFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -19,7 +19,7 @@ namespace YooAsset
private UnityTaptapAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -16,8 +16,9 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
private readonly TiktokFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -19,7 +19,7 @@ namespace YooAsset
private UnityTiktokAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -16,8 +16,9 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
private readonly WechatFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -19,7 +19,7 @@ namespace YooAsset
private UnityWechatAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -94,19 +94,19 @@ namespace Cysharp.Threading.Tasks
switch (handle)
{
case AssetHandle asset_handle:
asset_handle.Completed += result.continuationAction;
asset_handle.Completed += result._continuationAction;
break;
case SceneHandle scene_handle:
scene_handle.Completed += result.continuationAction;
scene_handle.Completed += result._continuationAction;
break;
case SubAssetsHandle sub_asset_handle:
sub_asset_handle.Completed += result.continuationAction;
sub_asset_handle.Completed += result._continuationAction;
break;
case RawFileHandle raw_file_handle:
raw_file_handle.Completed += result.continuationAction;
raw_file_handle.Completed += result._continuationAction;
break;
case AllAssetsHandle all_assets_handle:
all_assets_handle.Completed += result.continuationAction;
all_assets_handle.Completed += result._continuationAction;
break;
}
#endif

View File

@@ -1,7 +1,7 @@
{
"name": "com.tuyoogame.yooasset",
"displayName": "YooAsset",
"version": "2.3.17",
"version": "2.3.18",
"unity": "2019.4",
"description": "unity3d resources management system.",
"author": {