public void RemoveListener(int eventId, ILBEventHandler handler) { if (id2HandlerDict.TryGetValue(eventId, out HashSet <ILBEventHandler> handlerSet)) { id2HandlerDict[eventId].Remove(handler); } }
public void AddListener(int eventId, ILBEventHandler handler) { if (!id2HandlerDict.TryGetValue(eventId, out HashSet <ILBEventHandler> handlerSet)) { handlerSet = id2HandlerDict[eventId] = new HashSet <ILBEventHandler>(); } handlerSet.Add(handler); }