Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace iGP
- {
- public class MessageManager
- {
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //Public methods
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- public void RegisterHandler( string messageName, Action<> messageAction )
- {
- messages.Add(messageName, messageAction);
- }
- public void MessageReceived( string messageName )
- {
- if (messages.ContainsKey(messageName))
- messages[messageName]();
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //Private fields
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- private Dictionary<string, Action<>> messages = new Dictionary<string, Action<>>();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement