[go: up one dir, main page]

Menu

EventSystem

Sahits GmbH

Event System

The event system or messaging is used to notify different parts of the game of a change. Different parts may be different areas of the GUI but also global changes (the price change of a ware after a transaction)

The system itself is a mixture of Java's event system and the Observer pattern. Each interested party in updates implements the IEventListener and registers itself with the Event class the base class for all events. The Events them self are sub-classed to represent their particular flavour:

  • Price change event
  • City events (population, availability, desire)
  • Panel updates
  • ...

The focal point of the Event class is its notify(Object) method. (Object may be replaces as soon as we know what Object can be.) It calls the gameUpdate(Event,Object) methods in all the listeners. The listeners in turn then decide if they are interested in the message based on the Event object. If they are interested the notice Object tells them more about the update.


Related

Wiki: Client_Server
Wiki: Client_Server_Maven
Wiki: GameEngine_Player
Wiki: Home