Inheritance: MonoBehaviour
Example #1
0
 /// <summary>
 /// 根据一组id去掉一个消息
 /// </summary>
 /// <param name="mono"></param>
 /// <param name="msgs"></param>
 public void UnRegisterMsg(IMonoBase mono, params ushort[] msgs)
 {
     for (int i = 0; i < msgs.Length; i++)
     {
         UnRegisterMsg(msgs[i], mono);
     }
 }
Example #2
0
 /// <summary>
 /// 存储一个消息
 /// </summary>
 /// <param name="mono"></param>
 /// <param name="msgs"></param>
 public void RegisterMsg(IMonoBase mono, params ushort[] msgs)
 {
     for (int i = 0; i < msgs.Length; i++)
     {
         EventNode eventNode = new EventNode(mono);
         RegisterMsg(msgs[i], eventNode);
     }
 }
Example #3
0
 static int ProcessEvent(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         IMonoBase obj  = (IMonoBase)ToLua.CheckObject <IMonoBase>(L, 1);
         MsgBase   arg0 = (MsgBase)ToLua.CheckObject <MsgBase>(L, 2);
         obj.ProcessEvent(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #4
0
 /// <summary>
 /// 根据一个id去掉一个消息
 /// </summary>
 /// <param name="id"></param>
 /// <param name="mono"></param>
 public void UnRegisterMsg(ushort id, IMonoBase mono)
 {
     if (!eventTree.ContainsKey(id))
     {
         Debug.Log("不存在这个消息ID: " + id);
     }
     else
     {
         //释放消息分三种情况,头部、中部、尾部释放
         EventNode head = eventTree[id];
         if (head.data == mono)//头部
         {
             //头部后面还有节点
             if (head.next != null)
             {
                 eventTree[id] = head.next;
                 head.next     = null;
             }
             else//头部后面没有节点
             {
                 eventTree.Remove(id);
             }
         }
         else//去掉尾部和中间
         {
             EventNode temp = head;
             while (temp.next != null && temp.next.data != mono)
             {
                 temp = temp.next;
             }
             //表示已经找到目标节点temp.next
             if (temp.next.next != null)//目标节点是中部节点
             {
                 EventNode targetNode = temp.next;
                 temp.next       = targetNode.next;
                 targetNode.next = null;
             }
             else//目标节点是尾部节点
             {
                 temp.next = null;
             }
         }
     }
 }
Example #5
0
 public EventNode(IMonoBase monoBase)
 {
     data = monoBase;
     next = null;
 }
Example #6
0
 public void RegisterSelf(IMonoBase mono, params ushort[] msgs)
 {
     AssetManager.Instance.RegisterMsg(mono, msgs);
 }
Example #7
0
 public void UnRegisterSelf(IMonoBase mono, params ushort[] msgs)
 {
     UIManager.Instance.UnRegisterMsg(mono, msgs);
 }
Example #8
0
 public void SettingChild(IMonoBase child)
 {
     monoChild = child;
 }