diff --git a/.gitignore b/.gitignore index b64d3326..d3b88754 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ UnityProject/Build/* UnityProject/HotUpdateScripts/.idea/* UnityProject/Assets/JEngine.proj UnityProject/Assets/JEngine.proj.meta +/UnityProject/Host +/UnityProject/yoo +/UnityProject/UserSettings/Layouts diff --git a/README.md b/README.md index 65ffcbbf..d14a7307 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@

-# JENGINE v0.8.0f7 +# JENGINE v1.0 dev ![Alt](https://repobeats.axiom.co/api/embed/d085b73402ea8b3e88deb98cb4074afd95528c0d.svg "Repobeats analytics image") @@ -51,7 +51,7 @@ The ``development`` branch is the development branch. You are welcome to make ch ## Requirement -- **Unity 2020.3.4+** +- **Unity 2021.3.2+** - .net framework 4.x / .net 4.x / net framework ## Packages @@ -74,7 +74,7 @@ Different built-in and additional packages for JEngine ## Dependencies - [ILRuntime](https://github.com/Ourpalm/ILRuntime) v2.1.0 - execute C# code in runtime -- [YooAssets](https://github.com/tuyoogame/YooAsset) v1.4.10 - update resource in runtime +- [YooAssets](https://github.com/tuyoogame/YooAsset) v2.1.2 - update resource in runtime - [Unity-Reorderable-List](https://github.com/cfoulston/Unity-Reorderable-List) v1.0.1 - additional editor inspector tool @@ -91,24 +91,12 @@ Different built-in and additional packages for JEngine -## v0.8.0 New Features - -- **Supported** WebGL -- **Removed** JUI (will be redesigned shortly) -- **Optimized** LifeCycleMgr performance -- **Optimized** ThreadMgr features -- **Optimized** JStream performance -- **Optimized** JBehaviour performance -- **Optimized** MonoBehaviour performance -- **Optimized** FpsMonitor performance -- **Optimized** CryptoMgr interfaces -- **Optimized** JBehaviour/ClassBind Object/MonoBehaviour GC -- **Optimized** GetComponent(s)/FindObject(s)OfType performance -- **Switched** to YooAsset for asset management module (instead of Bundle Master) -- **NEW FEATURE** UnsafeMgr which provides unsafe (use for optimization) features -- **NEW FEATURE** UnmanagedMemoryPool which supports allocating unmanaged memory with pooling -- **NEW FEATURE** CoroutineMgr which supports executing/stopping coroutines from non-MonoBehaviour class -- **NEW STRUCTURE** Split JEngine source code to multiple packages +## v0.1.0 New Features + +- Support **Hot Update Resource Encryption** +- Significantly optimised **Hot Update Code Dynamic Decryption Performance** +- Significantly optimised **Hot Update Code Launch Speed** +- Optimised **Hot Update Code File Watcher Performance in Editor Mode** [Click here to see the change log](CHANGE.md) diff --git a/README_zh_cn.md b/README_zh_cn.md index 361e9a1a..5aa53d02 100644 --- a/README_zh_cn.md +++ b/README_zh_cn.md @@ -30,7 +30,7 @@ -# JENGINE v0.8.0f7 +# JENGINE v1.0 开发版 JEngine是针对Unity开发者设计的**开箱即用**的框架,封装了强大的功能,小白也能**快速上手**,**轻松制作**可以**热更新的游戏** @@ -70,7 +70,7 @@ JEngine是针对Unity开发者设计的**开箱即用**的框架,封装了强 ## 使用要求 -- **Unity 2020.3.4+** +- **Unity 2021.3.2+** - .net framework 4.x / .net 4.x / net framework ## 功能包 @@ -93,7 +93,7 @@ JEngine不同的自带和额外的功能包 ## 依赖项目 - [ILRuntime](https://github.com/Ourpalm/ILRuntime) v2.1.0 - 运行时执行C#代码 -- [YooAssets](https://github.com/tuyoogame/YooAsset) v1.4.10 - 运行时更新资源 +- [YooAssets](https://github.com/tuyoogame/YooAsset) v2.1.2 - 运行时更新资源 - [Unity-Reorderable-List](https://github.com/cfoulston/Unity-Reorderable-List) v1.0.1 - 额外编辑器控件 @@ -127,39 +127,15 @@ JEngine不同的自带和额外的功能包 -## v0.8.0 最新功能 +## v0.1.0 最新功能 -- **支持** WebGL +- 支持**热更资源加密** -- **移除** JUI(过段时间会重构) +- 大幅优化**热更代码动态解密性能** -- **优化** LifeCycleMgr 性能 +- 大幅优化**热更代码启动速度** -- **优化** ThreadMgr 功能 - -- **优化** JStream 性能 - -- **优化** JBehaviour 性能 - -- **优化** MonoBehaviour 性能 - -- **优化** FpsMonitor 性能 - -- **优化** CryptoMgr 接口 - -- **优化** JBehaviour/ClassBind Object/MonoBehaviour GC - -- **优化** GetComponent(s)/FindObject(s)OfType 性能 - -- **切换** 到 YooAsset作为热更资源管理 (弃用Bundle Master) - -- **新功能** UnsafeMgr 提供不安全(用于性能优化)功能 - -- **新功能** UnmanagedMemoryPool 提供非托管内存池功能 - -- **新功能** CoroutineMgr提供在非MonoBehaviour类型内使用携程的功能 - -- **新架构** 将JEngine源码分成不同的模块,核心代码更轻量! +- 优化**编辑器下监听热更代码变动性能** [点击此处查看历史版本功能(英文)](CHANGE.md) diff --git a/UnityProject/Assembly-CSharp-Editor.csproj.DotSettings b/UnityProject/Assembly-CSharp-Editor.csproj.DotSettings index 12b2aba1..bfeb2a26 100644 --- a/UnityProject/Assembly-CSharp-Editor.csproj.DotSettings +++ b/UnityProject/Assembly-CSharp-Editor.csproj.DotSettings @@ -1,3 +1,6 @@  + True True + True + True True \ No newline at end of file diff --git a/UnityProject/Assembly-CSharp.csproj.DotSettings b/UnityProject/Assembly-CSharp.csproj.DotSettings index 26e51b22..2295314b 100644 --- a/UnityProject/Assembly-CSharp.csproj.DotSettings +++ b/UnityProject/Assembly-CSharp.csproj.DotSettings @@ -1,4 +1,5 @@  + True True True True diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterAdaptors.cs b/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterAdaptors.cs deleted file mode 100644 index 56cab35e..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterAdaptors.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using ILRuntime.Runtime.Enviorment; -using AppDomain = ILRuntime.Runtime.Enviorment.AppDomain; - -namespace JEngine.Core -{ - public class RegisterAdaptors : IRegisterHelper - { - public void Register(AppDomain appdomain) - { - //自动注册一波,无需再手动添加了,如果想要性能也可以手动自己加 - var assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); - var ilRuntimeAssembly = typeof(AppDomain).Assembly; - var crossBindingAdaptorType = typeof(CrossBindingAdaptor); - //全部程序集 - foreach (var assembly in assemblies) - { - //跳过ILRuntime的程序集 - if (assembly == ilRuntimeAssembly) continue; - var types = assembly.GetTypes(); - //全部类型 - foreach (var type in types) - { - if (type.IsSubclassOf(crossBindingAdaptorType)) - { - object obj = Activator.CreateInstance(type); - CrossBindingAdaptor adaptor = obj as CrossBindingAdaptor; - if (adaptor == null) - { - continue; - } - - try - { - appdomain.RegisterCrossBindingAdaptor(adaptor); - } - catch - { - //ignore - } - } - } - } - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterAdaptors.cs.meta b/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterAdaptors.cs.meta deleted file mode 100644 index 563c8332..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterAdaptors.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 0e6b6a55d1d54ac0ba3f3c7abafd2630 -timeCreated: 1664708217 \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs index e715283d..5e6471de 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs @@ -76,13 +76,15 @@ public static string GetPlatform /// /// 初始化资源包 /// - /// - private static async Task SetUpPackage(string packageName) + /// 包名 + /// 默认管线 + /// 是否加密 + private static async Task SetUpPackage(string packageName, EDefaultBuildPipeline pipeline, bool encrypted) { string resourceUrl = Updater.ResourceUrl; string fallbackUrl = Updater.FallbackUrl; // 更新URL - string end = $"/{GetPlatform}/{packageName}"; + string end = $"/{GetPlatform}/{packageName}/"; if (!resourceUrl.EndsWith(end)) resourceUrl = $"{resourceUrl}{end}"; if (!fallbackUrl.EndsWith(end)) fallbackUrl = $"{fallbackUrl}{end}"; // 创建默认的资源包 @@ -99,18 +101,28 @@ private static async Task SetUpPackage(string packageName) } // 初始化 + var decryptionServices = encrypted ? new FileOffsetDecryption() : null; InitializeParameters initParameters = Updater.Mode switch { UpdateMode.Simulate => new EditorSimulateModeParameters() { - SimulateManifestFilePath = EditorSimulateModeHelper.SimulateBuild(packageName) + SimulateManifestFilePath = EditorSimulateModeHelper.SimulateBuild( + pipeline, packageName) + }, + UpdateMode.Standalone => new OfflinePlayModeParameters() + { + DecryptionServices = decryptionServices }, - UpdateMode.Standalone => new OfflinePlayModeParameters(), UpdateMode.Remote => new HostPlayModeParameters() { - QueryServices = new QueryStreamingAssetsFileServices(), - DefaultHostServer = resourceUrl, - FallbackHostServer = fallbackUrl + BuildinQueryServices = new GameQueryServices(), + RemoteServices = new RemoteServices(resourceUrl, fallbackUrl), + DecryptionServices = decryptionServices + }, + UpdateMode.WebGL => new WebPlayModeParameters() + { + BuildinQueryServices = new GameQueryServices(), + RemoteServices = new RemoteServices(resourceUrl, fallbackUrl), }, _ => null }; @@ -122,11 +134,14 @@ private static async Task SetUpPackage(string packageName) /// 下载包 /// /// 包名 + /// 是否加密 + /// 资源管线(原生文件的资源包构建模式必须是RawFileBuildPipeline) /// 回调事件 - public static async Task UpdatePackage(string packageName, IUpdater updater = null) + public static async Task UpdatePackage(string packageName, bool encrypted = true, + EDefaultBuildPipeline pipeline = EDefaultBuildPipeline.BuiltinBuildPipeline, IUpdater updater = null) { // 检查资源包 - await SetUpPackage(packageName); + await SetUpPackage(packageName, pipeline, encrypted); // 释放UI MessageBox.Dispose(); // 版本信息 @@ -284,12 +299,12 @@ private static ResourcePackage GetPackage(string packageName) public static Object Load(string path, Type type) => Load(path, Updater.MainPackageName, type, out _); - public static Object Load(string path, Type type, out AssetOperationHandle handle) => + public static Object Load(string path, Type type, out AssetHandle handle) => Load(path, Updater.MainPackageName, type, out handle); public static Object Load(string path, string package, Type type) => Load(path, package, type, out _); - public static Object Load(string path, string package, Type type, out AssetOperationHandle handle) + public static Object Load(string path, string package, Type type, out AssetHandle handle) { handle = GetPackage(package).LoadAssetSync(path, type); return handle.AssetObject; @@ -298,13 +313,13 @@ public static Object Load(string path, string package, Type type, out AssetOpera public static T Load(string path) where T : Object => Load(path, Updater.MainPackageName, out _); - public static T Load(string path, out AssetOperationHandle handle) + public static T Load(string path, out AssetHandle handle) where T : Object => Load(path, Updater.MainPackageName, out handle); public static T Load(string path, string package) where T : Object => Load(path, package, out _); - public static T Load(string path, string package, out AssetOperationHandle handle) + public static T Load(string path, string package, out AssetHandle handle) where T : Object { handle = GetPackage(package).LoadAssetSync(path); @@ -322,31 +337,32 @@ public static async Task LoadAsync(string path, string package) return handle.AssetObject as T; } - public static async Task LoadAsync(string path, Type type) + public static async Task LoadAsync(string path, Type type) => await LoadAsync(path, Updater.MainPackageName, type); - public static async Task LoadAsync(string path, string package, Type type) + public static async Task LoadAsync(string path, string package, Type type) { var handle = GetPackage(package).LoadAssetAsync(path, type); await handle.Task; return handle.AssetObject; } - public static async Task<(T, AssetOperationHandle)> LoadAsyncWithHandle(string path) + public static async Task<(T, AssetHandle)> LoadAsyncWithHandle(string path) where T : Object => await LoadAsyncWithHandle(path, Updater.MainPackageName); - public static async Task<(T, AssetOperationHandle)> LoadAsyncWithHandle(string path, string package) + public static async Task<(T, AssetHandle)> LoadAsyncWithHandle(string path, string package) where T : Object { var handle = GetPackage(package).LoadAssetAsync(path); await handle.Task; return (handle.AssetObject as T, handle); } - - public static async Task<(Object, AssetOperationHandle)> LoadAsyncWithHandle(string path, Type type) + + public static async Task<(Object, AssetHandle)> LoadAsyncWithHandle(string path, Type type) => await LoadAsyncWithHandle(path, Updater.MainPackageName, type); - - public static async Task<(Object, AssetOperationHandle)> LoadAsyncWithHandle(string path, string package, Type type) + + public static async Task<(Object, AssetHandle)> LoadAsyncWithHandle(string path, string package, + Type type) { var handle = GetPackage(package).LoadAssetAsync(path, type); await handle.Task; @@ -355,9 +371,9 @@ public static async Task LoadAsync(string path, string package, Type typ public static void LoadScene(string path, bool additive = false, string package = null) { - SceneOperationHandle handle = GetPackage(package) + SceneHandle handle = GetPackage(package) .LoadSceneAsync(path, additive ? LoadSceneMode.Additive : LoadSceneMode.Single); - handle.Task.ContinueWith((_, __) => RemoveUnusedAssets() + handle.Task.ContinueWith((_, _) => RemoveUnusedAssets() , null); _ = handle.Task; Log.PrintWarning("LoadScene will not wait for scene loading complete. Use LoadSceneAsync instead."); @@ -365,26 +381,26 @@ public static void LoadScene(string path, bool additive = false, string package public static async Task LoadSceneAsync(string path, bool additive = false, string package = null) { - SceneOperationHandle handle = GetPackage(package) + SceneHandle handle = GetPackage(package) .LoadSceneAsync(path, additive ? LoadSceneMode.Additive : LoadSceneMode.Single); await handle.Task; RemoveUnusedAssets(); } - public static RawFileOperationHandle LoadRaw(string path) => LoadRaw(path, Updater.MainPackageName); + public static RawFileHandle LoadRaw(string path) => LoadRaw(path, Updater.MainPackageName); - public static RawFileOperationHandle LoadRaw(string path, string package) + public static RawFileHandle LoadRaw(string path, string package) { - RawFileOperationHandle handle = GetPackage(package).LoadRawFileSync(path); + RawFileHandle handle = GetPackage(package).LoadRawFileSync(path); return handle; } - public static Task LoadRawAsync(string path) => + public static Task LoadRawAsync(string path) => LoadRawAsync(path, Updater.MainPackageName); - public static async Task LoadRawAsync(string path, string package) + public static async Task LoadRawAsync(string path, string package) { - RawFileOperationHandle handle = GetPackage(package).LoadRawFileAsync(path); + RawFileHandle handle = GetPackage(package).LoadRawFileAsync(path); await handle.Task; return handle; } diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Editor.meta b/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Editor.meta deleted file mode 100644 index c53ee20f..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4b1fa97e8bb8c5c46ad030b9554e1b5c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Editor/StreamingAssetsHelperEditor.cs b/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Editor/StreamingAssetsHelperEditor.cs deleted file mode 100644 index 229dba3c..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Editor/StreamingAssetsHelperEditor.cs +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------- -// 作者:Stark -//------------------------------------- - -#if UNITY_ANDROID -/// -/// 为Github对开发者的友好,采用自动补充UnityPlayerActivity.java文件的通用姿势满足各个开发者 -/// -internal class AndroidPost : UnityEditor.Android.IPostGenerateGradleAndroidProject -{ - public int callbackOrder => 99; - public void OnPostGenerateGradleAndroidProject(string path) - { - path = path.Replace("\\", "/"); - string untityActivityFilePath = $"{path}/src/main/java/com/unity3d/player/UnityPlayerActivity.java"; - var readContent = System.IO.File.ReadAllLines(untityActivityFilePath); - string postContent = - " //auto-gen-function \n" + - " public boolean CheckAssetExist(String filePath) \n" + - " { \n" + - " android.content.res.AssetManager assetManager = getAssets(); \n" + - " try \n" + - " { \n" + - " java.io.InputStream inputStream = assetManager.open(filePath); \n" + - " if (null != inputStream) \n" + - " { \n" + - " inputStream.close(); \n" + - " return true; \n" + - " } \n" + - " } \n" + - " catch(java.io.IOException e) \n" + - " { \n" + - " e.printStackTrace(); \n" + - " } \n" + - " return false; \n" + - " } \n" + - "}"; - - if (CheckFunctionExist(readContent) == false) - readContent[readContent.Length - 1] = postContent; - System.IO.File.WriteAllLines(untityActivityFilePath, readContent); - } - private bool CheckFunctionExist(string[] contents) - { - for (int i = 0; i < contents.Length; i++) - { - if (contents[i].Contains("CheckAssetExist")) - { - return true; - } - } - return false; - } -} -#endif - -/* -//auto-gen-function -public boolean CheckAssetExist(String filePath) -{ - android.content.res.AssetManager assetManager = getAssets(); - try - { - java.io.InputStream inputStream = assetManager.open(filePath); - if(null != inputStream) - { - inputStream.close(); - return true; - } - } - catch(java.io.IOException e) - { - e.printStackTrace(); - } - return false; -} -*/ \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Runtime.meta b/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Runtime.meta deleted file mode 100644 index ac0c6798..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b19a7385dee2d0141901167dbfda9300 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Runtime/StreamingAssetsHelper.cs b/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Runtime/StreamingAssetsHelper.cs deleted file mode 100644 index 026f5977..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ThirdParty/StreamingAssetsHelper/Runtime/StreamingAssetsHelper.cs +++ /dev/null @@ -1,57 +0,0 @@ -//------------------------------------- -// 作者:Stark -//------------------------------------- -using System.Collections.Generic; -using UnityEngine; - -public sealed class StreamingAssetsHelper -{ - private static readonly Dictionary _cacheData = new Dictionary(1000); - -#if UNITY_ANDROID && !UNITY_EDITOR - private static AndroidJavaClass _unityPlayerClass; - public static AndroidJavaClass UnityPlayerClass - { - get - { - if (_unityPlayerClass == null) - _unityPlayerClass = new UnityEngine.AndroidJavaClass("com.unity3d.player.UnityPlayer"); - return _unityPlayerClass; - } - } - - private static AndroidJavaObject _currentActivity; - public static AndroidJavaObject CurrentActivity - { - get - { - if (_currentActivity == null) - _currentActivity = UnityPlayerClass.GetStatic("currentActivity"); - return _currentActivity; - } - } - - /// - /// 利用安卓原生接口查询内置文件是否存在 - /// - public static bool FileExists(string filePath) - { - if (_cacheData.TryGetValue(filePath, out bool result) == false) - { - result = CurrentActivity.Call("CheckAssetExist", filePath); - _cacheData.Add(filePath, result); - } - return result; - } -#else - public static bool FileExists(string filePath) - { - if (_cacheData.TryGetValue(filePath, out bool result) == false) - { - result = System.IO.File.Exists(System.IO.Path.Combine(Application.streamingAssetsPath, filePath)); - _cacheData.Add(filePath, result); - } - return result; - } -#endif -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Update/QueryStreamingAssetsFileServices.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Update/QueryStreamingAssetsFileServices.cs deleted file mode 100644 index 5ce6c31b..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Update/QueryStreamingAssetsFileServices.cs +++ /dev/null @@ -1,14 +0,0 @@ -using YooAsset; - -namespace JEngine.Core -{ - public class QueryStreamingAssetsFileServices : IQueryServices - { - public bool QueryStreamingAssets(string fileName) - { - // StreamingAssetsHelper.cs是太空战机里提供的一个查询脚本。 - string buildinFolderName = YooAssets.GetStreamingAssetBuildinFolderName(); - return StreamingAssetsHelper.FileExists($"{buildinFolderName}/{fileName}"); - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Update/QueryStreamingAssetsFileServices.cs.meta b/UnityProject/Assets/Dependencies/JEngine/Core/Update/QueryStreamingAssetsFileServices.cs.meta deleted file mode 100644 index 1946e985..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Update/QueryStreamingAssetsFileServices.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 058903ade6424f318c5d7899b9403775 -timeCreated: 1681046080 \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Util/FpsMonitor.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Util/FpsMonitor.cs index e2b0b6ef..35608866 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Util/FpsMonitor.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Util/FpsMonitor.cs @@ -8,7 +8,7 @@ public static class FpsMonitor public static long TotalFrames => _totalFrames; private static int _frames; - private static int _backupFrames; + private static int _backupFrames = Application.targetFrameRate > 0 ? Application.targetFrameRate : 60; private static float _timer = 1; private static long _totalFrames; @@ -21,9 +21,8 @@ private static void Update() { //增加帧率 ++_frames; - ++_backupFrames; ++_totalFrames; - + //计时器刷新 _timer -= Time.deltaTime; diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Util/InitJEngine.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Util/InitJEngine.cs index f4a499a1..f0de1c97 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Util/InitJEngine.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Util/InitJEngine.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using ILRuntime.Mono.Cecil.Pdb; +using ILRuntime.Runtime.Enviorment; using UnityEngine.Serialization; using AppDomain = ILRuntime.Runtime.Enviorment.AppDomain; @@ -169,23 +170,61 @@ public static void InitializeILRuntime(AppDomain appdomain) appdomain.DebugService.StartDebugService(56000); #endif var assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); + //助手类 var helperInterface = typeof(IRegisterHelper); - //全部程序集 + + //跨域继承 + var ilRuntimeAssembly = typeof(AppDomain).Assembly; + var crossBindingAdaptorType = typeof(CrossBindingAdaptor); + + //遍历全部程序集 foreach (var assembly in assemblies) { + if(assembly == ilRuntimeAssembly) + continue; + //不需要System, Unity, 还有一些JEngine的第三方插件 + if (assembly.FullName.StartsWith("System") || + assembly.FullName.StartsWith("mscorlib") || assembly.FullName.StartsWith("netstandard") || + assembly.FullName.StartsWith("UnityEngine") || assembly.FullName.StartsWith("ILRuntime") || + assembly.FullName.StartsWith("UnityEditor") || assembly.FullName.StartsWith("YooAsset")|| + assembly.FullName.StartsWith("Bee") || assembly.FullName.StartsWith("Malee")|| + assembly.FullName.StartsWith("Unity.") || assembly.FullName.StartsWith("nunit") || + assembly.FullName.StartsWith("Mono.") || assembly.FullName.StartsWith("JetBrains.") ) + { + continue; + } + + Debug.Log(assembly.FullName); + var types = assembly.GetTypes(); //全部类型 foreach (var type in types) { - var interfaces = type.GetInterfaces(); //继承接口 - foreach (var @interface in interfaces) + if (helperInterface.IsAssignableFrom(type) && type != helperInterface) + { + //注册 + var helper = (IRegisterHelper)Activator.CreateInstance(type); + helper.Register(appdomain); + } + + //跨域继承 + if (type.IsSubclassOf(crossBindingAdaptorType)) { - if (@interface == helperInterface) + object obj = Activator.CreateInstance(type); + CrossBindingAdaptor adaptor = obj as CrossBindingAdaptor; + if (adaptor == null) { - //注册 - var helper = (IRegisterHelper)Activator.CreateInstance(type); - helper.Register(appdomain); + continue; + } + + try + { + appdomain.RegisterCrossBindingAdaptor(adaptor); + } + catch + { + //ignore } } } @@ -193,12 +232,13 @@ public static void InitializeILRuntime(AppDomain appdomain) //CLR绑定(有再去绑定),这个要在最后 Type t = Type.GetType("ILRuntime.Runtime.Generated.CLRBindings"); + object[] param = new object[] + { + appdomain + }; if (t != null) { - t.GetMethod("Initialize")?.Invoke(null, new object[] - { - appdomain - }); + t.GetMethod("Initialize")?.Invoke(null, param); } } diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Util/JStream.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Util/JStream.cs index 218c1712..7121e44b 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Util/JStream.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Util/JStream.cs @@ -1,29 +1,27 @@ using System; -using System.Buffers; using System.IO; +using System.Text; using System.Runtime.CompilerServices; using System.Security.Cryptography; -using System.Text; -using Unity.Collections; -using Unity.Collections.LowLevel.Unsafe; namespace JEngine.Core { - public unsafe class JStream : Stream + public sealed class JStream : Stream { - private byte* _buffer; // Either allocated internally or externally. + private const string DefaultKey = "hello_JEngine_!_"; + private const int MemStreamMaxLength = Int32.MaxValue; + + private byte[] _buffer; // Either allocated internally or externally. private readonly int _origin; // For user-provided arrays, start at this origin private int _position; // read/write head. - private int _length; // Number of bytes within the memory stream - private int _capacity; // length of usable portion of buffer for stream - private byte[] _key; //解密密码 - private string _defaultKey = "hello_JEngine_!_"; + private readonly int _length; // Number of bytes within the memory stream + private readonly int _capacity; // length of usable portion of buffer for stream + private byte[] _decryptorBuffer; // Use for decryptor + private readonly ICryptoTransform _decryptor; private bool _encrypted = true; //是否aes加密了 private bool _isOpen; // Is this stream open or closed? - private const int MemStreamMaxLength = Int32.MaxValue; - public bool Encrypted { get => _encrypted; @@ -32,33 +30,24 @@ public bool Encrypted public JStream(byte[] buffer, string key) { - _buffer = (byte*)UnsafeUtility.Malloc(buffer.Length, 1, Allocator.Persistent); - buffer.AsSpan().CopyTo(new Span(_buffer, buffer.Length)); + _buffer = new byte[buffer.Length]; + Unsafe.CopyBlockUnaligned(ref _buffer[0], ref buffer[0], (uint)buffer.Length); _length = _capacity = buffer.Length; _origin = 0; _isOpen = true; if (key.Length < 16) { - key = InitJEngine.Instance.key.Length < 16 ? _defaultKey : InitJEngine.Instance.key; + key = InitJEngine.Instance.key.Length < 16 ? DefaultKey : InitJEngine.Instance.key; } - _key = Encoding.UTF8.GetBytes(key); - Xor(); - } + var algo = Aes.Create(); + algo.Key = Encoding.UTF8.GetBytes(key); + algo.Mode = CipherMode.ECB; + algo.Padding = PaddingMode.None; + _decryptor = algo.CreateDecryptor(); - private void Xor() - { - var cnt = _key.Length; - var i = 0; - fixed (byte* ptr = _key) - { - while(i < cnt) - { - *(ptr + i) = (byte)(*(ptr + i) ^ i); - i++; - } - } + _decryptorBuffer = new byte[64 * 1024]; // 64kb buffer for decryptor } public override bool CanRead => _isOpen; @@ -69,31 +58,20 @@ private void Xor() protected override void Dispose(bool disposing) { - try - { - if (disposing) - { - _isOpen = false; - UnsafeUtility.Free(_buffer, Allocator.Persistent); - _buffer = null; - } - } - finally + if (disposing) { - // Call base.Close() to cleanup async IO resources - base.Dispose(disposing); + _isOpen = false; + _buffer = null; + _decryptorBuffer = null; } + base.Dispose(disposing); } public override void Flush() { } - // Gets & sets the capacity (number of bytes allocated) for this stream. - // The capacity cannot be set to a value less than the current length - // of the stream. - // - public virtual int Capacity + public int Capacity { get { @@ -137,35 +115,16 @@ public override int Read(byte[] buffer, int offset, int count) if (n <= 0) return 0; - /* - * JEngine的分块解密 - * 理论上,aes是 每16字节为单位 加密 - * 所以只需给buffer以16位单位切割即可 - */ + uint nInt = (uint)n; if (_encrypted) { - try - { - Xor(); - fixed (byte* ptr = &buffer[offset]) - { - GetBytesAt(in _position, in count, in ptr); - } - } - catch (Exception ex) - { - Log.PrintError(ex); - throw; - } - finally - { - Xor(); - } + //JEngine的分块解密 + GetBytesAt(_position, nInt, buffer, offset); } else { //没加密的直接读就好 - Unsafe.CopyBlockUnaligned(ref buffer[offset], ref _buffer[_position], (uint)n); + Unsafe.CopyBlockUnaligned(ref buffer[offset], ref _buffer[_position], nInt); } _position += n; @@ -179,37 +138,28 @@ public override int Read(byte[] buffer, int offset, int count) /// /// /// + /// /// - private void GetBytesAt(in int start, in int length, in byte* ret) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void GetBytesAt(int start, uint length, byte[] ret, int retOffset) { - int offset = start >> 4 << 4; // 偏移值,截取开始的地方,比如 67 变 64,相当于start - start % 16 - int count = 32 + length >> 4 << 4; //获得需要切割的数组的长度,比如 77 变 96(80+16),77+ (32- 77/16的余数) + int offset = start & 0x7ffffff0; // 偏移值,截取开始的地方,比如 67 变 64,相当于start - start % 16 + int count = 32 + (int)length & 0x7ffffff0; //获得需要切割的数组的长度,比如 77 变 96(80+16),77+ (32- 77%16) //= 77 + (32-13) = 77 + 19 = 96,多16位确保不丢东西,相当于length +(32 - length % 16); - //现在需要将buffer切割,从offset开始,到count为止 - var encryptedData = ArrayPool.Shared.Rent(count); //创建加密数据数组 - Array.Clear(encryptedData, 0, count); - var l = _length - offset; - if (count > l) count = l; - Unsafe.CopyBlockUnaligned(ref encryptedData[0], ref _buffer[offset], (uint)count); //从原始数据里分割出来 + if (_decryptorBuffer.Length < count) + { + Array.Resize(ref _decryptorBuffer, count); + } + + //解密 + _decryptor.TransformBlock(_buffer, offset, count, _decryptorBuffer, 0); - //给encryptedData解密 - var decrypt = CryptoMgr.AesDecrypt(encryptedData, _key, 0, count, CipherMode.ECB, PaddingMode.None); //截取decrypt,从remainder开始,到length为止,比如余数是3,那么从3-1的元素开始 offset = start ^ offset; //相当于start % 16 - //返还借的数组 - ArrayPool.Shared.Return(encryptedData); - - //这里有个问题,比如decrypt有16字节,而result是12字节,offset是8,那么12+8 > 16,就会出现错误 - //所以这里要改一下 - // var total = offset + length; - // if (total > decrypt.Length) - // { - // Unsafe.CopyBlockUnaligned(ref ret[0], ref decrypt[offset], (uint)(decrypt.Length)); - // } //直接操作指针,可以略过边界检查 - Unsafe.CopyBlockUnaligned(ref ret[0], ref decrypt[offset], (uint)length); + Unsafe.CopyBlockUnaligned(ref ret[retOffset], ref _decryptorBuffer[offset], length); } public override long Seek(long offset, SeekOrigin loc) diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Util/Updater.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Util/Updater.cs index 5e0087a0..f8d92c5e 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Util/Updater.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Util/Updater.cs @@ -1,4 +1,5 @@ using UnityEngine; +using YooAsset; namespace JEngine.Core { @@ -12,6 +13,15 @@ [SerializeField] [Tooltip("热更资源下载备用地址")] [SerializeField] private string gameScene = "Assets/HotUpdateResources/Main/Scene/Game.unity"; [SerializeField] private string mainPackageName = "Main"; + [SerializeField] [Tooltip("主分包资源打包该管线")] + private EDefaultBuildPipeline pipeline = EDefaultBuildPipeline.BuiltinBuildPipeline; + + [SerializeField] [Tooltip("打包资源时是否加密")] + private bool encrypted = true; + + [SerializeField] [Tooltip("是否为微信小游戏")] private bool isWechatGame = false; + + [Tooltip("Simulate是开发模式,Standalone是离线模式,Remote是真机模式")] [SerializeField] private UpdateMode mode = UpdateMode.Simulate; @@ -48,6 +58,7 @@ public enum UpdateMode : byte Simulate = 0, Standalone = 1, Remote = 2, + WebGL = 3 } /// @@ -77,7 +88,11 @@ public void StartUpdate() { var updater = FindObjectOfType(); updater.sceneName = gameScene; - _ = AssetMgr.UpdatePackage(mainPackageName, updater); + if (isWechatGame) + { + YooAssets.SetCacheSystemDisableCacheOnWebGL(); + } + _ = AssetMgr.UpdatePackage(mainPackageName, encrypted, pipeline, updater); } private void OnDestroy() diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/Clean.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/Clean.cs index 59746ffb..202b80f7 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/Clean.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/Clean.cs @@ -25,159 +25,54 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Threading.Tasks; using JEngine.Core; using UnityEditor; -using UnityEngine; namespace JEngine.Editor { internal static class Clean { - public static bool hasAdded; - - private static bool _isDone = true; - - private static readonly string HotProjectName = ConstMgr.MainHotDLLName; - - private static readonly DirectoryInfo LibraryDirectory = - new DirectoryInfo(Application.dataPath + "/../Library/ScriptAssemblies"); - - private static readonly DirectoryInfo PackageDirectory = - new DirectoryInfo(Application.dataPath + "/../Library/PackageCache"); + public static bool initialised; private static readonly DirectoryInfo HiddenDirectory = new DirectoryInfo(ConstMgr.DLLSourceFolder); - public delegate void PostCleanEvent(int count); - public static event PostCleanEvent onPostClean; - - static Clean() + public static void Initialise() { - onPostClean += cnt => MakeBytes(); - } - - public static void Update() - { - hasAdded = true; - - if (!_isDone || EditorApplication.isPlaying) - { - return; - } - - if (!HiddenDirectory.Exists) //DLL导入到隐藏文件夹,防止每次加载浪费时间 - { - HiddenDirectory.Create(); - } - - if (!FileMgr.HasFile(DllMgr.GetDllInEditorPath(ConstMgr.MainHotDLLName))) //没热更dll就返回 - { - return; - } - - //有的话比较日期 - DateTime lastModified = File.GetLastWriteTime(DllMgr.GetDllInEditorPath(ConstMgr.MainHotDLLName)); - string lastModifiedStr = lastModified.ToString(Setting.GetString(SettingString.DateFormat)); - if (Setting.LastDLLCleanUpTime != lastModifiedStr) //不一样再处理 - { - var files = HiddenDirectory.GetFiles(); - int counts = 0; - List fileNames = Directory.GetFiles("Assets/", - "*.dll", SearchOption.AllDirectories).ToList();//白名单DLL - //ScriptAssemblies和PackageCache的Dll也应该进白名单 - fileNames.AddRange(Directory.GetFiles(LibraryDirectory.FullName, - "*.dll", SearchOption.AllDirectories)); - fileNames.AddRange(Directory.GetFiles(PackageDirectory.FullName, - "*.dll", SearchOption.AllDirectories)); - - var watch = new Stopwatch(); - AssetDatabase.Refresh(); - - Setting.LastDLLCleanUpTime = lastModifiedStr; - - _isDone = false; - fileNames = fileNames.FindAll(x => !x.Contains("~")); - - watch.Start(); - foreach (var file in files) - { - var name = file.Name; - var success = true; - if (!File.Exists(LibraryDirectory.FullName + "/" + name) && !name.Contains("netstandard") && - !name.Contains(HotProjectName) && !name.Contains("Unity") && !name.Contains("System") && - (name.EndsWith(".pdb") || name.EndsWith(".dll"))) - { - if (fileNames.Find(x => x.Contains(name)) == null) //不存在就添加 - { - success = false; - } - else //存在就删了 - { - FileMgr.Delete(file.FullName); - counts++; - } - } - else if (!name.Contains(HotProjectName)) - { - try - { - FileMgr.Delete(file.FullName); - counts++; - } - catch - { - Log.Print(String.Format( - Setting.GetString(SettingString.DeleteErrorLog), - file.Name)); - success = false; - } - } - - if (!success) - { - if (file.Directory != null) - { - DirectoryInfo newPath = new DirectoryInfo(file.Directory.FullName).Parent?.Parent?.Parent; - if (newPath != null) - { - File.Move(file.FullName, newPath.FullName + "/" + file.Name); - Log.Print(String.Format( - Setting.GetString(SettingString.DLLNewReferenceLog), - newPath.FullName + "/" + file.Name)); - } - } - } - } - - watch.Stop(); - if (counts > 0) //如果删除过东西,就代表DLL更新了,就需要生成文件 - { - Log.Print(String.Format(Setting.GetString(SettingString.DLLCleanLog), - counts, - watch.ElapsedMilliseconds)); - onPostClean?.Invoke(counts); - } - - _isDone = true; - } + var watcher = new FileSystemWatcher(HiddenDirectory.FullName); + watcher.NotifyFilter = NotifyFilters.Attributes + | NotifyFilters.CreationTime + | NotifyFilters.DirectoryName + | NotifyFilters.FileName + | NotifyFilters.LastAccess + | NotifyFilters.LastWrite + | NotifyFilters.Security + | NotifyFilters.Size; + + watcher.Changed += (_, _) => { EditorApplication.delayCall += MakeBytes; }; + + watcher.Filter = $"{ConstMgr.MainHotDLLName}.dll"; + watcher.EnableRaisingEvents = true; + initialised = true; } private static void MakeBytes() { - FileMgr.Delete(DllMgr.GetDllInRuntimePath(ConstMgr.MainHotDLLName)); - FileMgr.Delete(DllMgr.GetPdbInRuntimePath(ConstMgr.MainHotDLLName)); - Action buildAct = async s => { var watch = new Stopwatch(); watch.Start(); string dllPath = DllMgr.GetDllInEditorPath(ConstMgr.MainHotDLLName); + if (!File.Exists(dllPath)) + { + Log.PrintError("DLL文件不存在!"); + return; + } + var bytes = FileMgr.FileToBytes(dllPath); var result = FileMgr.BytesToFile(CryptoMgr.AesEncrypt(bytes, s), DllMgr.GetDllInRuntimePath(ConstMgr.MainHotDLLName)); @@ -203,7 +98,7 @@ private static void MakeBytes() { Log.PrintError("PDB转Byte[]出错!"); return; - } + } } Setting.EncryptPassword = s; diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/EditorUpdate.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/EditorUpdate.cs index 977dd117..c4e5ba19 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/EditorUpdate.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/EditorUpdate.cs @@ -10,9 +10,9 @@ internal class EditorUpdate /// static EditorUpdate() { - if (!Clean.hasAdded) + if (!Clean.initialised) { - EditorApplication.update += Clean.Update; //处理DLL + Clean.Initialise(); } if (!AllowUnsafe.hasAdded) diff --git a/UnityProject/Assets/Dependencies/YooAsset.meta b/UnityProject/Assets/Dependencies/YooAsset.meta index ad242337..500c5b29 100644 --- a/UnityProject/Assets/Dependencies/YooAsset.meta +++ b/UnityProject/Assets/Dependencies/YooAsset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3e104f23877ac45bba4f946434232f47 +guid: 73d0ece70d7c942d5a11c74e189d8ba6 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/UnityProject/Assets/Dependencies/YooAsset/AssetBundleBuilderSetting.asset b/UnityProject/Assets/Dependencies/YooAsset/AssetBundleBuilderSetting.asset deleted file mode 100644 index c320b026..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/AssetBundleBuilderSetting.asset +++ /dev/null @@ -1,22 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 09788b4733bab2d4792fdd5d28e7653c, type: 3} - m_Name: AssetBundleBuilderSetting - m_EditorClassIdentifier: - BuildPipeline: 0 - BuildMode: 0 - BuildPackage: - CompressOption: 2 - OutputNameStyle: 1 - CopyBuildinFileOption: 0 - CopyBuildinFileTags: - EncyptionClassName: diff --git a/UnityProject/Assets/Dependencies/YooAsset/AssetBundleBuilderSetting.asset.meta b/UnityProject/Assets/Dependencies/YooAsset/AssetBundleBuilderSetting.asset.meta deleted file mode 100644 index 66642dfb..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/AssetBundleBuilderSetting.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 13a9024627d9546368f4fb86fd7a9956 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/AssetBundleCollectorSetting.asset b/UnityProject/Assets/Dependencies/YooAsset/AssetBundleCollectorSetting.asset index f23ec756..79245d36 100644 --- a/UnityProject/Assets/Dependencies/YooAsset/AssetBundleCollectorSetting.asset +++ b/UnityProject/Assets/Dependencies/YooAsset/AssetBundleCollectorSetting.asset @@ -13,12 +13,16 @@ MonoBehaviour: m_Name: AssetBundleCollectorSetting m_EditorClassIdentifier: ShowPackageView: 1 - EnableAddressable: 0 - UniqueBundleName: 0 ShowEditorAlias: 1 + UniqueBundleName: 1 Packages: - PackageName: Main PackageDesc: "\u4E3B\u5206\u5305\uFF0C\u70ED\u66F4\u4EE3\u7801\u5FC5\u987B\u5728\u8FD9\u4E2A\u5305\u5185" + EnableAddressable: 0 + LocationToLower: 0 + IncludeAssetGUID: 0 + AutoCollectShaders: 1 + IgnoreRuleName: NormalIgnoreRule Groups: - GroupName: Scene GroupDesc: "\u573A\u666F\u8D44\u6E90" @@ -85,21 +89,13 @@ MonoBehaviour: FilterRuleName: CollectShaderVariants AssetTags: UserData: - - GroupName: Raw - GroupDesc: "\u539F\u751F\u8D44\u6E90" - AssetTags: - ActiveRuleName: EnableGroup - Collectors: - - CollectPath: Assets/HotUpdateResources/Main/Raw - CollectorGUID: f81b15da1e2b64733af61d0154dc8d4d - CollectorType: 0 - AddressRuleName: AddressByFileName - PackRuleName: PackRawFile - FilterRuleName: CollectAll - AssetTags: - UserData: - PackageName: AddOn1 PackageDesc: "\u5206\u53051" + EnableAddressable: 0 + LocationToLower: 0 + IncludeAssetGUID: 0 + AutoCollectShaders: 1 + IgnoreRuleName: NormalIgnoreRule Groups: - GroupName: Scene GroupDesc: "\u573A\u666F\u8D44\u6E90" @@ -127,3 +123,24 @@ MonoBehaviour: FilterRuleName: CollectAll AssetTags: UserData: + - PackageName: Raw + PackageDesc: "\u539F\u751F\u8D44\u6E90" + EnableAddressable: 0 + LocationToLower: 0 + IncludeAssetGUID: 0 + AutoCollectShaders: 1 + IgnoreRuleName: NormalIgnoreRule + Groups: + - GroupName: Default Group + GroupDesc: "\u539F\u751F\u8D44\u6E90" + AssetTags: + ActiveRuleName: EnableGroup + Collectors: + - CollectPath: Assets/HotUpdateResources/Raw + CollectorGUID: f81b15da1e2b64733af61d0154dc8d4d + CollectorType: 0 + AddressRuleName: AddressByFileName + PackRuleName: PackRawFile + FilterRuleName: CollectAll + AssetTags: + UserData: diff --git a/UnityProject/Assets/Dependencies/YooAsset/CHANGELOG.md b/UnityProject/Assets/Dependencies/YooAsset/CHANGELOG.md deleted file mode 100644 index 9ebe98ab..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/CHANGELOG.md +++ /dev/null @@ -1,1093 +0,0 @@ -# CHANGELOG - -All notable changes to this package will be documented in this file. - -## [1.4.10] - 2023-04-08 - -### Fixed - -- 修复了资源文件路径无效导致异常的问题。 -- 修复了原生文件不支持ini格式文件的问题。 -- 修复了通过代码途径导入XML配置的报错问题。 - -## [1.4.9] - 2023-03-29 - -### Fixed - -- 修复了资源配置界面的GroupActiveRule保存无效的问题。 - -### Changed - -- 优化了资源配置导入逻辑,增加了对XML配置文件的合法性检测。 - -- 优化了UniTask的说明文档。 - -- 调整构建的输出目录结构。 - -- 调试窗口增加分屏功能。(Unity2020.3+起效) - -- 报告窗口增加分屏功能。(Unity2020.3+起效) - -- 编辑器模拟模式支持了虚拟资源包。 - -- 扩展了Instantiate方法。 - - ```c# - public sealed class AssetOperationHandle - { - public GameObject InstantiateSync(); - public GameObject InstantiateSync(Transform parent); - public GameObject InstantiateSync(Transform parent, bool worldPositionStays); - public GameObject InstantiateSync(Vector3 position, Quaternion rotation); - public GameObject InstantiateSync(Vector3 position, Quaternion rotation, Transform parent); - } - ``` - -### Added - -- 优化了报告文件内容,增加了资源包内嵌的资源列表。 - -- 可寻址规则增加了AddressByFilePath类。 - -- 新增了新方法。 - - ```c# - /// - /// 向远端请求并更新清单 - /// - public class UpdatePackageManifestOperation : AsyncOperationBase - { - /// - /// 保存当前清单的版本,用于下次启动时自动加载的版本。 - /// - public void SavePackageVersion(); - } - ``` - -- 新增了初始化参数。 - - ```c# - /// - /// 下载失败尝试次数 - /// 注意:默认值为MaxValue - /// - public int DownloadFailedTryAgain = int.MaxValue; - ``` - -- 新增了初始化参数。 - - ```c# - /// - /// 资源加载每帧处理的最大时间片段 - /// 注意:默认值为MaxValue - /// - public long LoadingMaxTimeSlice = long.MaxValue; - ``` - -### Removed - -- 移除了代码里的Patch敏感字。 - - ```c# - //PatchManifest.cs重命名为PackageManifest.cs - //AssetsPackage.cs重命名为ResourcePackage.cs - //YooAssets.CreateAssetsPackage()重命名为YooAssets.CreatePackage() - //YooAssets.GetAssetsPackage()重命名为YooAssets.GetPackage() - //YooAssets.TryGetAssetsPackage()重命名为YooAssets.TryGetPackage() - //YooAssets.HasAssetsPackage()重命名为YooAssets.HasPackage() - ``` - -- 移除了初始化参数:AssetLoadingMaxNumber - -## [1.4.8] - 2023-03-10 - -### Fixed - -- 修复了同步加载原生文件,程序卡死的问题。 -- 修复了可编程构建管线,当项目里没有着色器,如果有引用内置着色器会导致打包失败的问题。 -- 修复了在Unity2021.3版本下着色器收集界面错乱的问题。 - -### Changed - -- 优化了打包逻辑,提高构建速度。 - -- 支持自定义日志处理,方便收集线上问题。 - - ```c# - public class YooAssets - { - /// - /// 初始化资源系统 - /// - /// 自定义日志处理 - public static void Initialize(ILogger logger = null) - } - ``` - -## [1.4.7] - 2023-03-03 - -### Fixed - -- 修复了在运行时资源引用链无效的问题。 -- 修复了在构建过程中发生异常后进度条未消失的问题。 -- 修复了使用SBP构建管线,如果有原生文件会导致打包失败的问题。 - -### Changed - -- 支持自定义下载请求 - - ```c# - /// - /// 设置下载系统参数,自定义下载请求 - /// - public static void SetDownloadSystemUnityWebRequest(DownloadRequestDelegate requestDelegate) - ``` - -- 优化了打包时资源包引用关系计算的逻辑。 - -- 优化了缓存系统初始化逻辑,支持分帧获取所有缓存文件。 - -- 优化了缓存系统的存储目录结构,提高了文件夹查询速度。 - -- 优化了在资源收集界面,点击查看Collector主资源列表卡顿问题。 - -- 优化了资源对象加载耗时统计的逻辑,现在更加准确了。 - -- 优化了资源加载器查询逻辑。 - -- 优化了资源下载系统,下载文件的验证支持了多线程。 - -- 着色器变种收集界面增加单次照射数量的控制。 - -## [1.4.6-preview] - 2023-02-22 - -### Changed - -- EVerifyLevel新增Middle级别。 - - ```c# - public enum EVerifyLevel - { - /// - /// 验证文件存在 - /// - Low, - - /// - /// 验证文件大小 - /// - Middle, - - /// - /// 验证文件大小和CRC - /// - High, - } - ``` - -- 补丁清单的资源包列表新增引用链。 - - (解决复杂依赖关系下,错误卸载资源包的问题) - -- 缓存系统支持后缀格式存储。 - - (解决原生文件没有后缀格式的问题) - -- 收集界面增加用户自定义数据栏。 - -## [1.4.5-preview] - 2023-02-17 - -### Fixed - -- (#67)修复了报告查看界面在Unity2021.3上的兼容性问题。 -- (#66)修复了在Unity2021.3上编辑器模拟模式运行报错的问题。 - -### Changed - -- 接口变更:IPackRule - - ````c# - /// - /// 资源打包规则接口 - /// - public interface IPackRule - { - /// - /// 获取打包规则结果 - /// - PackRuleResult GetPackRuleResult(PackRuleData data); - - /// - /// 是否为原生文件打包规则 - /// - bool IsRawFilePackRule(); - } - ```` - -## [1.4.4-preview] - 2023-02-14 - -### Fixed - -- (#65)修复了AssetBundle构建宏逻辑错误。 -- 修复了AssetBundle加载宏逻辑错误。 - -## [1.4.3-preview] - 2023-02-10 - -全新的缓存系统! - -### Fixed - -- 修复了WebGL平台本地文件验证报错。 -- 修复了WEBGL平台加载原生文件失败的问题。 -- 修复了通过Handle句柄查询资源包下载进度为零的问题。 - -### Changed - -- 着色器变种收集增加分批次处理功能。 -- Unity2021版本开始不再支持内置构建管线。 - -### Removed - -- 太空战机DEMO移除了BetterStreamingAssets插件。 - -## [1.4.2-preview] - 2023-01-03 - -### Fixed - -- 修复了清单解析异步操作的进度条变化错误。 -- 修复了更新资源清单错误计算超时时间的问题。 - -## [1.4.1-preview] - 2022-12-26 - -### Fixed - -- 修复了开启UniqueBundleName选项后,SBP构建报错的问题。 - -### Added - -- 新增了AssetsPackage.PreDownloadPackageAsync()方法 - - ````c# - /// - /// 预下载指定版本的包裹资源 - /// - /// 下载的包裹版本 - /// 超时时间(默认值:60秒) - public PreDownloadPackageOperation PreDownloadPackageAsync(string packageVersion, int timeout = 60) - ```` - -- 新增了OperationHandleBase.GetDownloadReport()方法 - - ````c# - /// - /// 获取下载报告 - /// - public DownloadReport GetDownloadReport(); - ```` - -### Changed - -- 优化了资源清单更新流程,支持缓存下载的清单。 -- 优化了清单文件的解析流程,支持分帧解析避免卡顿。 -- 优化了缓存文件的验证流程,支持分帧处理。 -- 初始化的时候支持覆盖安装检测,然后清理所有的缓存清单文件。 -- ClearPackageUnusedCacheFilesAsync重名为ClearUnusedCacheFilesAsync - -## [1.4.0-preview] - 2022-12-04 - -### Fixed - -- (#46)修复了资源包初始化失败之后,再次初始化发生异常的问题。 -- 修复了在初始化失败的之后,销毁YooAssets会报异常的问题。 - -### Changed - -- 优化了资源收集界面,可以选择显示中文别名。 -- **优化了补丁清单序列化方式,由文本数据修改为二进制数据。** -- 资源操作句柄增加using支持。 - -## [1.3.7] - 2022-11-26 - -全新的太空战机Demo ! - -### Fixed - -- (#45)修复了package列表更新触发的异常。 - -### Added - -- 新增了YooAssets.Destroy()资源系统销毁方法。 - - ```C# - /// - /// 销毁资源系统 - /// - public static void Destroy(); - ``` - -### Changed - -- 优化了资源收集规则,原生文件打包名称现在已经包含文件后缀名。 -- 优化了资源收集规则,非原生文件收集器自动移除Unity无法识别的文件。 -- 优化了调试信息窗口,列表元素的加载状态显示为文本。 - -## [1.3.5] - 2022-11-19 - -### Fixed - -- 修复了同步接口加载加密文件失败的问题。 - -### Added - -- 新增了方法AssetsPackage.ClearPackageUnusedCacheFilesAsync() - - ```c# - /// - /// 清理本地包裹未使用的缓存文件 - /// - public ClearPackageUnusedCacheFilesOperation ClearPackageUnusedCacheFilesAsync() - ``` - -- 新增了方法AssetsPackage.LoadRawFileAsync() - - ```c# - /// - /// 异步加载原生文件 - /// - /// 资源的定位地址 - public RawFileOperationHandle LoadRawFileAsync(string location) - ``` - -- 新增了方法AssetsPackage.LoadRawFileSync() - - ```c# - /// - /// 同步加载原生文件 - /// - /// 资源的定位地址 - public RawFileOperationHandle LoadRawFileSync(string location) - ``` - -### Changed - -- 重命名AssetsPackage.UpdateStaticVersionAsync()为AssetsPackage.UpdatePackageVersionAsync(); -- 重命名AssetsPackage.UpdateManifestAsync()为AssetsPackage.UpdatePackageManifestAsync(); - -### Removed - -- 移除了方法YooAssets.ClearUnusedCacheFiles() -- 移除了方法AssetsPackage.GetRawFileAsync() - -## [1.3.4] - 2022-11-04 - -### Fixed - -- (#29)修复了EditorHelper中根据guid找uxml有时候会出错的问题。 -- (#37)修复了在修改GroupName和GroupDesc时,左侧Group栏显示没刷新的问题。 -- (#38)修复了工程里没有shader的话,SBP构建会报异常的问题。 - -### Added - -- 新增了AssetsPackage.CheckPackageContentsAsync()方法 - - ```c# - /// - /// 检查本地包裹内容的完整性 - /// - public CheckPackageContentsOperation CheckPackageContentsAsync() - ``` - -### Changed - -- 优化了HostPlayMode的初始化逻辑,优先读取沙盒内的清单,如果不存在则读取内置清单。 - -- 重写了文件的加密和解密逻辑。 - - ```c# - public interface IDecryptionServices - { - /// - /// 文件偏移解密方法 - /// - ulong LoadFromFileOffset(DecryptFileInfo fileInfo); - - /// - /// 文件内存解密方法 - /// - byte[] LoadFromMemory(DecryptFileInfo fileInfo); - - /// - /// 文件流解密方法 - /// - System.IO.FileStream LoadFromStream(DecryptFileInfo fileInfo); - - /// - /// 文件流解密的托管缓存大小 - /// - uint GetManagedReadBufferSize(); - } - ``` - -- AssetBundleBuilder界面增加了构建版本选项。 - -### Removed - -- 移除了AssetsPackage.WeaklyUpdateManifestAsync()方法。 - -## [1.3.3] - 2022-10-27 - -### Fixed - -- 修复了资源回收方法无效的问题。 - -### Added - -- 新增了PackageVersion构建参数。 - - ````c# - public class BuildParameters - { - /// - /// 构建的包裹版本 - /// - public string PackageVersion; - } - ```` - -### Changed - -- AssetBundleDebugger窗口增加了包裹名称显示列。 -- AssetBundleDebugger窗口增加资源对象的加载耗时统计和显示。 -- AssetBundleDebugger窗口增加帧调试数据导出功能。 -- AssetBundleBuilder构建流程增加输出目录文件路径过长的检测。 -- 下载器返回的错误提示增加HTTP Response Code。 -- UpdateStaticVersionOperation.PackageCRC重名为UpdateStaticVersionOperation.PackageVersion。 -- AssetPackage.GetHumanReadableVersion()重名为AssetPackage.GetPackageVersion() - -## [1.3.2] - 2022-10-22 - -### Fixed - -- 修复了AssetBundleCollector界面点击修复按钮界面没有刷新的问题。 - -### Added - -- 新增了自定义证书认证方法。 - - ````c# - public static class YooAssets - { - /// - /// 设置下载系统参数,自定义的证书认证实例 - /// - public static void SetDownloadSystemCertificateHandler(UnityEngine.Networking.CertificateHandler instance) - } - ```` - -- 新增了下载失败后清理文件的方法。 - - ````c# - public static class YooAssets - { - /// - /// 设置下载系统参数,下载失败后清理文件的HTTP错误码 - /// - public static void SetDownloadSystemClearFileResponseCode(List codes) - } - ```` - -- 新增了检查资源定位地址是否有效的方法。 - - ```c# - public class AssetsPackage - { - /// - /// 检查资源定位地址是否有效 - /// - /// 资源的定位地址 - public bool CheckLocationValid(string location) - } - ``` - -### Removed - -- 移除了ILocationServices接口类和初始化字段。 -- 移除了AssetPackage.GetAssetPath(string location)方法。 -- 移除了BuildParameters.EnableAddressable字段。 - -### Changed - -- AssetBundleCollector配置增加了UniqueBundleName设置,用于解决不同包裹之间Bundle名称冲突的问题。 - -## [1.3.1] - 2022-10-18 - -### Fixed - -- 修复了原生文件每次获取都重复拷贝的问题。 -- 修复了断点续传下载字节数统计不准确的问题。 - -### Added - -- 所有下载相关方法增加超时判断参数。 - -- 新增首包资源文件拷贝选项。 - - ```c# - public class BuildParameters - { - /// - /// 拷贝内置资源选项 - /// - public ECopyBuildinFileOption CopyBuildinFileOption = ECopyBuildinFileOption.None; - - /// - /// 拷贝内置资源的标签 - /// - public string CopyBuildinFileTags = string.Empty; - } - ``` - -- 新增资源包初始化查询字段。 - - ```c# - public class AssetsPackage - { - /// - /// 初始化状态 - /// - public EOperationStatus InitializeStatus - } - ``` - -- 增加获取人类可读的版本信息。 - - ````c# - public class AssetsPackage - { - /// - /// 获取人类可读的版本信息 - /// - public string GetHumanReadableVersion() - } - ```` - -- 新增资源缓存清理方法。 - - ```c# - public static class YooAssets - { - /// - /// 清理未使用的缓存文件 - /// - public static ClearUnusedCacheFilesOperation ClearUnusedCacheFiles() - } - ``` - -- 异步操作类新增繁忙查询方法。 - - ````c# - public abstract class GameAsyncOperation - { - /// - /// 异步操作系统是否繁忙 - /// - protected bool IsBusy() - } - ```` - -### Removed - -- 移除了AssetsPackage.IsInitialized()方法。 -- 移除了YooAssets.ClearAllCacheFiles()方法。 - -### Changed - -- YooAssetsPackage类重名为AssetsPackage - -## [1.3.0-preview] - 2022-10-08 - -该预览版本提供了分布式构建的功能,用于解决分工程或分内容构建的问题。 - -### Added - -- 新增方法设置异步系统的每帧允许运行的最大时间切片。 - - ```c# - /// - /// 设置异步系统的每帧允许运行的最大时间切片(单位:毫秒) - /// - public static void SetOperationSystemMaxTimeSlice(long milliseconds) - ``` - -- 新增方法设置缓存系统的已经缓存文件的校验等级。 - - ```c# - /// - /// 设置缓存系统的已经缓存文件的校验等级 - /// - public static void SetCacheSystemCachedFileVerifyLevel(EVerifyLevel verifyLevel) - ``` - -- 新增方法设置下载系统的断点续传功能的文件大小。 - - ````C# - /// - /// 启用下载系统的断点续传功能的文件大小 - /// - public static void SetDownloadSystemBreakpointResumeFileSize(int fileBytes) - ```` - -### Removed - -- 移除了资源版本号相关概念的代码。 -- 移除了TaskCopyBuildinFiles节点在构建流程里。 -- 移除了YooAssets.ClearUnusedCacheFiles()方法。 -- 移除了初始化参数 InitializeParameters.ClearCacheOnDirty -- 移除了初始化参数 InitializeParameters.OperationSystemMaxTimeSlice -- 移除了初始化参数 InitializeParameters.BreakpointResumeFileSize -- 移除了初始化参数 InitializeParameters.VerifyLevel - -## [1.2.4] - 2022-09-22 - -### Fixed - -- 修复了加密文件下载验证失败的问题。 -- 修复了可编程构建管线下模拟构建模式报错的问题。 - -### Changed - -- 可编程构建管线强制使用增量构建模式。 -- 移除了对Gizmos资源的打包限制。 -- AssetBundleCollector窗口增加配置表修复功能。 - -## [1.2.3] - 2022-09-09 - -### Fixed - -- 修复了资源收集器无法识别.bank音频文件格式。 - -### Changed - -- **HostPlayMode正式支持WebGL平台。** -- AssetBundleCollector里的着色器收集选项已经移除,现在必定收集。 -- AssetBundleCollector修改了默认的打包规则类。 -- AssetBundleBuilder现在构建结果增加补丁包目录。 -- 更新了UniTask的Sample。 -- 优化了缓存系统的代码结构。 -- 使用了新的断点续传下载器。 - -### Added - -- 增加清理缓存资源的异步操作类。 - -````c# -/// -/// 清空未被使用的缓存文件 -/// -public static ClearUnusedCacheFilesOperation ClearUnusedCacheFiles(); -```` - -## [1.2.2] - 2022-07-31 - -### Fixed - -- 修复了加载多个相同的子场景而无法全部卸载的问题。 - -### Changed - -- ShaderVariantCollecor支持在CI上调用运行。 - -- 资源补丁清单增加文件版本校验功能。 - -- AssetBundleBuilder现在构建结果可以查询构建失败信息。 - -- AssetBundleBuilder现在资源包文件名称样式提供选择功能。 - - ````c# - class BuildParameters - { - /// - /// 补丁文件名称的样式 - /// - public EOutputNameStyle OutputNameStyle; - } - ```` - -### Added - -- 增加获取资源信息新方法。 - - ````c# - /// - /// 获取资源信息 - /// - /// 资源的定位地址 - public static AssetInfo GetAssetInfo(string location); - ```` - -## [1.2.1] - 2022-07-23 - -### Fixed - -- (#25)修复了资源文件不存在返回的handle无法完成的问题。 -- (#26)修复多个场景打进一个AB包时,卸载子场景时抛出异常。 - -### Changed - -- 构建报告里增加主资源总数的统计。 -- 资源构建系统里修改了内置构建管线的构建结果验证逻辑,移除了对中文路径的检测。 -- 资源构建系统里移除了对增量更新初次无法构建的限制。 -- 优化了缓存验证逻辑,不期望删除断点续传的资源文件。 -- 资源构建系统里SBP构建参数增加了缓存服务器的地址和端口。 - -## [1.2.0] - 2022-07-18 - -### Fixed - -- 修复了ShaderVariantCollection刷新不及时问题。 - -### Changed - -- 资源收集忽略了Gizmos资源文件。 -- 解密服务接口增加解密文件信息参数。 -- 资源收集窗体增加配置保存按钮。 -- 资源构建窗体增加配置保存按钮。 - -### Added - -- 资源构建模块增加了可编程构建管线(SBP)的支持,开发者可以在内置构建管线和可编程构建管线之间自由选择,零修改成本。 - -## [1.1.1] - 2022-07-07 - -### Fixed - -- 修复了AssetBundleDebugger窗口,View下拉页签切换无效的问题。 -- 修复了在Unity2020.3版本下UniTask在真机上的一个IL2CPP相关的错误。 - -### Changed - -- 优化了AssetBundleDebugger窗口,增加了帧数显示以及回放功能。 -- 优化了AssetBundleBuilder的代码结构。 -- 增强了YooAssets.GetRawFileAsync()方法的容错。 - -### Added - -- 新增了OperationHandleBase.GetAssetInfo()方法。 - - ````c# - /// - /// 获取资源信息 - /// - public AssetInfo GetAssetInfo(); - ```` - -- 新增了AssetOperationHandle.GetAssetObjet()方法。 - - ````c# - /// - /// 获取资源对象 - /// - /// 资源类型 - public TAsset GetAssetObjet(); - ```` - -- 新增了弱联网情况下加载补丁清单方法。 - - ````c# - /// - /// 弱联网情况下加载补丁清单 - /// 注意:当指定版本内容验证失败后会返回失败。 - /// - /// 指定的资源版本 - public static UpdateManifestOperation WeaklyUpdateManifestAsync(int resourceVersion); - ```` - -### Removed - -- 离线运行模式(OfflinePlayMode)下移除了资内置资源解压相关逻辑。 -- 移除了初始化参数:AutoReleaseGameObjectHandle及相关代码逻辑。 - -## [1.1.0] - 2022-06-23 - -### Fixed - -- 修复了AssetBundleCollector窗口,在切换EnableAddressable时未及时刷新界面的问题。 -- 修复了AssetBundleCollector窗口,资源过滤器CollectSprite无效的问题。 -- 修复了AssetBundleCollector窗口,无法正常预览StaticAssetCollector的资源列表的问题。 -- 修复了在离线模式下原生文件每次都从包内加载的问题。 - -### Changed - -- 变更了共享资源打包机制。 -- AssetBundleCollector窗口增加了分组禁用功能。 -- AssetBundleDebugger窗口增加了真机远程调试功能。 -- AssetBundleBuilder窗口在构建成功后自动显示构建文件夹。 -- DownloaderOperation.OnDownloadFileFailedCallback委托变更为OnDownloadErrorCallback委托。 - -### Added - -- 新增UpdateManifestOperation.FoundNewManifest字段。 -- 新增DownloaderOperation.OnStartDownloadFileCallback委托。 -- 新增AssetInfo.Address字段。 -- 新增YooAssets.IsInitialized字段。 -- 新增YooAssets初始化参数。 - - ````c# - /// - /// 下载文件校验等级 - /// - public EVerifyLevel VerifyLevel = EVerifyLevel.High; - ```` - -- 新增YooAssets获取资源完成路径的方法。 - - ````c# - /// - /// 获取资源路径 - /// - /// 资源的定位地址 - /// 如果location地址无效,则返回空字符串 - public static string GetAssetPath(string location); - ```` - -- 新增YooAssets初始化参数。 - - ```c# - /// - /// 自动释放游戏对象所属资源句柄 - /// 说明:通过资源句柄实例化的游戏对象在销毁之后,会自动释放所属资源句柄。 - /// - public bool AutoReleaseGameObjectHandle = false; - ``` - -## [1.0.10] - 2022-05-22 - -### Fixed - -- 修复了资源收集配置存在多个的时候,导致后续无法打开窗口的问题。 -- 修复了在编辑器模拟模式下加载精灵图片失败的问题。 -- 修复了在Unity2019版本无法识别配置文件的问题。 - -### Changed - -- 资源构建增加内置资源文件(首包资源文件)拷贝的选项。 -- 补丁下载器增加暂停方法和恢复方法。 -- 在资源收集界面,对Collector的增加和删除支持撤销和恢复操作。 - -## [1.0.9] - 2022-05-14 - -### Fixed - -- 修复了YooAssets.GetAssetInfos(string Tag)方法返回了无关的资源信息的问题。 - -### Changed - -- 编辑器下的模拟运行模式,不再依赖配置里的构建版本。 -- 更新资源清单结构,资源对象类增加分类标签。 -- 优化了资源工具相关配置文件的加载方式和途径,这些配置文件可以放置在任何目录下。 -- 优化了Location无效后的错误报告方式。 -- 优化了资源包的构建参数,现在始终开启DisableLoadAssetByFileName,帮助减小运行时的内存。 -- YooAssets.ProcessOperation()重命名为YooAssets.StartOperation() - -### Added - -- 新增YooAssets.IsNeedDownloadFromRemote()方法。 - - ````c# - public static bool IsNeedDownloadFromRemote(string location); - ```` - -- 新增获取所有子资源对象的方法。 - - ````c# - class SubAssetsOperationHandle - { - public TObject[] GetSubAssetObjects(); - } - ```` - -### Removed - -- YooAssets.GetBundleInfo()方法已经移除。 - -## [1.0.8] - 2022-05-08 - -### Fixed - -- 修复了资源收集器导出配置文件时没有导出公共设置。 -- 修复了不兼容Unity2018版本的错误。 - -### Changed - -- AssetBundleGrouper窗口变更为AssetBundleCollector窗口。 -- **优化了编辑器下模拟运行的初始化速度**。 -- **优化了资源收集窗口打开时卡顿的问题**。 -- 资源收集XML配表支持版本兼容。 -- 资源报告查看窗口支持预览AssetBundle文件内容的功能。 -- 完善了对UniTask的支持。 -- YooAssets所有接口支持初始化容错检测。 - -### Added - -- 异步操作类增加进度查询字段。 - - ```c# - class AsyncOperationBase - { - /// - /// 处理进度 - /// - public float Progress { get; protected set; } - } - ``` - -- 增加开启异步操作的方法。 - - ```c# - /// - /// 开启一个异步操作 - /// - /// 异步操作对象 - public static void ProcessOperaiton(GameAsyncOperation operation) - ``` - -- 新增编辑器下模拟模式的初始化参数。 - - ````c# - /// - /// 用于模拟运行的资源清单路径 - /// 注意:如果路径为空,会自动重新构建补丁清单。 - /// - public string SimulatePatchManifestPath; - ```` - -- 新增通用的初始化参数。 - - ```c# - /// - /// 资源定位地址大小写不敏感 - /// - public bool LocationToLower = false; - ``` - -## [1.0.7] - 2022-05-04 - -### Fixed - -- 修复了异步操作系统的Task再次等待无效的问题。 - -### Changed - -- YooAssets.LoadRawFileAsync()方法重新命名为YooAssets.GetRawFileAsync() -- YooAssetSetting文件夹支持了全路径搜索定位。 -- 优化了打包的核心逻辑,对依赖资源进行自动划分,以及支持设置依赖资源收集器。 -- 初始化的时候,删除验证失败的资源文件。 -- 构建报告浏览窗口支持排序功能。 -- 着色器变种收集工具支持了配置缓存。 - -### Added - -- 支持可寻址资源定位系统,包括编辑器和运行时环境。 -- 增加快速构建模式,用于EditorPlayMode完美模拟线上环境。 -- 增加了Window Dock功能,已打开的界面会自动停靠在一个窗体下。 -- 增加一个新的打包规则:PackTopDirectory。 -- 增加获取资源信息的方法。 - ```c# - public static AssetInfo[] GetAssetInfos(string tag) - ``` -- 增加补丁下载器下载全部资源的方法。 - ```c# - public static PatchDownloaderOperation CreatePatchDownloader(int downloadingMaxNumber, int failedTryAgain) - ``` -- 增加指定资源版本的资源更新下载方法。 - ```c# - public static UpdatePackageOperation UpdatePackageAsync(int resourceVersion, int timeout = 60) - ``` - -### Removed - -- 移除了自动释放资源的初始化参数。 - -## [1.0.6] - 2022-04-26 - -### Fixed - -- 修复工具界面显示异常在Unity2021版本下。 - -### Changed - -- 操作句柄支持错误信息查询。 -- 支持UniTask异步操作库。 -- 优化类型搜索方式,改为全域搜索类型。 -- AssetBundleGrouper窗口添加和移除Grouper支持操作回退。 - -## [1.0.5] - 2022-04-22 - -### Fixed - -- 修复了非主动收集的着色器没有打进统一的着色器资源包的问题。 -- 修复了单个收集的资源对象没有设置依赖资源列表的问题。 -- 修复Task异步加载一直等待的问题。 - -### Changed - -- 资源打包的过滤文件列表增加cginc格式。 -- 增加编辑器扩展的支持,第三方实现YooAsset插件。 -- 优化原生文件加载逻辑,支持离线运行模式和编辑器运行模式。 -- 优化场景卸载逻辑,在加载新的主场景的时候自动卸载已经加载的所有场景。 -- 支持演练构建模式,在不生成资源包的情况下快速构建查看结果。 -- 新增调试信息,出生场景和出生时间。 - -## [1.0.4] - 2022-04-18 - -### Fixed - -- 修复资源清单附加版本之后引发的一个流程错误。 -- 修复原生文件拷贝目录不存导致的加载失败。 - -### Changed - -- 在编辑器下检测资源路径是否合法并警告。 -- 完善原生文件异步加载接口。 - -## [1.0.3] - 2022-04-14 - -### Fixed - -- 修复了AssetBundleDebugger窗口的BundleView视口下,Using列表显示不完整的问题。 -- 修复了AssetBundleDebugger窗口的BundleView视口下,Bundle列表内元素重复的问题。 -- 修复了特殊情况下依赖的资源包列表里包含主资源包的问题。 - -### Changed - -- 实例化GameObject的时候,如果没有传递坐标和角度则使用默认值。 -- 优化了资源分组配置保存策略,修改为窗口关闭时保存。 -- 简化了资源版本概念,降低学习成本,统一了CDN上的目录结构。 -- 资源定位接口扩展,方便开发可寻址资产定位功能。 - -### Added - -- 离线运行模式支持WEBGL平台。 -- 保留构建窗口界面的配置数据。 - -## [1.0.2] - 2022-04-07 - -### Fixed - -- 修复在资源加载完成回调内释放自身资源句柄时的异常报错。 -- 修复了资源分组在特殊情况下打包报错的问题。 - -### Changed - -- StreamingAssets目录下增加了用于存放打包资源的总文件夹。 - -## [1.0.1] - 2022-04-07 - -### Fixed - -- 修复Assets目录下存在多个YooAsset同名文件夹时,工具窗口无法显示的问题。 -- 修复通过Packages导入YooAsset,工具窗口无法显示的问题。 - -## [1.0.0] - 2022-04-05 -*Compatible with Unity 2019.4* - diff --git a/UnityProject/Assets/Dependencies/YooAsset/CHANGELOG.md.meta b/UnityProject/Assets/Dependencies/YooAsset/CHANGELOG.md.meta deleted file mode 100644 index 838e3ede..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/CHANGELOG.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: db680274cf006c548abff57b7e1894b4 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor.meta b/UnityProject/Assets/Dependencies/YooAsset/Editor.meta index 22c28890..9e9903b1 100644 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor.meta +++ b/UnityProject/Assets/Dependencies/YooAsset/Editor.meta @@ -1,8 +1,3 @@ fileFormatVersion: 2 -guid: ac093515ae764b94aa07be91d4ba978b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: +guid: f7a4e334b34849beaebc8ea8184f7a29 +timeCreated: 1716799346 \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder.meta b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder.meta deleted file mode 100644 index c1b5f4bc..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1fdecc5500229d44887425ce619352fc -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs deleted file mode 100644 index 88b82e0b..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace YooAsset.Editor -{ - public class AssetBundleBuilder - { - private readonly BuildContext _buildContext = new BuildContext(); - - /// - /// 开始构建 - /// - public BuildResult Run(BuildParameters buildParameters) - { - // 清空旧数据 - _buildContext.ClearAllContext(); - - // 检测构建参数是否为空 - if (buildParameters == null) - throw new Exception($"{nameof(buildParameters)} is null !"); - - // 检测可编程构建管线参数 - if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline) - { - if (buildParameters.SBPParameters == null) - throw new Exception($"{nameof(BuildParameters.SBPParameters)} is null !"); - - if (buildParameters.BuildMode == EBuildMode.DryRunBuild) - throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !"); - - if (buildParameters.BuildMode == EBuildMode.ForceRebuild) - throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !"); - } - - // 构建参数 - var buildParametersContext = new BuildParametersContext(buildParameters); - _buildContext.SetContextObject(buildParametersContext); - - // 创建构建节点 - List pipeline; - if (buildParameters.BuildPipeline == EBuildPipeline.BuiltinBuildPipeline) - { - pipeline = new List - { - new TaskPrepare(), //前期准备工作 - new TaskGetBuildMap(), //获取构建列表 - new TaskBuilding(), //开始执行构建 - new TaskCopyRawFile(), //拷贝原生文件 - new TaskVerifyBuildResult(), //验证构建结果 - new TaskEncryption(), //加密资源文件 - new TaskUpdateBundleInfo(), //更新资源包信息 - new TaskCreateManifest(), //创建清单文件 - new TaskCreateReport(), //创建报告文件 - new TaskCreatePackage(), //制作包裹 - new TaskCopyBuildinFiles(), //拷贝内置文件 - }; - } - else if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline) - { - pipeline = new List - { - new TaskPrepare(), //前期准备工作 - new TaskGetBuildMap(), //获取构建列表 - new TaskBuilding_SBP(), //开始执行构建 - new TaskCopyRawFile(), //拷贝原生文件 - new TaskVerifyBuildResult_SBP(), //验证构建结果 - new TaskEncryption(), //加密资源文件 - new TaskUpdateBundleInfo(), //更新补丁信息 - new TaskCreateManifest(), //创建清单文件 - new TaskCreateReport(), //创建报告文件 - new TaskCreatePackage(), //制作补丁包 - new TaskCopyBuildinFiles(), //拷贝内置文件 - }; - } - else - { - throw new NotImplementedException(); - } - - // 初始化日志 - BuildLogger.InitLogger(buildParameters.EnableLog); - - // 执行构建流程 - var buildResult = BuildRunner.Run(pipeline, _buildContext); - if (buildResult.Success) - { - buildResult.OutputPackageDirectory = buildParametersContext.GetPackageOutputDirectory(); - BuildLogger.Log($"{buildParameters.BuildMode} pipeline build succeed !"); - } - else - { - BuildLogger.Warning($"{buildParameters.BuildMode} pipeline build failed !"); - BuildLogger.Error($"Build task failed : {buildResult.FailedTask}"); - BuildLogger.Error($"Build task error : {buildResult.FailedInfo}"); - } - - return buildResult; - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs deleted file mode 100644 index ab0f9336..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.IO; -using UnityEngine; -using UnityEditor; - -namespace YooAsset.Editor -{ - public static class AssetBundleBuilderHelper - { - /// - /// 获取默认的输出根路录 - /// - public static string GetDefaultOutputRoot() - { - string projectPath = EditorTools.GetProjectPath(); - return $"{projectPath}/Bundles"; - } - - /// - /// 获取流文件夹路径 - /// - public static string GetStreamingAssetsFolderPath() - { - return $"{Application.dataPath}/StreamingAssets/{YooAssetSettings.StreamingAssetsBuildinFolder}/"; - } - - /// - /// 清空流文件夹 - /// - public static void ClearStreamingAssetsFolder() - { - string streamingFolderPath = GetStreamingAssetsFolderPath(); - EditorTools.ClearFolder(streamingFolderPath); - } - - /// - /// 删除流文件夹内无关的文件 - /// 删除.manifest文件和.meta文件 - /// - public static void DeleteStreamingAssetsIgnoreFiles() - { - string streamingFolderPath = GetStreamingAssetsFolderPath(); - if (Directory.Exists(streamingFolderPath)) - { - string[] files = Directory.GetFiles(streamingFolderPath, "*.manifest", SearchOption.AllDirectories); - foreach (var file in files) - { - FileInfo info = new FileInfo(file); - info.Delete(); - } - - files = Directory.GetFiles(streamingFolderPath, "*.meta", SearchOption.AllDirectories); - foreach (var item in files) - { - FileInfo info = new FileInfo(item); - info.Delete(); - } - } - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs.meta b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs.meta deleted file mode 100644 index 2cbe1606..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f48abdec05f0dbe438a83e181fe6bc93 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs deleted file mode 100644 index 19f23d49..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using UnityEngine; - -namespace YooAsset.Editor -{ - public class AssetBundleBuilderSetting : ScriptableObject - { - /// - /// 构建管线 - /// - public EBuildPipeline BuildPipeline = EBuildPipeline.BuiltinBuildPipeline; - - /// - /// 构建模式 - /// - public EBuildMode BuildMode = EBuildMode.ForceRebuild; - - /// - /// 构建的包裹名称 - /// - public string BuildPackage = string.Empty; - - /// - /// 压缩方式 - /// - public ECompressOption CompressOption = ECompressOption.LZ4; - - /// - /// 输出文件名称样式 - /// - public EOutputNameStyle OutputNameStyle = EOutputNameStyle.HashName; - - /// - /// 首包资源文件的拷贝方式 - /// - public ECopyBuildinFileOption CopyBuildinFileOption = ECopyBuildinFileOption.None; - - /// - /// 首包资源文件的标签集合 - /// - public string CopyBuildinFileTags = string.Empty; - - /// - /// 加密类名称 - /// - public string EncyptionClassName = string.Empty; - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs.meta b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs.meta deleted file mode 100644 index a8a559c2..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 09788b4733bab2d4792fdd5d28e7653c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs deleted file mode 100644 index 353931b6..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace YooAsset.Editor -{ - public class AssetBundleBuilderSettingData - { - private static AssetBundleBuilderSetting _setting = null; - public static AssetBundleBuilderSetting Setting - { - get - { - if (_setting == null) - LoadSettingData(); - return _setting; - } - } - - /// - /// 配置数据是否被修改 - /// - public static bool IsDirty { set; get; } = false; - - /// - /// 加载配置文件 - /// - private static void LoadSettingData() - { - _setting = SettingLoader.LoadSettingData(); - } - - /// - /// 存储文件 - /// - public static void SaveFile() - { - if (Setting != null) - { - IsDirty = false; - EditorUtility.SetDirty(Setting); - AssetDatabase.SaveAssets(); - Debug.Log($"{nameof(AssetBundleBuilderSetting)}.asset is saved!"); - } - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs.meta b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs.meta deleted file mode 100644 index 4d7c62ec..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 24698266f028e4a47bb88f091fd64547 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderTools.cs b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderTools.cs deleted file mode 100644 index 2216fc4f..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderTools.cs +++ /dev/null @@ -1,215 +0,0 @@ -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using UnityEditor.Animations; - -namespace YooAsset.Editor -{ - public static class AssetBundleBuilderTools - { - /// - /// 检测所有损坏的预制体文件 - /// - public static void CheckCorruptionPrefab(List searchDirectorys) - { - if (searchDirectorys.Count == 0) - throw new Exception("路径列表不能为空!"); - - // 获取所有资源列表 - int checkCount = 0; - int invalidCount = 0; - string[] findAssets = EditorTools.FindAssets(EAssetSearchType.Prefab, searchDirectorys.ToArray()); - foreach (string assetPath in findAssets) - { - UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object)); - if (prefab == null) - { - invalidCount++; - Debug.LogError($"发现损坏预制件:{assetPath}"); - } - EditorTools.DisplayProgressBar("检测预制件文件是否损坏", ++checkCount, findAssets.Length); - } - EditorTools.ClearProgressBar(); - - if (invalidCount == 0) - Debug.Log($"没有发现损坏预制件"); - } - - /// - /// 检测所有动画控制器的冗余状态 - /// - public static void FindRedundantAnimationState(List searchDirectorys) - { - if (searchDirectorys.Count == 0) - throw new Exception("路径列表不能为空!"); - - // 获取所有资源列表 - int checkCount = 0; - int findCount = 0; - string[] findAssets = EditorTools.FindAssets(EAssetSearchType.RuntimeAnimatorController, searchDirectorys.ToArray()); - foreach (string assetPath in findAssets) - { - AnimatorController animator= AssetDatabase.LoadAssetAtPath(assetPath); - if (FindRedundantAnimationState(animator)) - { - findCount++; - Debug.LogWarning($"发现冗余的动画控制器:{assetPath}"); - } - EditorTools.DisplayProgressBar("检测冗余的动画控制器", ++checkCount, findAssets.Length); - } - EditorTools.ClearProgressBar(); - - if (findCount == 0) - Debug.Log($"没有发现冗余的动画控制器"); - else - AssetDatabase.SaveAssets(); - } - - /// - /// 清理所有材质球的冗余属性 - /// - public static void ClearMaterialUnusedProperty(List searchDirectorys) - { - if (searchDirectorys.Count == 0) - throw new Exception("路径列表不能为空!"); - - // 获取所有资源列表 - int checkCount = 0; - int removedCount = 0; - string[] findAssets = EditorTools.FindAssets(EAssetSearchType.Material, searchDirectorys.ToArray()); - foreach (string assetPath in findAssets) - { - Material mat = AssetDatabase.LoadAssetAtPath(assetPath); - if (ClearMaterialUnusedProperty(mat)) - { - removedCount++; - Debug.LogWarning($"材质球已被处理:{assetPath}"); - } - EditorTools.DisplayProgressBar("清理冗余的材质球", ++checkCount, findAssets.Length); - } - EditorTools.ClearProgressBar(); - - if (removedCount == 0) - Debug.Log($"没有发现冗余的材质球"); - else - AssetDatabase.SaveAssets(); - } - - - /// - /// 清理无用的材质球属性 - /// - private static bool ClearMaterialUnusedProperty(Material mat) - { - bool removeUnused = false; - SerializedObject so = new SerializedObject(mat); - SerializedProperty sp = so.FindProperty("m_SavedProperties"); - - sp.Next(true); - do - { - if (sp.isArray == false) - continue; - - for (int i = sp.arraySize - 1; i >= 0; --i) - { - var p1 = sp.GetArrayElementAtIndex(i); - if (p1.isArray) - { - for (int ii = p1.arraySize - 1; ii >= 0; --ii) - { - var p2 = p1.GetArrayElementAtIndex(ii); - var val = p2.FindPropertyRelative("first"); - if (mat.HasProperty(val.stringValue) == false) - { - Debug.Log($"Material {mat.name} remove unused property : {val.stringValue}"); - p1.DeleteArrayElementAtIndex(ii); - removeUnused = true; - } - } - } - else - { - var val = p1.FindPropertyRelative("first"); - if (mat.HasProperty(val.stringValue) == false) - { - Debug.Log($"Material {mat.name} remove unused property : {val.stringValue}"); - sp.DeleteArrayElementAtIndex(i); - removeUnused = true; - } - } - } - } - while (sp.Next(false)); - so.ApplyModifiedProperties(); - return removeUnused; - } - - /// - /// 查找动画控制器里冗余的动画状态机 - /// - private static bool FindRedundantAnimationState(AnimatorController animatorController) - { - if (animatorController == null) - return false; - - string assetPath = AssetDatabase.GetAssetPath(animatorController); - - // 查找使用的状态机名称 - List usedStateNames = new List(); - foreach (var layer in animatorController.layers) - { - foreach (var state in layer.stateMachine.states) - { - usedStateNames.Add(state.state.name); - } - } - - List allLines = new List(); - List stateIndexList = new List(); - using (StreamReader reader = File.OpenText(assetPath)) - { - string content; - while (null != (content = reader.ReadLine())) - { - allLines.Add(content); - if (content.StartsWith("AnimatorState:")) - { - stateIndexList.Add(allLines.Count - 1); - } - } - } - - List allStateNames = new List(); - foreach (var index in stateIndexList) - { - for (int i = index; i < allLines.Count; i++) - { - string content = allLines[i]; - content = content.Trim(); - if (content.StartsWith("m_Name")) - { - string[] splits = content.Split(':'); - string name = splits[1].TrimStart(' '); //移除前面的空格 - allStateNames.Add(name); - break; - } - } - } - - bool foundRedundantState = false; - foreach (var stateName in allStateNames) - { - if (usedStateNames.Contains(stateName) == false) - { - Debug.LogWarning($"发现冗余的动画文件:{assetPath}={stateName}"); - foundRedundantState = true; - } - } - return foundRedundantState; - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderTools.cs.meta b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderTools.cs.meta deleted file mode 100644 index 769e38e0..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderTools.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fe50795c51a46884088139b840c1557f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs deleted file mode 100644 index 9e4b8eae..00000000 --- a/UnityProject/Assets/Dependencies/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs +++ /dev/null @@ -1,358 +0,0 @@ -#if UNITY_2019_4_OR_NEWER -using System; -using System.Linq; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; -using UnityEditor.UIElements; -using UnityEngine.UIElements; - -namespace YooAsset.Editor -{ - public class AssetBundleBuilderWindow : EditorWindow - { - [MenuItem("YooAsset/AssetBundle Builder", false, 102)] - public static void ShowExample() - { - AssetBundleBuilderWindow window = GetWindow("资源包构建工具", true, WindowsDefine.DockedWindowTypes); - window.minSize = new Vector2(800, 600); - } - - private BuildTarget _buildTarget; - private List _encryptionServicesClassTypes; - private List _encryptionServicesClassNames; - private List _buildPackageNames; - - private Button _saveButton; - private TextField _buildOutputField; - private EnumField _buildPipelineField; - private EnumField _buildModeField; - private TextField _buildVersionField; - private PopupField _buildPackageField; - private PopupField _encryptionField; - private EnumField _compressionField; - private EnumField _outputNameStyleField; - private EnumField _copyBuildinFileOptionField; - private TextField _copyBuildinFileTagsField; - - public void CreateGUI() - { - try - { - VisualElement root = this.rootVisualElement; - - // 加载布局文件 - var visualAsset = UxmlLoader.LoadWindowUXML(); - if (visualAsset == null) - return; - - visualAsset.CloneTree(root); - - // 配置保存按钮 - _saveButton = root.Q