public void AddNetMsgProcessor(GameMsgType nMsgType, NetMsgProcessor Porcessor) { m_ProcessorList.Add(new NetMsgProcessorPair(nMsgType, Porcessor)); if (m_bEnable) { NetMsgMap.RegistMsgProcessor(nMsgType, Porcessor); } }
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; } }
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); } } }
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()); } } }
public NetMsgProcessorPair(GameMsgType MsgType, NetMsgProcessor processor) { m_uMsgType = MsgType; m_processor = processor; }
public void setProcessor(NetMsgProcessor value) { m_processor = value; }