C# Class Descent.Messaging.Events.EventManager

Takes strings received from the network and fires the appropriate events. Can also convert an event to a text string and send it.
ファイルを表示 Open project: nezbo/Descent Class Usage Examples

Public Methods

Method Description
FirePlayersInGameEvent ( ) : void
ProcessEventQueue ( ) : void

Process the event queue. Will fire all events in the queue and clear it.

QueueEvent ( EventType eventType, GameEventArgs eventArgs, bool broadcast = true ) : void

Queue an event.

QueueStringEvent ( string eventString, bool broadcast = true ) : void

Take an event string and puts it on the event queue.

Private Methods

Method Description
AddRequiredEventArgs ( EventType eventType, GameEventArgs eventArgs ) : void

Populate a GameEventArgs object with required fields.

AddResponse ( ) : void

TODO: This method is not curently used. Should be used for methods requiring responses - like MoveTo and attacks in the future.

BuildEventArgs ( EventType eventType, string args ) : GameEventArgs

Builds the correct type of GameEventArgs object based on the event type.

EncodeMessage ( EventType eventType, GameEventArgs eventArgs ) : string

Encode a message to a string.

Fire ( EventType eventType, GameEventArgs eventArgs, bool sendOnNetwork ) : void

Fires an event.

GenerateEventId ( ) : string

Generates a unique event id. It's based on the current time, the player ip and the player id.

MD5String ( string input ) : string

Generate a MD5 hash from a given string.

NeedResponse ( EventType eventType ) : bool

Does this kind of EventType need a response?

ParseAndFire ( string eventString, bool sendOnNetwork ) : void

Parse an event string and fire the event.

Method Details

FirePlayersInGameEvent() public method

public FirePlayersInGameEvent ( ) : void
return void

ProcessEventQueue() public method

Process the event queue. Will fire all events in the queue and clear it.
public ProcessEventQueue ( ) : void
return void

QueueEvent() public method

Queue an event.
public QueueEvent ( EventType eventType, GameEventArgs eventArgs, bool broadcast = true ) : void
eventType EventType The type of event to queue.
eventArgs GameEventArgs The event arguments.
broadcast bool
return void

QueueStringEvent() public method

Take an event string and puts it on the event queue.
public QueueStringEvent ( string eventString, bool broadcast = true ) : void
eventString string Event string to queue.
broadcast bool
return void