At this point, I've been busy, and haven't really done any programming in a month or two ( laaame, I know)... But I have a good amount of free time now, and I've been kicking around this idea in my head, so I was looking for some constructive criticism, or for people to just straight out call me a dumb ass, either works :p.
So I want to implement a sort of 'Messaging System', and here's how I thought I'd go about implementing it:
Composed of 3 main classes: MessageManager, MessageListener, and Message.
The MessageManager would be composed of a container of messages and a container of listeners. It would have function(s) to send messages which would either instantly send the message, or send it after a period of time (which would be stored in the message container). I'm not really sure at this point about how to go about finding which listeners should receive which messages.
The MessageListener would be something that any class could have it's own instance of. It would contain some sort of container of Message IDs which would determine which messages it was subscribed to. It would have an 'OnMessage' function which would return a boolean to indicate if the message was 'consumed' or not. I was thinking I could use this to make a 'messenging' component to add easy messaging capabilities to any entity.
The Message would simply be a struct that would hold the message ID, and the accompanying message data.
So essentially the process would be like:
*Create Listener
*Subscribe to Certain Event Types via Listener
*Attach Listener to Manager
*Create Message
*Send Message Through Manager
*Manager Checks to Find Which Listeners are Subscribed to That Particular Message
*Manager Sends the Message to Those Listeners
*Listeners Handle Stuff, and Can Choose to Consume the Message (Meaning it won't get sent to any other listeners...)
Sooo, does anyone see any potential holes in this? I won't have time to program until this weekend, so I figure I might as well get as much thought out on this as I can
