public bool Add(TCallback value)
    {
        if (this.list != null)
        {
            int num = this.list.IndexOf(value);
            if (num != -1)
            {
                if (this.destroyIndex < num && this.count - 1 != num)
                {
                    this.list.RemoveAt(num);
                    this.list.Add(value);
                }
                return(false);
            }
        }
        else
        {
            this.list = new List <TCallback>();
        }
        this.list.Add(value);
        int num1 = this.destroyIndex;
        DisposeCallbackList <TOwner, TCallback> disposeCallbackList = this;
        int num2 = disposeCallbackList.count;
        int num3 = num2;

        disposeCallbackList.count = num2 + 1;
        if (num1 == num3)
        {
            this.Invoke(value);
            DisposeCallbackList <TOwner, TCallback> disposeCallbackList1 = this;
            disposeCallbackList1.destroyIndex = disposeCallbackList1.destroyIndex + 1;
        }
        return(true);
    }
示例#2
0
    private void OnDestroy()
    {
        DisposeCallbackList <NetInstance, NetInstance.CallbackFunction> disposeCallbackList  = DisposeCallbackList <NetInstance, NetInstance.CallbackFunction> .invalid;
        DisposeCallbackList <NetInstance, NetInstance.CallbackFunction> disposeCallbackList1 = disposeCallbackList;

        this.preDestroy = disposeCallbackList;
        DisposeCallbackList <NetInstance, NetInstance.CallbackFunction> disposeCallbackList2 = disposeCallbackList1;

        disposeCallbackList1 = disposeCallbackList2;
        this.preCreate       = disposeCallbackList2;
        this.postCreate      = disposeCallbackList1;
    }
 public DisposeCallbackList(TOwner owner, DisposeCallbackList <TOwner, TCallback> .Function invoke)
 {
     if (invoke == null)
     {
         throw new ArgumentNullException("invoke");
     }
     this.function     = invoke;
     this.list         = null;
     this.destroyIndex = -1;
     this.count        = 0;
     this.owner        = owner;
 }
 public void Dispose()
 {
     if (this.destroyIndex == -1)
     {
         while (true)
         {
             DisposeCallbackList <TOwner, TCallback> disposeCallbackList = this;
             int num  = disposeCallbackList.destroyIndex + 1;
             int num1 = num;
             disposeCallbackList.destroyIndex = num;
             if (num1 >= this.count)
             {
                 break;
             }
             this.Invoke(this.list[this.destroyIndex]);
         }
     }
 }
示例#5
0
 public NetInstance()
 {
     this.preDestroy = new DisposeCallbackList <NetInstance, CallbackFunction>(this, callbackFire);
     this.postCreate = new DisposeCallbackList <NetInstance, CallbackFunction>(this, callbackFire);
     this.preCreate  = new DisposeCallbackList <NetInstance, CallbackFunction>(this, callbackFire);
 }
示例#6
0
 private void OnDestroy()
 {
     this.postCreate = this.preCreate = this.preDestroy = DisposeCallbackList <NetInstance, CallbackFunction> .invalid;
 }
 public DisposeCallbackList(DisposeCallbackList <UnityEngine.Object, TCallback> .Function invoke)
 {
     this.def = new DisposeCallbackList <UnityEngine.Object, TCallback>(null, invoke);
 }
示例#8
0
 public NetInstance()
 {
     this.preDestroy = new DisposeCallbackList<NetInstance, NetInstance.CallbackFunction>(this, NetInstance.callbackFire);
     this.postCreate = new DisposeCallbackList<NetInstance, NetInstance.CallbackFunction>(this, NetInstance.callbackFire);
     this.preCreate = new DisposeCallbackList<NetInstance, NetInstance.CallbackFunction>(this, NetInstance.callbackFire);
 }
示例#9
0
 static NetInstance()
 {
     NetInstance.callbackFire = new DisposeCallbackList<NetInstance, NetInstance.CallbackFunction>.Function(NetInstance.CallbackFire);
 }
示例#10
0
 private void OnDestroy()
 {
     DisposeCallbackList<NetInstance, NetInstance.CallbackFunction> disposeCallbackList = DisposeCallbackList<NetInstance, NetInstance.CallbackFunction>.invalid;
     DisposeCallbackList<NetInstance, NetInstance.CallbackFunction> disposeCallbackList1 = disposeCallbackList;
     this.preDestroy = disposeCallbackList;
     DisposeCallbackList<NetInstance, NetInstance.CallbackFunction> disposeCallbackList2 = disposeCallbackList1;
     disposeCallbackList1 = disposeCallbackList2;
     this.preCreate = disposeCallbackList2;
     this.postCreate = disposeCallbackList1;
 }
示例#11
0
 static NetInstance()
 {
     NetInstance.callbackFire = new DisposeCallbackList <NetInstance, NetInstance.CallbackFunction> .Function(NetInstance.CallbackFire);
 }