예제 #1
0
 /// <summary>
 /// 释放一个池子(手动销毁池子)
 /// 释放一个池子 只会销毁池子缓存的gameobject 并释放引用ab次数
 /// ab的释放 每段时间检查refCount<零释放 todo
 /// </summary>
 /// <param name="resName"></param>
 public void disposePool(string resName)
 {
     if (pools.ContainsKey(resName))
     {
         BasePool bp = pools[resName];
         pools.Remove(resName);
         bp.onDispose();
     }
 }
예제 #2
0
    //释放时间池子
    public void disposeUseTime()
    {
        List <string> keys = new List <string>();
        var           ier  = pools.GetEnumerator();

        while (ier.MoveNext())
        {
            if (!ier.Current.Value.IsAlive)
            {
                keys.Add(ier.Current.Key);
            }
        }
        for (int i = 0; i < keys.Count; i++)
        {
            if (pools.ContainsKey(keys[i]))
            {
                BasePool bp = pools[keys[i]];
                pools.Remove(keys[i]);
                bp.onDispose();
            }
        }
    }