Show / Hide Table of Contents

    Class TimerService

    An implementation of ITimerService where time can be advanced both manually or via OnUpdate.

    Inheritance
    Object
    TimerService
    Implements
    ITimerService
    IService
    Namespace: IdleKit.Gameplay
    Assembly: cs.temp.dll.dll
    Syntax
    public class TimerService : ServiceBase, ITimerService, IService

    Constructors

    TimerService()

    Declaration
    public TimerService()

    Fields

    _comparer

    Declaration
    protected readonly TimerService.ListenerPriorityComparer _comparer
    Field Value
    Type Description
    TimerService.ListenerPriorityComparer

    _gameTime

    In IdleKit's implementation _gameTime would be set to this every OnUpdate.

    Declaration
    protected DateTime _gameTime
    Field Value
    Type Description
    DateTime

    _listeners

    Declaration
    protected readonly SortedSet<ITimerListener> _listeners
    Field Value
    Type Description
    SortedSet<ITimerListener>

    _pauseCounter

    Declaration
    protected int _pauseCounter
    Field Value
    Type Description
    Int32

    _systemClock

    Declaration
    protected ISystemClock _systemClock
    Field Value
    Type Description
    ISystemClock

    Properties

    GameTime

    Declaration
    public virtual DateTime GameTime { get; }
    Property Value
    Type Description
    DateTime

    GameTimestamp

    Declaration
    public virtual long GameTimestamp { get; }
    Property Value
    Type Description
    Int64

    Paused

    Declaration
    public virtual bool Paused { get; }
    Property Value
    Type Description
    Boolean

    TimerListeners

    Declaration
    public virtual ITimerListener[] TimerListeners { get; }
    Property Value
    Type Description
    ITimerListener[]

    Methods

    CleanupService()

    Declaration
    protected override void CleanupService()

    CompleteSubscription(ITimerListener)

    Effectively skips the ITimerListener subscription to the timer service to the end of it's duration. The OnTimerEnded method of the ITimerListener will be called once the subscription is complete.

    Declaration
    public virtual void CompleteSubscription(ITimerListener timerListener)
    Parameters
    Type Name Description
    ITimerListener timerListener
    Remarks

    The ITimerListener will not be automatically unsubscribed on completion.

    EvaluateListeners()

    Declaration
    protected virtual void EvaluateListeners()

    EvaluateSubscriber(ITimerListener)

    Declaration
    protected virtual bool EvaluateSubscriber(ITimerListener listener)
    Parameters
    Type Name Description
    ITimerListener listener
    Returns
    Type Description
    Boolean

    InitializeService()

    Declaration
    protected override void InitializeService()

    Inject(IResolver)

    Declaration
    public override void Inject(IResolver resolver)
    Parameters
    Type Name Description
    IResolver resolver

    IsSubscribed(ITimerListener)

    Declaration
    public virtual bool IsSubscribed(ITimerListener timerListener)
    Parameters
    Type Name Description
    ITimerListener timerListener
    Returns
    Type Description
    Boolean

    OnApplicationPaused(Boolean)

    Declaration
    protected virtual void OnApplicationPaused(bool pause)
    Parameters
    Type Name Description
    Boolean pause

    OnUpdate(Single, Single)

    Declaration
    protected virtual void OnUpdate(float deltaTime, float unscaledDeltaTime)
    Parameters
    Type Name Description
    Single deltaTime
    Single unscaledDeltaTime

    Pause()

    Declaration
    public virtual void Pause()

    Resume()

    Declaration
    public virtual void Resume()

    SetGameTimestamp(Int64)

    Declaration
    public virtual void SetGameTimestamp(long timestamp)
    Parameters
    Type Name Description
    Int64 timestamp

    Subscribe(ITimerListener)

    Declaration
    public virtual bool Subscribe(ITimerListener timerListener)
    Parameters
    Type Name Description
    ITimerListener timerListener
    Returns
    Type Description
    Boolean

    Unsubscribe(ITimerListener)

    Declaration
    public virtual bool Unsubscribe(ITimerListener timerListener)
    Parameters
    Type Name Description
    ITimerListener timerListener
    Returns
    Type Description
    Boolean

    Implements

    ITimerService
    IService
    Back to top Copyright © 2020 East Side Games Inc.