/// <summary> /// Registers a temporary handler for the given message type. /// </summary> public Binding RegisterTemp(MsgType inType, MsgActionHandler inHandler) { if (m_Impl.IsValid) { return(new Binding(this, inType, (m) => inHandler())); } return(null); }
/// <summary> /// Deregisters a handler for the given message type. /// </summary> public Messenger Deregister(MsgType inType, MsgActionHandler inHandler) { if (m_Impl.IsValid) { m_Impl.Deregister(inType, inHandler); } return(this); }
public void Register(MsgActionHandler inAction) { if (m_DebugMode && m_Metadata.CanLog(LogFlags.Register)) { m_Manager.Log(m_Owner.Owner.name + " registered listener for " + m_Metadata.Name); } m_Actions += inAction; }
/// <summary> /// Registers a handler for the given message type. /// </summary> public MsgTable Batch(MsgType inType, MsgActionHandler inHandler) { if (m_Entries == null) { m_Entries = new List <IEntry>(); } m_Entries.Add(new ActionHandlerEntry(inType, inHandler)); return(this); }
public void Dispose() { m_Owner = null; m_Manager = null; m_DebugMode = false; m_Metadata = null; m_AllowedArgType = null; m_Handlers = null; m_Actions = null; if (m_Typed != null) { m_Typed.Dispose(); m_Typed = null; } }
/// <summary> /// Deregisters a handler for the given MsgType. /// </summary> public void Deregister(MsgType inType, MsgActionHandler inHandler) { ValidateRegisterArgs(inType, inHandler); DelegateBlock handler; if (m_Handlers.TryGetValue(inType, out handler)) { handler.Deregister(inHandler); if (handler.IsEmpty()) { handler.Dispose(); m_Handlers.Remove(inType); if (m_Parent != null) { m_Parent.Deregister(inType, this); } } } }
/// <summary> /// Registers a handler for the given MsgType. /// </summary> public void Register(MsgType inType, MsgActionHandler inHandler) { ValidateRegisterArgs(inType, inHandler); DelegateBlock handler; if (m_Handlers.TryGetValue(inType, out handler)) { handler.Register(inHandler); } else { handler = m_Handlers[inType] = new DelegateBlock(this, m_Manager, inType); handler.Register(inHandler); if (m_Parent != null) { m_Parent.Register(inType, this); } } }
public ActionHandlerEntry(MsgType inType, MsgActionHandler inHandler) { Type = inType; Handler = inHandler; }