示例#1
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="eventId"></param>
        /// <param name="msg"></param>
        public void SendMsg(int eventId, ZMsg msg)
        {
            UIMsgNode currNode = root;

            while (currNode != null)
            {
                currNode.value.SendMsg(eventId, msg);
                currNode = currNode.nextNode;
            }
        }
示例#2
0
        /// <summary>
        /// 移除事件,但不移除节点
        /// </summary>
        /// <param name="node"></param>
        public void SubNode(UIMsgNode node)
        {
            if (node == null)
            {
                return;
            }
            UIMsgNode currNode = root;

            while (currNode != null && !currNode.value.HasEventId(node.value.EventId))
            {
                currNode = currNode.nextNode;
            }
            // 相同的id事件
            if (currNode != null)
            {
                currNode.value.Unregister(node.value.EventId, node.value.Ets);
            }
        }
示例#3
0
 /// <summary>
 /// 取消注册
 /// </summary>
 /// <param name="node"></param>
 public void Unregister(UIMsgNode node)
 {
     msgLinked.SubNode(node);
 }
示例#4
0
 /// <summary>
 /// 注册事件
 /// </summary>
 /// <param name="node"></param>
 public void Register(UIMsgNode node)
 {
     msgLinked.AddNode(node);
 }
示例#5
0
 public UIMsgNode(UIMsg value = null, UIMsgNode nextNode = null)
 {
     this.value    = value;
     this.nextNode = nextNode;
 }
示例#6
0
 /// <summary>
 /// 添加节点
 /// </summary>
 /// <param name="node"></param>
 public void AddNode(UIMsgNode node)
 {
     if (node == null)
     {
         return;
     }
     //  不固定容量
     if (size == 0)
     {
         if (root == null)
         {
             lastNode = root = node;
             ++count;
         }
         else
         {
             UIMsgNode currNode = root;
             while (currNode != null && !currNode.value.HasEventId(node.value.EventId))
             {
                 currNode = currNode.nextNode;
             }
             // 没有相同的id事件
             if (currNode == null)
             {
                 lastNode.nextNode = node;
                 lastNode          = node;
                 ++count;
             }
             // 有相同的id事件
             else
             {
                 currNode.value.Register(node.value.EventId, node.value.Ets);
             }
         }
     }
     // 固定容量
     else
     {
         if (count < size)
         {
             if (root == null)
             {
                 lastNode = root = node;
                 ++count;
             }
             else
             {
                 UIMsgNode currNode = root;
                 while (currNode != null && !currNode.value.HasEventId(node.value.EventId))
                 {
                     currNode = currNode.nextNode;
                 }
                 // 没有相同的id事件
                 if (currNode == null)
                 {
                     lastNode.nextNode = node;
                     lastNode          = node;
                     ++count;
                 }
                 // 有相同的id事件
                 else
                 {
                     currNode.value.Register(node.value.EventId, node.value.Ets);
                 }
             }
         }
     }
 }
示例#7
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="size">默认0能容纳无限个事件id的大小</param>
 public UIMsgNodeLinked(uint size = 0)
 {
     this.size     = size;
     this.lastNode = this.root;
 }