Beispiel #1
0
 public static void PushCurrent(ObjectCache cache)
 {
     if (cache == null)
     {
         throw new ArgumentNullException("cache");
     }
     CacheStack.Push(cache);
 }
Beispiel #2
0
 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());
     }
 }
Beispiel #3
0
 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());
     }
 }
Beispiel #4
0
 public override void Free(T obj)
 {
     _resetMethod?.Invoke(obj);
     CacheStack.Push(obj);
 }
Beispiel #5
0
 public override void Free(T obj)
 {
     obj.Hide();
     _onHideMethod?.Invoke(obj);
     CacheStack.Push(obj);
 }
 public SettingStack(T newPush)
 {
     CacheStack.Push(newPush);
 }
Beispiel #7
0
 public override void Free(T obj)
 {
     _resetMethod.InvokeGracefully(obj);
     CacheStack.Push(obj);
 }