public void RegMsg(ProtocolEnum protoId, OnMsgHandle msgHandle) { List <OnMsgHandle> msgLst; if (!m_netMsgLst.TryGetValue(protoId, out msgLst)) { msgLst = new List <OnMsgHandle>(); m_netMsgLst.Add(protoId, msgLst); } msgLst.Add(msgHandle); }
public void UnRegMsg(ProtocolEnum protoId, OnMsgHandle msgHandle) { List <OnMsgHandle> msgLst; if (!m_netMsgLst.TryGetValue(protoId, out msgLst)) { return; } msgLst.Remove(msgHandle); if (msgLst.Count <= 0) { m_netMsgLst.Remove(protoId); } }
protected virtual void UnRegMsg(ProtocolEnum protoId, OnMsgHandle handle) { NetMsgDispatch.MInstance.UnRegMsg((ProtocolEnum)protoId, handle); }