临时提交

This commit is contained in:
PC-20230316NUNE\Administrator
2024-10-18 17:48:59 +08:00
parent 8cea537319
commit 31db916fec
31 changed files with 315 additions and 107 deletions

View File

@@ -12,15 +12,27 @@ namespace GAS.General
bool IsFromPool { get; set; }
}
public class ObjectPool
public class JexGasObjectPool
{
private static ObjectPool _singleton;
public static ObjectPool Instance => _singleton ??= new ObjectPool();
private static JexGasObjectPool _singleton;
public static JexGasObjectPool Instance => _singleton ??= new JexGasObjectPool();
private readonly ConcurrentDictionary<Type, Pool> _objPool = new();
private readonly Func<Type, Pool> _addPoolFunc = type => new Pool(type, 1024);
public static void Awake()
{
_singleton = null;
_singleton = new JexGasObjectPool();
}
public static void Destroy()
{
_singleton = null;
}
public T Fetch<T>() where T : class
{
var type = typeof(T);