예제 #1
0
    public void Active(TAvatar avatar, ViAvatarDurationVisualInterface <TAvatar> kEffect)
    {
        if (m_kPriorityList.IsEmpty())
        {
            m_kPriorityList.PushBack(kEffect._priorityNode);
            kEffect.OnActive(avatar);
            _OnUpdated(avatar, null);
        }
        else
        {
            ViDoubleLinkNode2 <ViAvatarDurationVisualInterface <TAvatar> > iter = m_kPriorityList.GetHead();
            ViAvatarDurationVisualInterface <TAvatar> pkOldTop = iter.Data as ViAvatarDurationVisualInterface <TAvatar>;
            ViDebuger.AssertError(pkOldTop);
            while (!m_kPriorityList.IsEnd(iter))
            {
                ViAvatarDurationVisualInterface <TAvatar> pkEffect = iter.Data as ViAvatarDurationVisualInterface <TAvatar>;
                ViDebuger.AssertError(pkEffect);
                if (kEffect.Weight > pkEffect.Weight)
                {
                    break;
                }
                ViDoubleLink2 <ViAvatarDurationVisualInterface <TAvatar> > .Next(ref iter);
            }
            ViDoubleLink2 <ViAvatarDurationVisualInterface <TAvatar> > .PushBefore(iter, kEffect._priorityNode);

            if (kEffect._priorityNode == m_kPriorityList.GetHead())
            {
                pkOldTop.OnDeactive(avatar);
                kEffect.OnActive(avatar);
                _OnUpdated(avatar, pkOldTop);
            }
        }
    }
예제 #2
0
파일: ViRoute.cs 프로젝트: xubingyue/def
 public void Delete(ViDoubleLinkNode2 <T> node)
 {
     if (node != null)
     {
         _nodes.PushBack(node);
     }
 }
예제 #3
0
#pragma warning disable 0219
    public static void Test()
    {
        ViDoubleLink2 <int> list = new ViDoubleLink2 <int>();
        {
            ViDoubleLinkNode2 <int> node1 = new ViDoubleLinkNode2 <int>();
            node1.Data = 1;
            ViDoubleLinkNode2 <int> node2 = new ViDoubleLinkNode2 <int>();
            node2.Data = 2;
            list.PushBack(node1);
            list.PushBack(node2);

            {//<正向迭代>
                ViDoubleLinkNode2 <int> iter = list.GetHead();
                while (!list.IsEnd(iter))
                {
                    int value = iter.Data;
                    ViDoubleLink2 <int> .Next(ref iter);
                }
            }

            {//<反向迭代>
                ViDoubleLinkNode2 <int> iter = list.GetTail();
                while (!list.IsEnd(iter))
                {
                    int value = iter.Data;
                    ViDoubleLink2 <int> .Pre(ref iter);
                }
            }
        }
    }
예제 #4
0
    //-------------------------------------------------------------------------
    static void _PushAfter(ViDoubleLinkNode2 <T> before, ViDoubleLinkNode2 <T> node)
    {
        ViDoubleLinkNode2 <T> next = before._next;

        ViDebuger.AssertError(next);
        _Link(before, node);
        _Link(node, next);
    }
예제 #5
0
파일: ViRoute.cs 프로젝트: xubingyue/def
    //
    public void Append(ViVector3 pos)
    {
        ViDoubleLinkNode2 <ViRouteNode> node = S_Nodes.New();

        node.Data._eventId = ViRouteNode.NULL_EVENT;
        node.Data._pos     = pos;
        _nodes.PushBack(node);
    }
예제 #6
0
    //-------------------------------------------------------------------------
    static void _PushBefore(ViDoubleLinkNode2 <T> after, ViDoubleLinkNode2 <T> node)
    {
        ViDoubleLinkNode2 <T> pre = after._pre;

        ViDebuger.AssertError(pre);
        _Link(pre, node);
        _Link(node, after);
    }
예제 #7
0
파일: ViRoute.cs 프로젝트: xubingyue/def
    public void Append(ViVector3 pos, UInt32 eventId)
    {
        ViDoubleLinkNode2 <ViRouteNode> node = S_Nodes.New();

        node.Data._eventId = eventId;
        node.Data._pos     = pos;
        _nodes.PushBack(node);
    }
예제 #8
0
    //-------------------------------------------------------------------------
    public void SetValue(T value)
    {
        ViDoubleLinkNode2 <T> next = _root._next;

        while (next != _root)
        {
            next.Data = value;
            next      = next._next;
        }
    }
예제 #9
0
 //-------------------------------------------------------------------------
 public void Detach()
 {
     if (_pre != null)
     {
         _pre._next = _next;
         _next._pre = _pre;
         _pre       = null;
         _next      = null;
     }
 }
예제 #10
0
 //-------------------------------------------------------------------------
 public static void PushAfter(ViDoubleLinkNode2 <T> before, ViDoubleLink2 <T> list)
 {
     if (before.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushAfter(before, list);
 }
예제 #11
0
 //-------------------------------------------------------------------------
 public static void PushBefore(ViDoubleLinkNode2 <T> after, ViDoubleLink2 <T> list)
 {
     if (after.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushBefore(after, list);
 }
예제 #12
0
    public void Deactive(TAvatar avatar)
    {
        ViDoubleLinkNode2 <ViAvatarDurationVisualInterface <TAvatar> > iter = m_kEffectList.GetHead();

        while (!m_kEffectList.IsEnd(iter))
        {
            ViAvatarDurationVisualInterface <TAvatar> pkEffect = iter.Data as ViAvatarDurationVisualInterface <TAvatar>;
            ViDebuger.AssertError(pkEffect);
            ViDoubleLink2 <ViAvatarDurationVisualInterface <TAvatar> > .Next(ref iter);

            _Deactive(avatar, pkEffect);
        }
    }
예제 #13
0
    //-------------------------------------------------------------------------
    public void Clear()
    {
        ViDoubleLinkNode2 <T> next = _root._next;

        while (next != _root)
        {
            ViDoubleLinkNode2 <T> nextCopy = next._next;
            next._pre  = null;
            next._next = null;
            next       = nextCopy;
        }
        _Init();
    }
예제 #14
0
파일: ViRoute.cs 프로젝트: xubingyue/def
 public ViDoubleLinkNode2 <T> New()
 {
     if (_nodes.IsEmpty())
     {
         return(new ViDoubleLinkNode2 <T>(new T()));
     }
     else
     {
         ViDoubleLinkNode2 <T> node = _nodes.GetHead();
         node.Detach();
         return(node);
     }
 }
예제 #15
0
    //-------------------------------------------------------------------------
    static void _PushBefore(ViDoubleLinkNode2 <T> after, ViDoubleLink2 <T> list)
    {
        if (list.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode2 <T> first = list._root._next;
        ViDoubleLinkNode2 <T> back  = list._root._pre;
        ViDoubleLinkNode2 <T> pre   = after._pre;

        _Link(pre, first);
        _Link(back, after);
        list._Init();
    }
예제 #16
0
    //-------------------------------------------------------------------------
    public void ClearAndClearContent()
    {
        ViDoubleLinkNode2 <T> next = _root._next;

        while (next != _root)
        {
            ViDoubleLinkNode2 <T> nextCopy = next._next;
            next._pre  = null;
            next._next = null;
            next.Data  = default(T);
            next       = nextCopy;
        }
        _Init();
    }
예제 #17
0
    //-------------------------------------------------------------------------
    static void _PushAfter(ViDoubleLinkNode2 <T> before, ViDoubleLink2 <T> list)
    {
        if (list.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode2 <T> first = list._root._next;
        ViDoubleLinkNode2 <T> back  = list._root._pre;
        ViDoubleLinkNode2 <T> next  = before._next;

        _Link(before, first);
        _Link(back, next);
        list._Init();
    }
예제 #18
0
파일: ViRoute.cs 프로젝트: xubingyue/def
    public float Length()
    {
        float     len    = 0.0f;
        ViVector3 prePos = _currentPos;
        ViDoubleLinkNode2 <ViRouteNode> iter = _nodes.GetHead();

        while (!_nodes.IsEnd(iter))
        {
            ViRouteNode value = iter.Data;
            ViDoubleLink2 <ViRouteNode> .Next(ref iter);

            //
            len   += Distance(value._pos, prePos);
            prePos = value._pos;
        }
        return(len);
    }
예제 #19
0
    internal static void Attach(string key, ViDoubleLinkNode2 <T> node)
    {
        ValueList <T> list;

        if (_values.TryGetValue(key, out list))
        {
            if (list._init)
            {
                node.Data = list._value;
            }
            list._list.PushBack(node);
        }
        else
        {
            list = new ValueList <T>();
            list._list.PushBack(node);
            _values.Add(key, list);
        }
    }
예제 #20
0
    public void Clear(TAvatar avatar)
    {
        if (m_kPriorityList.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode2 <ViAvatarDurationVisualInterface <TAvatar> > iter = m_kPriorityList.GetHead();
        ViAvatarDurationVisualInterface <TAvatar> top = iter.Data as ViAvatarDurationVisualInterface <TAvatar>;

        ViDebuger.AssertError(top);
        top.OnDeactive(avatar);
        while (!m_kPriorityList.IsEnd(iter))
        {
            ViAvatarDurationVisualInterface <TAvatar> pkEffect = iter.Data as ViAvatarDurationVisualInterface <TAvatar>;
            ViDebuger.AssertError(pkEffect);
            ViDoubleLink2 <ViAvatarDurationVisualInterface <TAvatar> > .Next(ref iter);

            pkEffect._priorityNode.Detach();
        }
    }
예제 #21
0
파일: ViAstar.cs 프로젝트: xubingyue/def
    //-------------------------------------------------------------------------
    public void Reset()
    {
        ViDoubleLinkNode2 <ViAstarStep> iter = _openList.GetHead();

        while (!_openList.IsEnd(iter))
        {
            iter.Data.Clear();
            ViDoubleLink2 <ViAstarStep> .Next(ref iter);
        }
        _openList.Clear();
        //
        iter = _closeList.GetHead();
        while (!_closeList.IsEnd(iter))
        {
            iter.Data.Clear();
            ViDoubleLink2 <ViAstarStep> .Next(ref iter);
        }
        _closeList.Clear();
        //
        _openHeap.Clear();
    }
예제 #22
0
 //-------------------------------------------------------------------------
 public bool IsEnd(ViDoubleLinkNode2 <T> node)
 {
     return(node == _root);
 }
예제 #23
0
파일: ViRefPtr.cs 프로젝트: xubingyue/def
 public void _AddReference(ViDoubleLinkNode2 <ViRefObj> node)
 {
     _List.PushBack(node);
 }
예제 #24
0
 //-------------------------------------------------------------------------
 public static void PushBefore(ViDoubleLinkNode2 <T> after, ViDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushBefore(after, node);
 }
예제 #25
0
 //-------------------------------------------------------------------------
 public void PushBack(ViDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushBefore(_root, node);
 }
예제 #26
0
 //-------------------------------------------------------------------------
 public static void PushAfter(ViDoubleLinkNode2 <T> before, ViDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushAfter(before, node);
 }
예제 #27
0
 //-------------------------------------------------------------------------
 public static void Pre(ref ViDoubleLinkNode2 <T> node)
 {
     ViDebuger.AssertError(node != null && node._pre != null);
     node = node._pre;
 }
예제 #28
0
 //-------------------------------------------------------------------------
 public static void Next(ref ViDoubleLinkNode2 <T> node)
 {
     ViDebuger.AssertError(node != null && node._next != null);
     node = node._next;
 }
예제 #29
0
 //-------------------------------------------------------------------------
 public void PushFront(ViDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushAfter(_root, node);
 }
예제 #30
0
 //-------------------------------------------------------------------------
 static void _Link(ViDoubleLinkNode2 <T> pre, ViDoubleLinkNode2 <T> next)
 {
     pre._next = next;
     next._pre = pre;
 }