Esempio n. 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);
            }
        }
    }
Esempio n. 2
0
 public void Deactive(TAvatar avatar, ViAvatarDurationVisualInterface <TAvatar> kEffect)
 {
     if (kEffect._priorityNode.IsAttach() == false)
     {
         return;
     }
     if (m_kPriorityList.IsEmpty())
     {
         return;
     }
     if (kEffect._priorityNode == m_kPriorityList.GetHead())
     {
         kEffect._priorityNode.Detach();
         kEffect.OnDeactive(avatar);
         if (!m_kPriorityList.IsEmpty())
         {
             ViAvatarDurationVisualInterface <TAvatar> pNewTop = m_kPriorityList.GetHead().Data as ViAvatarDurationVisualInterface <TAvatar>;
             ViDebuger.AssertError(pNewTop);
             pNewTop.OnActive(avatar);
         }
         _OnUpdated(avatar, kEffect);
     }
     else
     {
         kEffect._priorityNode.Detach();
     }
 }