public static void Invoke(BaseEvent e) { if (HANDLERS.TryGetValue(e.type, out List <EventHandler> notifyHandlers)) { int count = notifyHandlers.Count; for (int i = 0; i < count; i++) { notifyHandlers[i].Invoke(e); //注意调用时可能会再有事件加入列表,所以要使用while(PENDING_LIST.Count>0) } } e.Release(); }
public static void Invoke(BaseEvent e) { if (HANDLERS.TryGetValue(e.type, out List <EventHandler> notifyHandlers)) { int count = notifyHandlers.Count; for (int i = 0; i < count; i++) { notifyHandlers[i].Invoke(e); } } e.Release(); }