Example #1
0
 public void AddSubscriber(MessageSubscriber subscriber)
 {
     MessageType[] messageTypes = subscriber.MessageTypes;
     for (int i = 0; i < messageTypes.Length; i++)
     {
         AddSubscriberToMessage(messageTypes[i], subscriber);
     }
 }
Example #2
0
        void Start()
        {
            MessageSubscriber subscriber = new MessageSubscriber();

            subscriber.MessageTypes = MessageTypes;
            subscriber.Handler      = this;

            MessageBus.Instance.AddSubscriber(subscriber);
        }
Example #3
0
        void AddSubscriberToMessage(MessageType messageType,
                                    MessageSubscriber subscriber)
        {
            if (!subscriberLists.ContainsKey(messageType))
            {
                subscriberLists[messageType] = new List <MessageSubscriber>();
            }

            subscriberLists[messageType].Add(subscriber);
        }
Example #4
0
 void SendMessageToSubscriber(Message message, MessageSubscriber subscriber)
 {
     subscriber.Handler.HandleMessage(message);
 }