diff --git a/Assets/BITKit/Core/Tag/ITag.cs b/Assets/BITKit/Core/Tag/ITag.cs index 9aca77bc5..259d83648 100644 --- a/Assets/BITKit/Core/Tag/ITag.cs +++ b/Assets/BITKit/Core/Tag/ITag.cs @@ -1,8 +1,10 @@ +using System.Collections.Generic; + namespace BITKit { public interface ITag { int Hash { get; } - string[] GetTags(); + IReadOnlyCollection Tags { get; } } } \ No newline at end of file diff --git a/Assets/BITKit/Core/Ticker/ITicker.cs b/Assets/BITKit/Core/Ticker/ITicker.cs index aeb78e1c5..25ea00049 100644 --- a/Assets/BITKit/Core/Ticker/ITicker.cs +++ b/Assets/BITKit/Core/Ticker/ITicker.cs @@ -41,7 +41,7 @@ namespace BITKit /// /// 异步循环 /// - public interface IAsyncTicker + public interface IAsyncTicker:IDisposable { ulong TickCount { get; } int TickRate { get; set; } @@ -183,6 +183,7 @@ namespace BITKit public void Dispose() { + OnTickAsync = null; _isDisposed = true; _timer.Stop(); _timer.Dispose(); diff --git a/Assets/BITKit/Unity/Scripts/Tag/Tag.cs b/Assets/BITKit/Unity/Scripts/Tag/Tag.cs index 74547157e..a443122b9 100644 --- a/Assets/BITKit/Unity/Scripts/Tag/Tag.cs +++ b/Assets/BITKit/Unity/Scripts/Tag/Tag.cs @@ -8,19 +8,10 @@ namespace BITKit { public class Tag : MonoBehaviour,ITag { - [Header(Constant.Header.Settings)] - [Tooltip("It's will be deprecated in the future, use reference instead.")] - [SerializeField] private string[] tags; - [Tooltip("Disable when tags is not empty")] [SerializeReference,SubclassSelector] private IReference[] reference; - public int Hash => _id is 0 ? _id = MathE.GetHash(GetTags()) : _id; + public int Hash => _id is 0 ? _id = MathE.GetHash(Tags) : _id; private int _id; - public string[] GetTags() => CacheTags ??= reference?.Length > 0 ? reference.Select(x => x.Value).ToArray() : tags; - private string[] CacheTags; - public void SetTags(IReference[] newReference) - { - reference = newReference; - CacheTags = null; - } + public IReadOnlyCollection Tags=> _cacheTags ??= reference.Select(x => x.Value).ToArray(); + private string[] _cacheTags; } } \ No newline at end of file