public void add_service_listener(int stype, net_message_handle handle) { if (event_listeners.ContainsKey(stype)) { event_listeners[stype] += handle; } else { event_listeners.Add(stype, handle); } }
public void remove_service_listener(int stype, net_message_handle handle) { if (!event_listeners.ContainsKey(stype)) { return; } else { event_listeners[stype] -= handle; if (event_listeners[stype] == null) { event_listeners.Remove(stype); } } }