예제 #1
0
 public static void UnregisterListener(Type eventType, ListenerObject obj)
 {
     if (!eventListeners.ContainsKey(eventType))
     {
         return;
     }
     eventListeners[eventType].RemoveAll(l => l.Equals(obj));
 }
예제 #2
0
        private static void RegisterExpressionListener(Type pathfinderEventType, ListenerObject listenerObj)
        {
            InternalUtility.ValidateNoId("Event Listener", listenerObj.Options.DebugName, $" with priority {listenerObj.Options.Priority}");
            if (!eventListeners.ContainsKey(pathfinderEventType))
            {
                eventListeners.Add(pathfinderEventType, new List <ListenerObject>());
            }
            var list = eventListeners[pathfinderEventType];

            list.Add(listenerObj);
            list.Sort((x, y) => y.Options.Priority - x.Options.Priority);
        }