From 51aeb8b5639d2ecbd785ab32d629ee96c759e962 Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 7 Mar 2022 14:37:50 +0800 Subject: [PATCH] Update YooAssets --- Assets/YooAsset/Runtime/YooAssets.cs | 86 +++++++++------------------- 1 file changed, 28 insertions(+), 58 deletions(-) diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index 13bfe49..4caf8cf 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -122,8 +122,8 @@ namespace YooAsset if (_isInitialize == false) { _isInitialize = true; - UnityEngine.GameObject driver = new UnityEngine.GameObject("[YooAsset]"); - var driverGo = driver.AddComponent().gameObject; + UnityEngine.GameObject driverGo = new UnityEngine.GameObject("[YooAsset]"); + driverGo.AddComponent(); UnityEngine.Object.DontDestroyOnLoad(driverGo); } else @@ -222,33 +222,6 @@ namespace YooAsset } - - /// - /// 更新资源系统 - /// - internal static void InternalUpdate() - { - // 更新异步请求操作 - OperationUpdater.Update(); - - // 更新下载管理系统 - DownloadSystem.Update(); - - // 轮询更新资源系统 - AssetSystem.Update(); - - // 自动释放零引用资源 - if (_releaseCD > 0) - { - _releaseTimer += UnityEngine.Time.unscaledDeltaTime; - if (_releaseTimer >= _releaseCD) - { - _releaseTimer = 0f; - AssetSystem.UnloadUnusedAssets(); - } - } - } - /// /// 获取资源版本号 /// @@ -278,35 +251,6 @@ namespace YooAsset } } - /// - /// 获取内置资源标记列表 - /// - public static string[] GetManifestBuildinTags() - { - if (_playMode == EPlayMode.EditorPlayMode) - { - if (_editorPlayModeImpl == null) - throw new Exception("YooAsset is not initialized."); - return _editorPlayModeImpl.GetManifestBuildinTags(); - } - else if (_playMode == EPlayMode.OfflinePlayMode) - { - if (_offlinePlayModeImpl == null) - throw new Exception("YooAsset is not initialized."); - return _offlinePlayModeImpl.GetManifestBuildinTags(); - } - else if (_playMode == EPlayMode.HostPlayMode) - { - if (_hostPlayModeImpl == null) - throw new Exception("YooAsset is not initialized."); - return _hostPlayModeImpl.GetManifestBuildinTags(); - } - else - { - throw new NotImplementedException(); - } - } - /// /// 获取资源包信息 /// @@ -532,6 +476,32 @@ namespace YooAsset #endregion #region 内部方法 + /// + /// 更新资源系统 + /// + internal static void InternalUpdate() + { + // 更新异步请求操作 + OperationUpdater.Update(); + + // 更新下载管理系统 + DownloadSystem.Update(); + + // 轮询更新资源系统 + AssetSystem.Update(); + + // 自动释放零引用资源 + if (_releaseCD > 0) + { + _releaseTimer += UnityEngine.Time.unscaledDeltaTime; + if (_releaseTimer >= _releaseCD) + { + _releaseTimer = 0f; + AssetSystem.UnloadUnusedAssets(); + } + } + } + /// /// 定位地址转换为资源路径 ///