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
T
The 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
delegates
Dictionary<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
object
objectThe 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
obj
objectThe listener instance.
instance
TThe .
InvokeAll(T)
Invokes all the delegates from all the bound delegates.
public virtual void InvokeAll(T instance)
Parameters
instance
TThe parameter instance.
Unbind(object)
Unbinds a listener from the event dispatcher.
public virtual void Unbind(object obj)
Parameters
obj
objectThe 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
left
TDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to bind the listener to.
right
TDynamicDelegate<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
left
TDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to bind the listeners to.
right
TDynamicEventDispatcher<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
left
TDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to bind the listener to.
right
Action<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
left
TDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to unbind the delegate from.
right
TDynamicDelegate<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
left
TDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to unbind the listeners from.
right
TDynamicEventDispatcher<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
left
TDynamicEventDispatcher<T>The TDynamicEventDispatcher<T> to unbind the listener from.
right
Action<T>The delegate to unbind.
Returns
- TDynamicEventDispatcher<T>
The left-hand TDynamicEventDispatcher<T> operator.