Пример #1
0
        public void RouteEvent(Protocol.Event e)
        {
            string receiverID = "";

            switch (e.EventCase)
            {
            case Protocol.Event.EventOneofCase.ModuleEvent:
                receiverID = e.ModuleEvent.HandlerId;
                break;

            case Protocol.Event.EventOneofCase.BrowserEvent:
                receiverID = "browser" + e.BrowserEvent.Path;
                break;

            default:
                Debug.LogError("Event not recognized");
                break;
            }

            if (getHandlerDictionary().ContainsKey(receiverID))
            {
                RemoteEventHandler receiver = getHandlerDictionary()[receiverID];
                receiver.HandleEvent(e);
            }
        }
Пример #2
0
 public void AddReceiver(string receiverID, RemoteEventHandler receiver)
 {
     getHandlerDictionary().Add(receiverID, receiver);
 }