protected virtual void SendEvent(DispatchCommand command)
 {
     if (mapping.ContainsKey(command.DataType))
     {
         SendEvent(command, mapping[command.DataType]);
     }
 }
 protected virtual void SendEvent(DispatchCommand command, List <EventDelegate> handlers)
 {
     for (int i = handlers.Count; i >= 0; i--)
     {
         if (i >= handlers.Count)
         {
             continue;
         }
         SendEvent(command, handlers[i]);
     }
 }
        public virtual void Dispatch <T>(object sender, T data) where T : IEventBase
        {
            DispatchCommand command = new DispatchCommand()
            {
                sender = sender,
                data   = data
            };

            dispatchQueue.Enqueue(command);

            if (dispatchQueue.Count == 1)
            {
                SendQueuedEvent();
            }
        }
 protected virtual void SendEvent(DispatchCommand command, EventDelegate handeler)
 {
     handeler.Invoke(command.data);
 }