Exemple #1
0
 public void AddNetMsgProcessor(GameMsgType nMsgType, NetMsgProcessor Porcessor)
 {
     m_ProcessorList.Add(new NetMsgProcessorPair(nMsgType, Porcessor));
     if (m_bEnable)
     {
         NetMsgMap.RegistMsgProcessor(nMsgType, Porcessor);
     }
 }
Exemple #2
0
 public static void RegistMsgProcessor(GameMsgType nMsgType, NetMsgProcessor Msgprocessor)
 {
     //Debug.Log("RegistMsgProcessor,nMsgType:" + nMsgType);
     if (s_MsgMap.Contains(nMsgType))
     {
         NetMsgProcessor OldHandler = (NetMsgProcessor)s_MsgMap[nMsgType];
         OldHandler        += Msgprocessor;
         s_MsgMap[nMsgType] = OldHandler;
     }
     else
     {
         s_MsgMap[nMsgType] = Msgprocessor;
     }
 }
Exemple #3
0
 public static void UnRegistMsgProcessor(GameMsgType nMsgType, NetMsgProcessor Msgprocessor)
 {
     if (s_MsgMap.Contains(nMsgType))
     {
         NetMsgProcessor OldHandler = (NetMsgProcessor)s_MsgMap[nMsgType];
         OldHandler -= Msgprocessor;
         if (OldHandler != null)
         {
             s_MsgMap[nMsgType] = OldHandler;
         }
         else
         {
             s_MsgMap.Remove(nMsgType);
         }
     }
 }
Exemple #4
0
        public static void DispatchNetMsg(GameMsgBase Msg)
        {
            //Debug.Log("DispatchNetMsg Msg:" + Msg.getMsgType() + "s_MsgMap count" + s_MsgMap.Count);
            GameMsgType nMsgType = Msg.getMsgType();

            if (s_MsgMap.Contains(nMsgType))
            {
                //Debug.Log("DispatchNetMsg 2");
                NetMsgProcessor MsgEntry = (NetMsgProcessor)s_MsgMap[nMsgType];
                if (MsgEntry != null)
                {
                    MsgEntry(Msg);
                }
                else
                {
                    Debug.LogError("MsgEntry is null ,ID:" + Msg.getMsgType());
                }
            }
        }
Exemple #5
0
 public NetMsgProcessorPair(GameMsgType MsgType, NetMsgProcessor processor)
 {
     m_uMsgType  = MsgType;
     m_processor = processor;
 }
Exemple #6
0
 public void setProcessor(NetMsgProcessor value)
 {
     m_processor = value;
 }