1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -20,11 +21,13 @@ namespace BITKit
|
||||
private static VFXService sinleton;
|
||||
public VFX[] vfxs;
|
||||
private readonly Dictionary<string, UnityPool<Transform>> pools = new();
|
||||
private readonly ConcurrentDictionary<int, Transform> cache = new();
|
||||
|
||||
[SerializeField] private bool debug;
|
||||
[SerializeField] private Optional<int> defaultCapacity;
|
||||
private void Awake()
|
||||
{
|
||||
cache.Clear();
|
||||
sinleton = this;
|
||||
DI.Register(this);
|
||||
}
|
||||
@@ -68,16 +71,22 @@ namespace BITKit
|
||||
|
||||
public bool TryMatch(out Transform value, params string[] key)
|
||||
{
|
||||
foreach (var vfx in vfxs)
|
||||
value=cache.GetOrAdd(MathE.GetHash(key),Add);
|
||||
return value is not null;
|
||||
Transform Add(int arg)
|
||||
{
|
||||
if (vfx.IsMatch(key))
|
||||
foreach (var vfx in vfxs)
|
||||
{
|
||||
value = vfx.prefab;
|
||||
return true;
|
||||
if (vfx.IsMatch(key))
|
||||
{
|
||||
var x = vfx.prefab;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user