flackr / dungeon

A D&D based multiplayer role playing game.
13 stars 4 forks source link

All objects should be constructed with a chance to register for events from dungeon.Game #7

Closed flackr closed 12 years ago

flackr commented 12 years ago

Use an event based communication model between components

Summary.

The game should work on an event based system to facilitate communications. On construction an object can add listeners for all events from dungeon.Game it is interested in, and dungeon.Game can add listeners for events from that object it is interested in. Then we can handle updating various components by dispatching established events which may cause several views to update.

Implementation.

Currently only combat-tracker.js needs to change. This should probably be created by dungeon-client.js and given a reference to dungeon.Client to listen for events on. In turn dungeon.Client can listen for events from combat-tracker which it's interested in.

kellis commented 12 years ago

Combat-tracker.js is now created from dungeon-client.js. When refactoring to split character-button.js into separate classes (character-button.js and character-details-page.js) the updated objects follow the event driven model.