public bool CanInstantMessage(UUID user, UUID target) { InstantMessageHandler handler = OnInstantMessage; if (handler != null) { Delegate[] list = handler.GetInvocationList(); return(list.Cast <InstantMessageHandler>().All(h => h(user, target, m_scene) != false)); } return(true); }
public void RemoveListener(InstantMessageType type, InstantMessageHandler handler) { InstantMessageHandler messageHandler; if (handlerRegistry.TryGetValue(type, out messageHandler)) { if (messageHandler != null) { //Debug.Log("Removing a handler for " + type.ToString() + ": " + handler.Method.Name); handlerRegistry[type] -= handler; } } }
public bool CanInstantMessage(UUID user, UUID target) { InstantMessageHandler handler = OnInstantMessage; if (handler != null) { Delegate[] list = handler.GetInvocationList(); foreach (InstantMessageHandler h in list) { if (h(user, target, m_scene) == false) { return(false); } } } return(true); }
public void AddListener(InstantMessageType type, InstantMessageHandler handler) { InstantMessageHandler messageHandler; if (handlerRegistry.TryGetValue(type, out messageHandler)) { if (messageHandler == null) { //Debug.Log("Setting new handler for " + type.ToString() + ": " + handler.Method.Name); handlerRegistry[type] = handler; } else { //Debug.Log("Adding new handler for " + type.ToString() + ": " + handler.Method.Name); handlerRegistry[type] += handler; } } }
public void ClearRegistry() { if (handlerRegistry != null) { foreach (InstantMessageType type in handlerRegistry.Keys) { InstantMessageHandler messageHandler = handlerRegistry[type]; if (messageHandler != null) { foreach (InstantMessageHandler handler in messageHandler.GetInvocationList()) { messageHandler -= handler; } } handlerRegistry.Remove(type); } } }