Interface IActionService
An IService that defines either an implementation for (un)subscribing listeners, and dispatching of IActions.
Namespace: IdleKit.Framework
Assembly: cs.temp.dll.dll
Syntax
public interface IActionService : IService, IInjectable
Methods
Dispatch<T>()
An overridden version of the Dispatch<T>(T) that doesn't require setup.
Declaration
void Dispatch<T>()
where T : class, IAction
Type Parameters
Name | Description |
---|---|
T | Type of the IAction to dispatch. |
Dispatch<T>(T)
Declaration
void Dispatch<T>(T actionTrigger)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
T | actionTrigger | The IAction to dispatch. |
Type Parameters
Name | Description |
---|---|
T | Type of the IAction to dispatch. |
Dispatch<T>(T, Object)
Declaration
void Dispatch<T>(T actionTrigger, object instance)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
T | actionTrigger | The IAction to dispatch. |
Object | instance | The object that is associated with the IAction. |
Type Parameters
Name | Description |
---|---|
T |
Examples
In the case of a GeneratorPayoutChangedAction, the IGeneratorEntity who's GetPayoutAmount(Boolean, IModifier[]) changed would be the owner.
Dispatch<T>(Object)
An overridden version of the Dispatch<T>(T, Object) that doesn't require setup.
Declaration
void Dispatch<T>(object instance)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
Object | instance |
Type Parameters
Name | Description |
---|---|
T |
Get<T>()
Generates or fetches the IAction. The returned IAction should never be cached by the caller as the fields could be cleaned up after the call back Action<T> is invoked.
Instead, only use the returned IAction for setting up the IAction to Dispatch<T>(T, Object).
Declaration
T Get<T>()
where T : class, IAction
Returns
Type | Description |
---|---|
T | An IAction of type |
Type Parameters
Name | Description |
---|---|
T |
Subscribe<T>(Action<T>, Int32)
Adds a listener
for the specific type of IAction. The IAction
will be cleared right after the is invoked. Therefore, any
should not cache the IAction but its fields instead.
Declaration
void Subscribe<T>(Action<T> listener, int priority = 500)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
Action<T> | listener | A C# Action<T> that is invoked when an IdleKit
IAction of type |
Int32 | priority | The higher the priority the earlier the |
Type Parameters
Name | Description |
---|---|
T |
Subscribe<T>(Action<T>, Object, Int32)
An overloaded version of Subscribe<T>(Action<T>, Int32) where the listener
would only be invoked when an IAction is Dispatch<T>(T, Object) with the
instance
.
Declaration
void Subscribe<T>(Action<T> listener, object instance, int priority = 500)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
Action<T> | listener | A C# Action<T> that is invoked when an IAction of
type |
Object | instance | Takes the instance of an object if a |
Int32 | priority | The higher the priority the earlier the |
Type Parameters
Name | Description |
---|---|
T |
Unsubscribe<T>(Action<T>)
Attempts to remove an IAction listener that was previously subscribed.
Declaration
void Unsubscribe<T>(Action<T> listener)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
Action<T> | listener | The exact same C# Action that was used in Subscribe<T>(Action<T>, Int32) |
Type Parameters
Name | Description |
---|---|
T |
Remarks
This does nothing if the specific listener
associated with the IAction
can not be found.
Unsubscribe<T>(Action<T>, Object)
Attempts to remove an IAction listener associated with an instance
that was previously subscribed.
Declaration
void Unsubscribe<T>(Action<T> listener, object instance)
where T : class, IAction
Parameters
Type | Name | Description |
---|---|---|
Action<T> | listener | A C# Action<T> that was used in Subscribe<T>(Action<T>, Object, Int32) |
Object | instance | A reference to the instance, that was used in Subscribe<T>(Action<T>, Object, Int32) |
Type Parameters
Name | Description |
---|---|
T |
Remarks
This does nothing if the specific listener
associated with the IAction
and instance
can not be found.