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