示例#1
0
 /// <summary>
 /// 注销所有消息
 /// </summary>
 public void UnRegiserAllMsg()
 {
     foreach (MsgRecord mMsgRecord in mMsgRecords)
     {
         MsgCenter.UnRegister(mMsgRecord.MsgType, mMsgRecord.OnMsgReceived);
         mMsgRecord.Recycle();
     }
 }
示例#2
0
        /// <summary>
        /// 注销指定消息
        /// </summary>
        /// <param UIName="msgType"></param>
        public void UnRegisterMsg(Enum msgType)
        {
            var selectedRecords = mMsgRecords.FindAll((record) => Equals(record.MsgType, msgType));

            selectedRecords.ForEach(record =>
            {
                MsgCenter.UnRegister(record.MsgType, record.OnMsgReceived);
                mMsgRecords.Remove(record);

                record.Recycle();
            });

            selectedRecords.Clear();
        }
示例#3
0
 /// <summary>
 /// 发送消息
 /// </summary>
 /// <param UIName="msgType"></param>
 /// <param UIName="data"></param>
 public void SendMsg(Enum msgType, object data = null)
 {
     MsgCenter.SendMsg(msgType, data);
 }
示例#4
0
 /// <summary>
 /// 消息注册
 /// </summary>
 /// <param UIName="msgType"></param>
 /// <param UIName="msgListener"></param>
 public void RegisterMsg(Enum msgType, Action <object> msgListener)
 {
     MsgCenter.RegisterMsg(msgType, msgListener);
     mMsgRecords.Add(MsgRecord.Allocate(msgType, msgListener));
 }