/// <summary> /// 回收 /// </summary> /// <param name="r"></param> public static void Recycle(ResObj r) { if (r != null) { r.Reset(null); if (!_pool.Contains(r)) { _pool.Add(r); } } }
// 取实例 public static ResObj Get(string path) { ResObj r = null; if (_pool.Count > 0) { r = _pool[_pool.Count - 1]; r.Reset(path); _pool.RemoveAt(_pool.Count - 1); } else { r = new ResObj(path); } return(r); }