Show / Hide Table of Contents

    Interface IActionService

    An IService that defines either an implementation for (un)subscribing listeners, and dispatching of IActions.

    Inherited Members
    IService.OnInitialized
    IService.IsInitialized
    IService.Initialize()
    IService.Cleanup()
    IInjectable.Inject(IResolver)
    Namespace: IdleKit.Core
    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)

    Dispatch an IAction immediately. Any subscribers that listens to this IAction would be notified.

    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)

    Dispatch an IAction immediately. Any subscribers that listens to this IAction would be notified.

    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

    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 T.

    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 T is Dispatch<T>(Object). The listener is expected to have its parameter as type T.

    Int32 priority

    The higher the priority the earlier the listener would be called among all the listeners.

    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 T is Dispatch<T>(Object). The delegate is expected to have its parameter as type T.

    Object instance

    Takes the instance of an object if a listener should only be invoked when the instance is Dispatch<T>(T, Object) with the IAction of type T

    Int32 priority

    The higher the priority the earlier the listener would be called among all the listeners.

    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.

    Back to top Copyright © 2020 East Side Games Inc.