This commit is contained in:
parent
42eb7b00d9
commit
268c24de0d
|
@ -1,8 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public interface ITag
|
||||
{
|
||||
int Hash { get; }
|
||||
string[] GetTags();
|
||||
IReadOnlyCollection<string> Tags { get; }
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@ namespace BITKit
|
|||
/// <summary>
|
||||
/// 异步循环
|
||||
/// </summary>
|
||||
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();
|
||||
|
|
|
@ -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<string> Tags=> _cacheTags ??= reference.Select(x => x.Value).ToArray();
|
||||
private string[] _cacheTags;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue