コード例 #1
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 public EiLLNode(T value)
 {
     this.Value = value;
     Next       = null;
     Prev       = null;
     List       = null;
 }
コード例 #2
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void SubscribeFixedUpdate()
 {
     if (fixedUpdateNode == null)
     {
         fixedUpdateNode = EiUpdateSystem.Instance.SubscribeFixedUpdate(this);
     }
 }
コード例 #3
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 public void ClearFast()
 {
     lock (this) {
         node  = null;
         count = 0;
     }
 }
コード例 #4
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
        public void Remove(EiLLNode <T> node)
        {
            lock (this) {
                if (node.List != this)
                {
                    return;
                }

                if (node == this.node)
                {
                    this.node = node.Next;
                }

                node.Prev.Next = node.Next;
                node.Next.Prev = node.Prev;
                node.Prev      = null;
                node.Next      = null;
                node.List      = null;
                nodes.Enqueue(node);

                if (count <= 1)
                {
                    this.node = null;
                }
                count--;
            }
        }
コード例 #5
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
        public void Move(EiLLNode <T> node, EiLinkedList <T> otherList)
        {
            if (node.List != this)
            {
                throw new Exception("You are not allowed to move nodes from other list without going through its own list");
            }

            if (count == 1)
            {
                this.node = null;
            }

            node.Prev.Next = node.Next;
            node.Next.Prev = node.Prev;

            node.List = otherList;

            if (otherList.Count() == 0)
            {
                node.Next      = node;
                node.Prev      = node;
                otherList.node = node;
            }
            else
            {
                otherList.node.Prev.Next = node;
                node.Prev           = otherList.node.Prev;
                node.Next           = otherList.node;
                otherList.node.Prev = node;
            }
            count--;
            otherList.count++;
        }
コード例 #6
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void SubscribeThreadedUpdate()
 {
     if (threadedUpdateNode == null)
     {
         threadedUpdateNode = EiThreadedUpdateSystem.Instance.Subscribe(this);
     }
 }
コード例 #7
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
        public EiLLNode <T> Add(T value)
        {
            lock (this) {
                EiLLNode <T> node;
                if (!nodes.TryDequeue(out node))
                {
                    node = new EiLLNode <T> (value);
                }
                else
                {
                    node.Value = value;
                }

                if (count == 0)
                {
                    this.node = node;
                    node.Next = this.node;
                    node.Prev = this.node;
                }
                else
                {
                    node.Prev           = this.node.Prev;
                    node.Next           = this.node;
                    this.node.Prev.Next = node;
                    this.node.Prev      = node;
                }

                count++;
                node.List = this;
                return(node);
            }
        }
コード例 #8
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void SubscribeLateUpdate()
 {
     if (lateUpdateNode == null)
     {
         lateUpdateNode = EiUpdateSystem.Instance.SubscribeLateUpdate(this);
     }
 }
コード例 #9
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void UnsubscribeFixedUpdate()
 {
     if (fixedUpdateNode != null)
     {
         EiUpdateSystem.Instance.UnsubscribeFixedUpdate(fixedUpdateNode);
     }
     fixedUpdateNode = null;
 }
コード例 #10
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void UnsubscribeLateUpdate()
 {
     if (lateUpdateNode != null)
     {
         EiUpdateSystem.Instance.UnsubscribeLateUpdate(lateUpdateNode);
     }
     lateUpdateNode = null;
 }
コード例 #11
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void UnsubscribeThreadedUpdate()
 {
     if (threadedUpdateNode != null)
     {
         EiThreadedUpdateSystem.Instance.Unsubscribe(threadedUpdateNode);
     }
     threadedUpdateNode = null;
 }
コード例 #12
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void UnsubscribePreUpdate()
 {
     if (preUpdateNode != null)
     {
         EiUpdateSystem.Instance.UnsubscribePreUpdate(preUpdateNode);
     }
     preUpdateNode = null;
 }
コード例 #13
0
 public void Unsubscribe(EiLLNode <EiUpdateInterface> node)
 {
     if (node.List != null)
     {
         node.List.Remove(node);
     }
     else
     {
         LogError(() => "Cant remove node from system");
     }
 }
コード例 #14
0
 public void Unsubscribe(EiLLNode <EiUpdateInterface> node)
 {
     if (node.List != null)
     {
         node.List.Remove(node);
     }
     else
     {
         UnityEngine.Debug.LogError("Cant remove node from system");
     }
 }
コード例 #15
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 public EiLLNode <T>[] AddRange(T[] values)
 {
     lock (this) {
         EiLLNode <T>[] nodes = new EiLLNode <T> [values.Length];
         for (int i = 0; i < values.Length; i++)
         {
             nodes [i] = Add(values [i]);
         }
         return(nodes);
     }
 }
コード例 #16
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 /// <summary>
 /// Remove the specified node object, very slow.
 /// Will iterate through object until it finds object, then delete it.
 /// </summary>
 /// <param name="obj">Object.</param>
 public void Remove(T nodeObject)
 {
     lock (this) {
         var          iterator = GetIterator();
         EiLLNode <T> node     = null;
         while (iterator.Next(out node))
         {
             if (node.Value == nodeObject)
             {
                 Remove(node);
                 return;
             }
         }
     }
 }
コード例 #17
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
        public bool Next(out T value)
        {
            if (current == null)
            {
                if (first == null)
                {
                    value = default(T);
                    return(false);
                }
                value = (current = first).Value;
                return(true);
            }

            value = (current = current.Next).Value;
            return(current != first);
        }
コード例 #18
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 public void RemoveAfter(EiLLNode <T> node)
 {
     lock (this) {
         if (node.List != this)
         {
             return;
         }
         var nextNode = node.Next;
         while (nextNode != this.node)
         {
             var toRemove = nextNode;
             nextNode = nextNode.Next;
             Remove(toRemove);
         }
     }
 }
コード例 #19
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
        public bool Next(out EiLLNode <T> node)
        {
            if (current == null)
            {
                if (first == null)
                {
                    node = null;
                    return(false);
                }
                node = current = first;
                return(node != null);
            }

            node = (current = current.Next);
            return(current != first && node != null);
        }
コード例 #20
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 public void RemoveBefore(EiLLNode <T> node)
 {
     lock (this) {
         if (node.List != this)
         {
             return;
         }
         var nextNode = node.Prev;
         while (nextNode != this.node)
         {
             var toRemove = nextNode;
             nextNode = nextNode.Prev;
             Remove(toRemove);
         }
     }
 }
コード例 #21
0
        public void DestroyCurrent()
        {
            var cur = current;

            if (first == current)
            {
                first   = current.Next;
                current = null;
            }
            else
            {
                current = current.Prev;
            }
            if (cur != null && cur.List != null)
            {
                cur.List.Remove(cur);
            }
        }
コード例 #22
0
 public void Unsubscribe(EiLLNode <EiUpdateInterface> node)
 {
     components.Remove(node);
 }
コード例 #23
0
ファイル: EiLinkedList.cs プロジェクト: huangjk/EiComponent
 public EiLLIterator(EiLLNode <T> first)
 {
     this.first = first;
     current    = null;
 }
コード例 #24
0
 public void SetNode(EiLLNode <ThreadContainer> node)
 {
     this.node = node;
 }
コード例 #25
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void UnsubscribeUpdateTimer(EiLLNode <EiUpdateSystem.TimerUpdateData> node)
 {
     EiUpdateSystem.Instance.UnsubscribeTimerUpdate(node);
 }
コード例 #26
0
 public static void Unsubscribe <T> (EiLLNode <MessageSubscriber <T> > component)
 {
     Message <T> .subscribers.Remove(component);
 }
コード例 #27
0
 public void ShiftNext()
 {
     lock (this) {
         node = node.Next;
     }
 }
コード例 #28
0
 public void ShiftBack()
 {
     lock (this) {
         node = node.Prev;
     }
 }
コード例 #29
0
ファイル: EiCore.cs プロジェクト: oultrox/EiComponent
 protected void Unsubscribe <T> (EiLLNode <EiMessageSubscriber <T> > subscriber)
 {
     EiMessage.Unsubscribe(subscriber);
 }
コード例 #30
0
ファイル: EiUpdateSystem.cs プロジェクト: oultrox/EiComponent
 public void UnsubscribeFixedUpdate(EiLLNode <EiUpdateInterface> component)
 {
     fixedUpdateList.Remove(component);
 }