public void OnDialogueClipEnd(DialogueClip clip)
        {
            var mask = clip.eventMask;

            ExecuteMaskEvent(onSpecialDialogueEndDict, mask, clip);
            OnDialogueClipEndEvent?.Invoke(clip);
        }
        public void OnDialogueClipEnter(DialogueClip clip)
        {
            OnDialogueClipEnterEvent?.Invoke(clip);
            var mask = clip.eventMask;

            ExecuteMaskEvent(onSpecialDialogueEnterDict, mask, clip);
        }
Esempio n. 3
0
 /// 复制另一个clip的信息
 public void CopyBy(DialogueClip clip)
 {
     clipContext = clip.clipContext;
     roleName    = clip.roleName;
     roleEmotion = clip.roleEmotion;
     eventMask   = clip.eventMask;
     maskObjs    = new List <Object>(clip.maskObjs);
     objMaskBits = new List <int>(clip.objMaskBits);
 }
 /// <summary>
 /// 执行mask相对应的所有注册的事件
 /// </summary>
 private void ExecuteMaskEvent(Dictionary <int, Action <DialogueClip> > dict, int mask, DialogueClip clip)
 {
     for (int i = 0; i < 32 && mask != 0; i++)
     {
         int tmpMask = (1 << i);
         if ((mask & tmpMask) == tmpMask)
         {
             if (dict.ContainsKey(tmpMask))
             {
                 dict[tmpMask]?.Invoke(clip);
             }
             mask &= (~tmpMask);
         }
     }
 }