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
-
ClassDescriptionEventBroadcast<T extends UpdateEvent>Event broadcast to registered listeners.EventMulticast<T extends UpdateEvent>Event multicast to groups of registered listeners.Event that indicates that a game instance has changed.An event that is sent to the client to update the list of games to play.An event that is sent to the client to update the player's inventory.An event that delivers a message to a player.An event that updates the scene, i.e.Marker interface for all update events.UpdateListener<T extends UpdateEvent>A listener for updates.