public static void PushCurrent(ObjectCache cache) { if (cache == null) { throw new ArgumentNullException("cache"); } CacheStack.Push(cache); }
public ObjectPool(IFactory <T> factory, Action <T> resetMethod = null, int initCount = 0) { Factory = factory; _resetMethod = resetMethod; for (int i = 0; i < initCount; i++) { CacheStack.Push(Factory.Create()); } }
public MonoObjectPool(Func <Object> createMethod, Action <T> onShowMethod = null, Action <T> onHideMethod = null, int initCount = 0) { _onHideMethod = onHideMethod; _createMethod = createMethod; _onShowMethod = onShowMethod; Factory = new CustomFactory <T>(Create); for (int i = 0; i < initCount; i++) { CacheStack.Push(Factory.Create()); } }
public override void Free(T obj) { _resetMethod?.Invoke(obj); CacheStack.Push(obj); }
public override void Free(T obj) { obj.Hide(); _onHideMethod?.Invoke(obj); CacheStack.Push(obj); }
public SettingStack(T newPush) { CacheStack.Push(newPush); }
public override void Free(T obj) { _resetMethod.InvokeGracefully(obj); CacheStack.Push(obj); }