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); } }
public void AddReceiver(string receiverID, RemoteEventHandler receiver) { getHandlerDictionary().Add(receiverID, receiver); }