C# Class fCraft.ChatTimer

Provides a way to create and manage publicly-announced countdowns. Long timers announce once an hour (e.g. "7h left"). During the last hour, timer announces more often: every 10 minutes, then every minute, then every 10 seconds, and finally every second - until the timer is up.
Show file Open project: fragmer/fCraft Class Usage Examples

Public Properties

Property Type Description
ID int
Id int
MinDuration System.TimeSpan

Private Properties

Property Type Description
AddTimerToList void
Announce void
ChatTimer System
FindTimerByID ChatTimer
FindTimerById ChatTimer
RaiseStartedEvent void
RaiseStartedEvent void
RaiseStoppedEvent void
RaiseStoppedEvent void
RemoveTimerFromList void
Stop void
TimerCallback void

Public Methods

Method Description
Abort ( ) : void

Stops this timer, and removes it from the list of timers.

Start ( System.TimeSpan duration, [ message, [ startedBy ) : ChatTimer

Starts this timer with the specified duration, and end message.

Stop ( ) : void

Private Methods

Method Description
AddTimerToList ( [ timer ) : void
Announce ( System.TimeSpan timeLeft ) : void
ChatTimer ( System.TimeSpan duration, [ message, [ startedBy ) : System
FindTimerByID ( int id ) : ChatTimer
FindTimerById ( int id ) : ChatTimer
RaiseStartedEvent ( ChatTimer timer ) : void
RaiseStartedEvent ( [ timer ) : void
RaiseStoppedEvent ( ChatTimer timer ) : void
RaiseStoppedEvent ( [ timer ) : void
RemoveTimerFromList ( [ timer ) : void
Stop ( bool aborted ) : void
TimerCallback ( [ task ) : void

Method Details

Abort() public method

Stops this timer, and removes it from the list of timers.
public Abort ( ) : void
return void

Start() public static method

Starts this timer with the specified duration, and end message.
startedBy is null. duration is less than ChatTimer.MinDuration.
public static Start ( System.TimeSpan duration, [ message, [ startedBy ) : ChatTimer
duration System.TimeSpan Amount of time the timer should run before completion. Should not be less than ChatTimer.MinDuration.
message [ Message to display when timer reaches zero. May be null.
startedBy [ Name of player who started timer. May not be null.
return ChatTimer

Stop() public method

public Stop ( ) : void
return void

Property Details

ID public property

Timer's unique numeric ID.
public int ID
return int

Id public property

public int Id
return int

MinDuration public static property

Minimum allowed timer duration (one second).
public static TimeSpan,System MinDuration
return System.TimeSpan