更新YooAsset HybridCLR

This commit is contained in:
2025-10-25 17:23:15 +08:00
parent 30d0d40a52
commit d4f18c8787
139 changed files with 685 additions and 3149 deletions

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 73ef838ec60c36249ba05eaa3c96273e
guid: b1774501eb8484d47b6c9d61585b4cd4
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,25 @@
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
internal class ClearBuildCacheWindow
{
[MenuItem("Tools/Clear Build Cache", false, 2)]
public static void OpenWindow()
{
// 清空SBP构建缓存
UnityEditor.Build.Pipeline.Utilities.BuildCache.PurgeCache(false);
// 删除AssetDependDB文件
string projectPath = YooAsset.Editor.EditorTools.GetProjectPath();
string databaseFilePath = $"{projectPath}/Library/AssetDependencyDB";
if (File.Exists(databaseFilePath))
{
File.Delete(databaseFilePath);
}
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f450f29c62aedae4390edc923f71811d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
using System.IO;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
namespace YooAsset.Editor
{
public class CreateBuildinCatalogWindow : EditorWindow
{
static CreateBuildinCatalogWindow _thisInstance;
[MenuItem("Tools/内置清单生成工具Catalog", false, 101)]
static void ShowWindow()
{
if (_thisInstance == null)
{
_thisInstance = EditorWindow.GetWindow(typeof(CreateBuildinCatalogWindow), false, "内置清单生成工具", true) as CreateBuildinCatalogWindow;
_thisInstance.minSize = new Vector2(800, 600);
}
_thisInstance.Show();
}
private string _directoryRoot = string.Empty;
private void OnGUI()
{
GUILayout.Space(10);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("选择内置资源目录", GUILayout.MaxWidth(150)))
{
string resultPath = EditorUtility.OpenFolderPanel("Find", "Assets/", "StreamingAssets");
if (!string.IsNullOrEmpty(resultPath))
_directoryRoot = resultPath;
}
EditorGUILayout.LabelField(_directoryRoot);
EditorGUILayout.EndHorizontal();
if (string.IsNullOrEmpty(_directoryRoot) == false)
{
if (GUILayout.Button("生成Catalog文件", GUILayout.MaxWidth(150)))
{
CreateCatalogFile(_directoryRoot);
}
}
}
private void CreateCatalogFile(string directoryRoot)
{
// 搜索所有Package目录
List<string> packageRoots = GetPackageRoots(directoryRoot);
foreach (var packageRoot in packageRoots)
{
DirectoryInfo directoryInfo = new DirectoryInfo(packageRoot);
string packageName = directoryInfo.Name;
try
{
bool result = CatalogTools.CreateCatalogFile(null, packageName, packageRoot); //TODO 自行处理解密
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}");
}
}
}
private List<string> GetPackageRoots(string rootPath)
{
// 检查目录是否存在
if (Directory.Exists(rootPath) == false)
{
throw new DirectoryNotFoundException($"目录不存在: {rootPath}");
}
// 搜索所有 .version 文件(包含子目录)
string[] versionFiles = Directory.GetFiles(
rootPath,
"*.version",
SearchOption.AllDirectories
);
// 提取文件所在目录路径并去重
return versionFiles
.Select(file => Path.GetDirectoryName(file))
.Distinct()
.ToList();
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e8f5ca9e913008d4988fe0f4a2f4a443
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
using YooAsset.Editor;
[BuildPipelineAttribute("CustomBuildPipeline")]
internal class CustomBuildPipelineViewer : BuiltinBuildPipelineViewer
{
protected override string GetDefaultPackageVersion()
{
return "v1.0.0";
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 103e9c32154c7724a85a89b54576d2c2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 73aae15a0e1aec742a7e8f05755a2013
guid: 58b8635bcecc5b44dad501fff5dbf8c1
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ff1eb84d9996ca1409e37f45617b1bdb
guid: ded28d0056e4afe46a0ce446de51617b
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c0b4ccec8007a6047aade899b4b74fcf
guid: 1862925d68796e84d8dd0a39a85e89df
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -106,11 +106,11 @@ namespace YooAsset.Editor
// 加载补丁清单1
byte[] bytesData1 = FileUtility.ReadAllBytes(_manifestPath1);
PackageManifest manifest1 = ManifestTools.DeserializeFromBinary(bytesData1);
PackageManifest manifest1 = ManifestTools.DeserializeFromBinary(bytesData1, null); //TODO 自行处理解密
// 加载补丁清单1
byte[] bytesData2 = FileUtility.ReadAllBytes(_manifestPath2);
PackageManifest manifest2 = ManifestTools.DeserializeFromBinary(bytesData2);
PackageManifest manifest2 = ManifestTools.DeserializeFromBinary(bytesData2, null); //TODO 自行处理解密
// 拷贝文件列表
foreach (var bundle2 in manifest2.BundleList)

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6ff3c700b7f108b48998aa1630a769e1
guid: e2beaa5e8aad3e0439f058dc9fe34be5
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fa6624433c5d8e445b1426dcdf0763ba
guid: afb453c8615ab124ebd40d8900ac3903
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -71,7 +71,7 @@ namespace YooAsset.Editor
// 加载补丁清单
byte[] bytesData = FileUtility.ReadAllBytes(manifestFilePath);
PackageManifest manifest = ManifestTools.DeserializeFromBinary(bytesData);
PackageManifest manifest = ManifestTools.DeserializeFromBinary(bytesData, null); //TODO 自行处理解密
// 拷贝文件列表
int fileCount = 0;

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 699068f8f637708409436199baa62c1f
guid: 25b53e0405c55694c901623ee9cb0d1a
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 36626e333f5e25c4581bc91db0189714
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace YooAsset
{
public class PreprocessBuildCatalog : UnityEditor.Build.IPreprocessBuildWithReport
{
public int callbackOrder { get { return 0; } }
/// <summary>
/// 在构建应用程序前自动生成内置资源目录文件。
/// 原理搜索StreamingAssets目录下的所有资源文件将这些文件信息写入文件然后在运行时做查询用途。
/// </summary>
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
{
YooLogger.Log("Begin to create catalog file !");
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
if (rootDirectory.Exists == false)
{
Debug.LogWarning($"Can not found StreamingAssets root directory : {rootPath}");
return;
}
// 搜索所有Package目录
DirectoryInfo[] subDirectories = rootDirectory.GetDirectories();
foreach (var subDirectory in subDirectories)
{
string packageName = subDirectory.Name;
string pacakgeDirectory = subDirectory.FullName;
try
{
bool result = CatalogTools.CreateCatalogFile(null, packageName, pacakgeDirectory); //TODO 自行处理解密
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: 6b5abe115ebfe1344b674db78b2edf6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dcb9955c15609744a9666bd76f6af3d9
guid: a0be37da2654700439f6ac33bcd9e2e9
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ab74d4ff4a2805147883de70a1559a0a
guid: 018667dae4e4d9c4bb5cee34bae3d761
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 97098b04691f5c046ac4829f1d72f425
guid: 2727e0805ce46af45a0756651ff52023
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 21b4cc6bf4c0c064d8e2687024e24c86
guid: e1fa8fc528c12e9408f1b848e3761488
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 44454e58a49818040a1aef5799e71b30
guid: 5210230009c62ab4f8871c7961691bbe
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 70401cc80b9807e46bd8283e01b4302f
guid: b74ce9bc5de5759458cc946d59ddb614
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9bff4878063eaf04dab8713e1e662ac5
guid: 2766d66d18232984aad17caf2fcd6397
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}