Пример #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();
        }