protected virtual void OnAdminUIMessage(AdminUIMessage <dynamic> message) { AdminUIMessage?.Invoke(this, new AdminUIMessageArgs() { message = message }); }
private void OnDataChannelMessage(string message) { Debug.LogFormat("Received message: {0}", message); AdminUIMessage <dynamic> adminUIMessage = JsonConvert.DeserializeObject <AdminUIMessage <dynamic> >(message); switch (adminUIMessage.eventType) { case "ScenarioSelection": EventManager.Instance.ConvertScenarioSelectedMessageToEvent(adminUIMessage.data); break; case "SystemUpdate": EventManager.Instance.ConvertSystemUpdateMessageToEvent(adminUIMessage.data); break; case "ScenarioEvent": EventManager.Instance.ConvertScenarioEventMessageToEvent(adminUIMessage.data); break; default: Debug.LogErrorFormat("{0} is not a valid eventType", adminUIMessage.eventType); AdminUIMessage <AdminUISystemUpdateMessage <string> > response = new AdminUIMessage <AdminUISystemUpdateMessage <string> >() { eventType = "SystemUpdate", data = new AdminUISystemUpdateMessage <string>() { action = "UnknownEvent", additionalData = adminUIMessage.eventType } }; dataChannel.Send(response.ToString()); break; } }
private void SendUnknownEventMessage(string eventName) { Debug.LogErrorFormat("Unknown event {0}", eventName); AdminUIMessage <dynamic> message = new AdminUIMessage <dynamic>() { eventType = "SystemUpdate", data = new AdminUISystemUpdateMessage <dynamic>() { action = "UnknownEvent", additionalData = eventName } }; OnAdminUIMessage(message); }