mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
临时提交
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using GAS.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Profiling;
|
||||
|
||||
@@ -14,24 +15,31 @@ namespace GAS.General
|
||||
|
||||
public class JexGasObjectPool
|
||||
{
|
||||
private static JexGasObjectPool _singleton;
|
||||
|
||||
public static JexGasObjectPool Instance => _singleton ??= new JexGasObjectPool();
|
||||
// private static JexGasObjectPool _singleton;
|
||||
//
|
||||
// public static JexGasObjectPool Instance => _singleton ??= new JexGasObjectPool();
|
||||
|
||||
public JexGasManager Manager;
|
||||
|
||||
public JexGasObjectPool(JexGasManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
}
|
||||
|
||||
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 static void Awake()
|
||||
// {
|
||||
// _singleton = null;
|
||||
// _singleton = new JexGasObjectPool();
|
||||
// }
|
||||
//
|
||||
// public static void Destroy()
|
||||
// {
|
||||
// _singleton = null;
|
||||
// }
|
||||
|
||||
public T Fetch<T>() where T : class
|
||||
{
|
||||
|
Reference in New Issue
Block a user