Class SignalManager<TKey>
A simple signal container meant to make dispatching and managing signal listeners across various systems easier
Inheritance
Namespace: Atlas
Assembly: Atlas.Runtime.dll
Syntax
public class SignalManager<TKey>
Type Parameters
Name | Description |
---|---|
TKey | Type of key to use for identifying signals |
Constructors
| Improve this Doc View SourceSignalManager()
Constructor
Declaration
public SignalManager()
Methods
| Improve this Doc View SourceAddListener(TKey, Action)
Adds a zero-argument callback to the signal with the given key
Declaration
public void AddListener(TKey signalKey, Action listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action | listener | Callback to register as a listener |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
AddListener<T>(TKey, Action<T>)
Adds a single-argument callback to the signal with the given key
Declaration
public void AddListener<T>(TKey signalKey, Action<T> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T> | listener | Callback to register as a listener |
Type Parameters
Name | Description |
---|---|
T | Type of the signal's argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
AddListener<T1, T2>(TKey, Action<T1, T2>)
Adds a two-argument callback to the signal with the given key
Declaration
public void AddListener<T1, T2>(TKey signalKey, Action<T1, T2> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T1, T2> | listener | Callback to register as a listener |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
AddListener<T1, T2, T3>(TKey, Action<T1, T2, T3>)
Adds a three-argument callback to the signal with the given key
Declaration
public void AddListener<T1, T2, T3>(TKey signalKey, Action<T1, T2, T3> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T1, T2, T3> | listener | Callback to register as a listener |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
T3 | Type of the signal's third argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
AddListener<T1, T2, T3, T4>(TKey, Action<T1, T2, T3, T4>)
Adds a four-argument callback to the signal with the given key
Declaration
public void AddListener<T1, T2, T3, T4>(TKey signalKey, Action<T1, T2, T3, T4> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T1, T2, T3, T4> | listener | Callback to register as a listener |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
T3 | Type of the signal's third argument |
T4 | Type of the signal's fourth argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
Dispatch(TKey)
Dispatches the signal with the given key
Declaration
public void Dispatch(TKey signalKey)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key of the signal to dispatch |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch with the signal instance associated with the given key |
Dispatch<T>(TKey, T)
Dispatches the signal with the given key
Declaration
public void Dispatch<T>(TKey signalKey, T arg)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key of the signal to dispatch |
T | arg | Argument to dispatch the signal with |
Type Parameters
Name | Description |
---|---|
T | Type of the signal's argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch with the signal instance associated with the given key |
Dispatch<T1, T2>(TKey, T1, T2)
Dispatches the signal with the given key
Declaration
public void Dispatch<T1, T2>(TKey signalKey, T1 arg1, T2 arg2)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key of the signal to dispatch |
T1 | arg1 | First argument to dispatch the signal with |
T2 | arg2 | Second argument to dispatch the signal with |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch with the signal instance associated with the given key |
Dispatch<T1, T2, T3>(TKey, T1, T2, T3)
Dispatches the signal with the given key
Declaration
public void Dispatch<T1, T2, T3>(TKey signalKey, T1 arg1, T2 arg2, T3 arg3)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key of the signal to dispatch |
T1 | arg1 | First argument to dispatch the signal with |
T2 | arg2 | Second argument to dispatch the signal with |
T3 | arg3 | Third argument to dispatch the signal with |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
T3 | Type of the signal's third argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch with the signal instance associated with the given key |
Dispatch<T1, T2, T3, T4>(TKey, T1, T2, T3, T4)
Dispatches the signal with the given key
Declaration
public void Dispatch<T1, T2, T3, T4>(TKey signalKey, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key of the signal to dispatch |
T1 | arg1 | First argument to dispatch the signal with |
T2 | arg2 | Second argument to dispatch the signal with |
T3 | arg3 | Third argument to dispatch the signal with |
T4 | arg4 | Fourth argument to dispatch the signal with |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
T3 | Type of the signal's third argument |
T4 | Type of the signal's fourth argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch with the signal instance associated with the given key |
RemoveListener(TKey, Action)
Removes a zero-argument callback from the signal with the given key
Declaration
public void RemoveListener(TKey signalKey, Action listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action | listener | Callback to unregister |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
RemoveListener<T>(TKey, Action<T>)
Removes a single-argument callback from the signal with the given key
Declaration
public void RemoveListener<T>(TKey signalKey, Action<T> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T> | listener | Callback to unregister |
Type Parameters
Name | Description |
---|---|
T | Type of the signal's argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
RemoveListener<T1, T2>(TKey, Action<T1, T2>)
Removes a two-argument callback from the signal with the given key
Declaration
public void RemoveListener<T1, T2>(TKey signalKey, Action<T1, T2> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T1, T2> | listener | Callback to unregister |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
RemoveListener<T1, T2, T3>(TKey, Action<T1, T2, T3>)
Removes a three-argument callback from the signal with the given key
Declaration
public void RemoveListener<T1, T2, T3>(TKey signalKey, Action<T1, T2, T3> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T1, T2, T3> | listener | Callback to unregister |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
T3 | Type of the signal's third argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |
RemoveListener<T1, T2, T3, T4>(TKey, Action<T1, T2, T3, T4>)
Removes a four-argument callback from the signal with the given key
Declaration
public void RemoveListener<T1, T2, T3, T4>(TKey signalKey, Action<T1, T2, T3, T4> listener)
Parameters
Type | Name | Description |
---|---|---|
TKey | signalKey | Key for the desired signal |
System.Action<T1, T2, T3, T4> | listener | Callback to unregister |
Type Parameters
Name | Description |
---|---|
T1 | Type of the signal's first argument |
T2 | Type of the signal's second argument |
T3 | Type of the signal's third argument |
T4 | Type of the signal's fourth argument |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when there is an argument mismatch between the listener and the signal |