コード例 #1
0
 void OnDestroy()
 {
     BeforeDestroy();
     foreach (var item in mMsgRecorder)
     {
         MsgDispatcher.UnRegister(item.MsgName, item.onMsgReceive);
         item.Recycle();
     }
     mMsgRecorder.Clear();
 }
コード例 #2
0
        static void MenuClick()
        {
            MsgDispatcher.UnRegisterAll("消息1");

            MsgDispatcher.Register("消息1", OnMsgReceived);
            MsgDispatcher.Register("消息1", OnMsgReceived);

            MsgDispatcher.Send("消息1", "Hello World");
            MsgDispatcher.UnRegister("消息1", OnMsgReceived);

            MsgDispatcher.Send("消息1", "Hello ");
        }
コード例 #3
0
        public void UnRegisterMsg(string msgName, Action <object> onMsgReceive)
        {
            var selectRecords = mMsgRecorder.FindAll(record => record.MsgName == msgName && record.onMsgReceive == onMsgReceive);

            selectRecords.ForEach(record =>
            {
                MsgDispatcher.UnRegister(record.MsgName, record.onMsgReceive);
                mMsgRecorder.Remove(record);

                record.Recycle();
            });
            selectRecords.Clear();
        }