From af825a860e6d3afccae8d5e3bf33a882ef98dc2e Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Fri, 7 Apr 2023 16:05:44 +0800 Subject: [PATCH] Remove AssetTag Remove AssetTag --- .../GameFramework/Resource/AssetTag.cs | 42 ------------------- .../GameFramework/Resource/AssetTag.cs.meta | 3 -- .../GameFramework/Resource/ResourceManager.cs | 21 ---------- 3 files changed, 66 deletions(-) delete mode 100644 Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs delete mode 100644 Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs.meta diff --git a/Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs b/Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs deleted file mode 100644 index 3b5790c2..00000000 --- a/Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs +++ /dev/null @@ -1,42 +0,0 @@ -using UnityEngine; -using YooAsset; - -namespace TEngine -{ - /// - /// 资源标识。 - /// - [DisallowMultipleComponent, AddComponentMenu("")] - public sealed class AssetTag: MonoBehaviour - { - private AssetOperationHandle _operationHandle; - - private int _instanceID = 0; - - private string location; - - private void Awake() - { - if (location != null && (_instanceID == -1 || _instanceID != gameObject.GetInstanceID())) - { - // Bind(GetAsset(operation, assetLocation)); - } - } - - public void Bind(AssetOperationHandle operation,string assetLocation) - { - _operationHandle = operation; - this.location = assetLocation; - _instanceID = gameObject.GetInstanceID(); - } - - private void OnDestroy() - { - if (_operationHandle != null) - { - _operationHandle.Release(); - _operationHandle = null; - } - } - } -} \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs.meta b/Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs.meta deleted file mode 100644 index 55aa5b44..00000000 --- a/Assets/TEngine/Runtime/GameFramework/Resource/AssetTag.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 854f63fe041d43f0ab0f76b1059eab89 -timeCreated: 1680592471 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs index 365b7dd9..1af2fa84 100644 --- a/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs +++ b/Assets/TEngine/Runtime/GameFramework/Resource/ResourceManager.cs @@ -310,7 +310,6 @@ namespace TEngine if (typeof(T) == typeof(GameObject)) { GameObject ret = handle.InstantiateSync(); - BindAssetTag(ret, handle, assetName); return ret as T; } else @@ -338,7 +337,6 @@ namespace TEngine if (typeof(T) == typeof(GameObject)) { GameObject ret = handle.InstantiateSync(parent); - BindAssetTag(ret, handle, assetName); return ret as T; } else @@ -432,8 +430,6 @@ namespace TEngine await handle.ToUniTask(cancellationToken:cancellationToken); GameObject ret = handle.InstantiateSync(); - - BindAssetTag(ret, handle, assetName); return ret; } @@ -485,22 +481,5 @@ namespace TEngine { return YooAssets.LoadSceneAsync(assetInfo,sceneMode,activateOnLoad,priority); } - - private bool BindAssetTag(GameObject go,AssetOperationHandle handle,string location) - { - if (go == null) - { - throw new GameFrameworkException($"ResourceMgr BindAssetTag Failed! GameObject is null!"); - } - - if (handle == null) - { - throw new GameFrameworkException($"ResourceMgr BindAssetTag Failed! AssetOperationHandle is null!"); - } - - go.AddComponent().Bind(handle,location); - - return true; - } } } \ No newline at end of file