/// <summary> /// Adds an event listener for local events. /// </summary> /// <typeparam name="T">Type of events.</typeparam> /// <param name="listener">Predicate that is called on each received event.</param> /// <param name="type">Event type for which this listener will be notified</param> private void LocalListen <T>(IEventListener <T> listener, int type) where T : IEvent { lock (_localFilters) { Dictionary <int, LocalHandledEventFilter> filters; if (!_localFilters.TryGetValue(listener, out filters)) { filters = new Dictionary <int, LocalHandledEventFilter>(); _localFilters[listener] = filters; } LocalHandledEventFilter localFilter; if (!filters.TryGetValue(type, out localFilter)) { localFilter = CreateLocalListener(listener, type); filters[type] = localFilter; } UU.EventsLocalListen(Target, localFilter.Handle, type); } }