Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //first example: listeners are initialized directly in the controller
- public class ExampleControllerWithEvents
- {
- void Initialize()
- {
- _eventBus.AddListener(firstEventType,FirstListener);
- _eventBus.AddListener(secondEventType,SecondListener);
- }
- void FirstListener(){...}
- void SecondListener(){...}
- }
- //second example: listeners are managed by additional layer
- public class Binder
- {
- void Initialize()
- {
- _eventBus.AddListener(ExampleControllerFactory.Create().FirstListener);
- _eventBus.AddListener(ExampleControllerFactory.Create().FirstListener);
- }
- }
- public class ExampleController
- {
- void FirstListener(){...}
- void SecondListener(){...}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement