public void AddListener(int type, OnNotificationDelegate newListenerDelegate) { if (!listeners.ContainsKey(type)) { listeners.Add(type, del); } listeners [type] += newListenerDelegate; }
//移除监听事件 public void removeEventListener(string type, OnNotificationDelegate listener) { if (!eventListerners.ContainsKey(type)) { return; } eventListerners[type] -= listener; }
/* * 监听事件 */ //添加监听事件 public void AddEventListener(uint type, OnNotificationDelegate listener) { if (!eventListerners.ContainsKey(type)) { eventListerners.Add(type, null); } eventListerners[type] += listener; }
public void AddListener(OnNotificationDelegate newListenerDelegate, string key) { if (!_listeners.ContainsKey(key)) { _listeners[key] = new List <OnNotificationDelegate>(); } _listeners[key].Add(newListenerDelegate); }
public void RemoveEventListener(Notification_Type type, OnNotificationDelegate listener) { if (!_eventListerners.ContainsKey((int)type)) { return; } _eventListerners[(int)type] -= listener; }
public bool RemoveWatcher(OnNotificationDelegate watcher, object context = null) { if (!watchers.TryRemove((watcher, context), out var del)) { return(false); } return(NativeMethods.manager_remove_watcher(handle, del, IntPtr.Zero)); }
public void AddEventListener(Notification_Type type, OnNotificationDelegate listener) { if (!_eventListerners.ContainsKey((int)type)) { OnNotificationDelegate deleg = null; _eventListerners[(int)type] = deleg; } _eventListerners[(int)type] += listener; }
/* * 监听事件 */ //添加监听事件 public void addEventListener(string type, OnNotificationDelegate listener) { if (!eventListerners.ContainsKey(type)) { OnNotificationDelegate deleg = null; eventListerners[type] = deleg; } eventListerners[type] += listener; }
public void addListener(OnNotificationDelegate newListenerDelegate, NotificationType type) { int typeInt = (int)type; // Create the listener ArrayList lazily if (listeners[typeInt] == null) listeners[typeInt] = new ArrayList(); listeners[typeInt].Add(newListenerDelegate); }
public void RemoveListener(OnNotificationDelegate listenerDelegate) { foreach (var kvp in _listeners) { if (kvp.Value.Contains(listenerDelegate)) { RemoveListener(listenerDelegate, kvp.Key); } } }
private void DoRemoveListener(OnNotificationDelegate listenerDelegate, string key) { if (!_listeners.ContainsKey(key)) { return; } if (_listeners[key].Contains(listenerDelegate)) { _listeners[key].Remove(listenerDelegate); } }
//监听事件 //添加监听事件 void AddEventListener(ushort t_num, OnNotificationDelegate listener) { if (t_num >= 0 && t_num < c_eventNum) { eventListerners[t_num] += listener; } else { Debug.Log("注册监听事件失败,ID为:" + t_num); } }
//移除监听事件 public void removeEventListener(ushort t_num, OnNotificationDelegate listener) { if (t_num >= 0 && t_num < c_eventNum) { eventListerners[t_num] -= listener; } else { Debug.Log("移除监听事件失败,ID为:" + t_num); } }
public void addListener(OnNotificationDelegate newListenerDelegate, NotificationTypes type) { int typeInt = (int)type; // Create the listener List lazily if (listeners[typeInt] == null) { listeners[typeInt] = new List <OnNotificationDelegate>(); } listeners[typeInt].Add(newListenerDelegate); }
public void removeListener(OnNotificationDelegate listenerDelegate, NotificationType type) { int typeInt = (int)type; if (listeners[typeInt] == null) return; if (listeners[typeInt].Contains(listenerDelegate)) listeners[typeInt].Remove(listenerDelegate); // Clean up empty listener ArrayLists if (listeners[typeInt].Count == 0) listeners[typeInt] = null; }
public void removeListener(OnNotificationDelegate listenerDelegate, NotificationTypes type) { int typeInt = (int)type; if (listeners[typeInt] == null) { return; } if (listeners[typeInt].Contains(listenerDelegate)) { listeners[typeInt].Remove(listenerDelegate); } // Clean up empty listener List if (listeners[typeInt].Count == 0) { listeners[typeInt] = null; } }
//----------------------------------------------------------------------------- // Notifications //----------------------------------------------------------------------------- public bool AddWatcher(OnNotificationDelegate watcher, object context = null) { if (watchers.TryGetValue((watcher, context), out var del)) { return(false); } del = new NativeMethods.on_ontification_delegate_t((notificationPtr, ctx) => { var notification = Notification.NativeToManagedMap.GetOrCreate(notificationPtr); watcher?.Invoke(notification, context); }); var added = NativeMethods.manager_add_watcher(handle, del, IntPtr.Zero); if (added) { watchers.AddOrUpdate((watcher, context), del, (k, v) => del); } return(added); }
public void removeListener(OnNotificationDelegate listenerDelegate, NotificationType type) { int typeInt = ( int )type; listeners[typeInt] -= listenerDelegate; }
public void addListener(OnNotificationDelegate newListenerDelegate, NotificationType type) { int typeInt = (int)type; listeners[typeInt] += newListenerDelegate; }
public void removeListener(OnNotificationDelegate listenerDelegate, NotificationType type) { listeners[type].Remove(listenerDelegate); }
public void addListener(OnNotificationDelegate newListenerDelegate, NotificationType type) { listeners[type].Add(newListenerDelegate); }
public void RemoveListener(OnNotificationDelegate listenerDelegate, string key) { _toRemove.Add(new Pair <string, OnNotificationDelegate>(key, listenerDelegate)); }
public void addListener( OnNotificationDelegate newListenerDelegate, NotificationType type ) { listeners[type].Add(newListenerDelegate); }
public void removeListener( OnNotificationDelegate listenerDelegate, NotificationType type ) { listeners[type].Remove( listenerDelegate ); }
public void RemoveListener(int type, OnNotificationDelegate listenerDelegate) { listeners[type] -= listenerDelegate; }