mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
临时提交
This commit is contained in:
@@ -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);
|
Reference in New Issue
Block a user