// Reset all static information that should only be relevant for this diagnostic session // Should only be called when player exits play loop to the main menu // (in summary page and from button in main play page) public static void ResetCaseInformation() { patient = new PatientData(); SelectedSymptom = SymptomState.Nothing; UserDiagnosis = DiagnosisState.Undiagnosed; TrueDiagnosis = DiagnosisState.Undiagnosed; UserReasoning = new Dictionary <SymptomState, ReasoningState>(); isFirstPlayMainVisit = true; hasViewedHeadExam = false; hasViewedSkinExam = false; hasPlayerBeenAwarded = false; return; }
// Function to do API call and get data for a record public static void get_patient_data() { // Construct API endpoint URL (case ID is determined using a private helper function) GetDatabaseCaseID(); string url = "https://diagnostic-gamification-api.herokuapp.com/v1/cases/" + CaseID; // Make HTTP request to URL HttpWebRequest request = (HttpWebRequest)WebRequest.Create(String.Format(url)); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // Read in HTTP response from API, which will have our data in JSON format StreamReader reader = new StreamReader(response.GetResponseStream()); string jsonResponse = reader.ReadToEnd(); // Parse our data from JSON into our C# serializable class (defined in PatientData.cs) patient = JsonUtility.FromJson <PatientData>(jsonResponse); // Set the true diagnosis enum based on diagnosis string value from API response SetDiagnosisEnum(); return; }