public virtual void Destroy() { while (mCircleCaches.Count > 0) { ObjectBase circle = mCircleCaches.First.Value; mCircleCaches.RemoveFirst(); circle.Destroy(); } mCircleCaches.Clear(); }
public void Release(ObjectBase obj) { if (obj == null) { return; } Type type = obj.GetType(); DebugUtils.Assert(type.IsSubclassOf(typeof(ObjectBase)), "wrong type"); if (mPools.ContainsKey(type)) { mPools[type].Release(obj); } else { // 释放调用 Destroy,比Release要强 obj.Destroy(); } }
public void RemoveExpired(int lifeSeconds) { float timeStamp = DateTimeUtils.GetTimeStampSeconds(); int cnt = mCircleCaches.Count; int i = 0; while (i < cnt) { ObjectBase circle = mCircleCaches.First.Value; mCircleCaches.RemoveFirst(); if (!circle.IsExpired(mLifeTimeSecond)) { mCircleCaches.AddLast(circle); } else { circle.Destroy(); } } }