public void removeListener(int eventType, int sceneType, IEventListenerEx listener) { lock (this.Event2Scenelisteners) { Dictionary <int, List <IEventListenerEx> > dict; if (!this.Event2Scenelisteners.TryGetValue(eventType, out dict)) { dict = new Dictionary <int, List <IEventListenerEx> >(); this.Event2Scenelisteners.Add(eventType, dict); } List <IEventListenerEx> listenerList = null; if (dict.TryGetValue(sceneType, out listenerList)) { listenerList.Remove(listener); } } }
public void registerListener(int eventType, int sceneType, IEventListenerEx listener) { lock (Event2Scenelisteners) { Dictionary <int, List <IEventListenerEx> > dict; if (!Event2Scenelisteners.TryGetValue(eventType, out dict)) { dict = new Dictionary <int, List <IEventListenerEx> >(); Event2Scenelisteners.Add(eventType, dict); } List <IEventListenerEx> listenerList = null; if (!dict.TryGetValue(sceneType, out listenerList)) { listenerList = new List <IEventListenerEx>(); dict.Add(sceneType, listenerList); } listenerList.Add(listener); } }