Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prime31/MessageKit
Decoupled message sending system meant as a replacement for SendMessage and its variants.
https://github.com/prime31/MessageKit
Last synced: 3 months ago
JSON representation
Decoupled message sending system meant as a replacement for SendMessage and its variants.
- Host: GitHub
- URL: https://github.com/prime31/MessageKit
- Owner: prime31
- Created: 2014-04-27T00:15:24.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-09-17T20:18:32.000Z (over 6 years ago)
- Last Synced: 2024-08-02T05:16:32.411Z (6 months ago)
- Language: C#
- Size: 68.4 KB
- Stars: 125
- Watchers: 16
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-unity-open-source-on-github - MessageKit - Decoupled message sending system meant as a replacement for SendMessage and its variantslibrary (Message Bus)
README
MessageKit
==========Decoupled message sending system meant as a replacement for SendMessage and its variants. MessageKit comes with the ability to send zero, one or two parameter messages. The keys for messages are ints. Most message systems use strings but it has been my experience that folks are less likely to define their keys as consts when dealing with strings so it ends up creating hard to debug issues when a string is mistyped. By using ints for keys the hope is that MessageKit users will define their keys as *const ints* so that they get the benefit of code completion and end up with easy to read code.
Usage
---- define your event types as *const ints*
- to add an event listener for a zero parameter event call *MessageKit.addObserver( eventType, handler )*
- post events by calling *MessageKit.post( eventType )*
- don't forget to remove your event listeners with *MessageKit.removeObserver( handler )*!One or Two Parameter Events
---When using events with parameters you need to specifiy the paramter types so that everything remains strongly typed.
- to add an event listener for a one parameter event call *MessageKit<Transform>.addObserver( eventType, handler )* (notice that the parameter type is Transform for this example)
- post events by calling *MessageKit<Transform>.post( eventType, someTransform )*
- don't forget to remove your event listeners with *MessageKit<Transform>.removeObserver( handler )*!License
-----[Attribution-NonCommercial-ShareAlike 3.0 Unported](http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode) with [simple explanation](http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US) with the attribution clause waived. You are free to use MessageKit in any and all games that you make. You cannot sell MessageKit directly or as part of a larger game asset.