Package rea.events


package rea.events

Types related to events. Communication with players follow the Observer / Publish-subscribe design pattern. Several types of events are supported, all sharing the type UpdateEvent, namely:

GamesUpdateEvent
the list of available games changed;
GameChangedEvent
a game changed its state (a new player was added, or the game ended)
SceneUpdateEvent
the scene changed in a particular place (an item or player was added/removed, for instance);
InventoryUpdateEvent
the inventory changed (has a new item, for instance)

These events can be received by classes implementing the UpdateListener interface.

The observable participant of the design part is implemented by the EventBroadcast and the EventMulticast classes. The former supports broadcast to all registered listeners for a certain kind of event, defined by its parametric type. The later supports multicast to a subset of the registered listeners, identified by the corresponding character.

Author:
José Paulo Leal jpleal@fc.up.pt