Class TDynamicEventDispatcher<T>
- Namespace
- Exiled.API.Features.DynamicEvents
- Assembly
- Exiled.API.dll
The DynamicEventDispatcher's generic version which accepts a type parameter.
public class TDynamicEventDispatcher<T> : TypeCastObject<DynamicEventDispatcher>, IDynamicEventDispatcher
Type Parameters
TThe event type parameter.
- Inheritance
-
TDynamicEventDispatcher<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
TDynamicEventDispatcher()
Initializes a new instance of the TDynamicEventDispatcher<T> class.
public TDynamicEventDispatcher()
TDynamicEventDispatcher(Dictionary<object, List<Action<T>>>)
Initializes a new instance of the TDynamicEventDispatcher<T> class.
public TDynamicEventDispatcher(Dictionary<object, List<Action<T>>> delegates)
Parameters
delegatesDictionary<object, List<Action<T>>>The delegates to be bound.
Properties
BoundDelegates
Gets all the bound delegates.
public IReadOnlyDictionary<object, List<Action<T>>> BoundDelegates { get; }
Property Value
- IReadOnlyDictionary<object, List<Action<T>>>
this[object]
This indexer allows access to bound listeners using an object reference.
public KeyValuePair<object, List<Action<T>>> this[object @object] { get; }
Parameters
objectobjectThe listener to look for.
Property Value
- KeyValuePair<object, List<Action<T>>>
The obund listener corresponding to the specified reference.
Methods
Bind(object, Action<T>)
Binds a listener to the event dispatcher.
public virtual void Bind(object obj, Action<T> del)
Parameters
Invoke(object, T)
Invokes the delegates from the specified listener.
public virtual void Invoke(object obj, T instance)
Parameters
objobjectThe listener instance.
instanceTThe .
InvokeAll(T)
Invokes all the delegates from all the bound delegates.
public virtual void InvokeAll(T instance)
Parameters
instanceTThe parameter instance.
Unbind(object)
Unbinds a listener from the event dispatcher.
public virtual void Unbind(object obj)
Parameters
objobjectThe listener instance.
UnbindAll()
Unbinds all the delegates from all the bound delegates.
public virtual void UnbindAll()
Operators
operator +(TDynamicEventDispatcher<T>, TDynamicDelegate<T>)
Binds a listener to the event dispatcher.
public static TDynamicEventDispatcher<T> operator +(TDynamicEventDispatcher<T> left, TDynamicDelegate<T> right)
Parameters
leftTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to bind the listener to.
rightTDynamicDelegate<T>The TDynamicDelegate<T> containing the listener to bind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.
operator +(TDynamicEventDispatcher<T>, TDynamicEventDispatcher<T>)
Binds all bound listeners to a TDynamicEventDispatcher<T> to the event dispatcher.
public static TDynamicEventDispatcher<T> operator +(TDynamicEventDispatcher<T> left, TDynamicEventDispatcher<T> right)
Parameters
leftTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to bind the listeners to.
rightTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> containing the listeners to bind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.
operator +(TDynamicEventDispatcher<T>, Action<T>)
Binds a delegate the event dispatcher.
public static TDynamicEventDispatcher<T> operator +(TDynamicEventDispatcher<T> left, Action<T> right)
Parameters
leftTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to bind the listener to.
rightAction<T>The delegate to bind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.
operator -(TDynamicEventDispatcher<T>, TDynamicDelegate<T>)
Unbinds a delegate from the event dispatcher.
public static TDynamicEventDispatcher<T> operator -(TDynamicEventDispatcher<T> left, TDynamicDelegate<T> right)
Parameters
leftTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to unbind the delegate from.
rightTDynamicDelegate<T>The TDynamicDelegate<T> containing the delegate to unbind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.
operator -(TDynamicEventDispatcher<T>, TDynamicEventDispatcher<T>)
Unbinds all bound listeners to a TDynamicEventDispatcher<T> from the event dispatcher.
public static TDynamicEventDispatcher<T> operator -(TDynamicEventDispatcher<T> left, TDynamicEventDispatcher<T> right)
Parameters
leftTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to unbind the listeners from.
rightTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> containing the listeners to unbind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.
operator -(TDynamicEventDispatcher<T>, Action<T>)
Unbinds a delegate the event dispatcher.
public static TDynamicEventDispatcher<T> operator -(TDynamicEventDispatcher<T> left, Action<T> right)
Parameters
leftTDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to unbind the listener from.
rightAction<T>The delegate to unbind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.