// Updates the Status text private void UpdateStatus() { // Get text component of object Text textComponent = CorrectStatus.GetComponent <Text>(); // Get the Symptom currently being compared SymptomState symptom = UserSelectedReasoning[reasoningIndex]; if (CaseInformation.UserReasoning[symptom] == ReasoningState.Correct) { textComponent.text = "Correct Reasoning"; // Set color to green using the default green color textComponent.color = Color.green; } else { textComponent.text = "Incorrect Reasoning"; // The default red color is quite bright, so we are instead using // a hexidecimal code for red string redHexColor = "#C03232"; Color unityColorObject; ColorUtility.TryParseHtmlString(redHexColor, out unityColorObject); textComponent.color = unityColorObject; } return; }
// Update the dictionary containing user selected reasoning public void UpdateUserReasoning(SymptomState selectedSymptom, ReasoningState userChoice) { // Update the dictionaries tracking the reasoning for user and correct choices // Only use first reasoning choice if (!userReasoning.ContainsKey(selectedSymptom)) { userReasoning[selectedSymptom] = reasoningChoices[userChoice]; correctReasoning[selectedSymptom] = reasoningChoices[ReasoningState.Correct]; } return; }
// Updates the correct reasoning text box private void UpdateCorrectReasoning() { // Get text component of object Text textComponent = CorrectReasoning.GetComponent <Text>(); // Get the Symptom currently being compared SymptomState symptom = UserSelectedReasoning[reasoningIndex]; // Set value of the text textComponent.text = PlayLoopData.ReasoningValues[symptom][ReasoningState.Correct]; return; }
// Updates the user reasoning text box private void UpdateUserReasoning() { // Get text component of object Text textComponent = UserReasoning.GetComponent <Text>(); // Get the Symptom currently being compared SymptomState symptom = UserSelectedReasoning[reasoningIndex]; // Get the ReasoningValue the user selected for that symptom ReasoningState userChoice = CaseInformation.UserReasoning[symptom]; // Set value of the text textComponent.text = PlayLoopData.ReasoningValues[symptom][userChoice]; return; }
// 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; }
// Updating the screen according to the selectedSymptom public void ChangeSymptomInfo(SymptomState selectedSymptom, Texture2D buttonTexture, SpriteFont font) { // Reset screen object _screen = new Screen(); SymptomInfoStatus = selectedSymptom; switch (selectedSymptom) { case SymptomState.General: { // Design screen and place elements according to design for Extremities DesignScreenExamGeneral(); PlaceElementsExamGeneral(buttonTexture, font); break; } case SymptomState.Head: { // Design screen and place elements according to design for Extremities DesignScreenExamHead(); PlaceElementsExamHead(buttonTexture, font); break; } case SymptomState.Neck: { // Design screen and place elements according to design for Extremities DesignScreenExamNeck(); PlaceElementsExamNeck(buttonTexture, font); break; } case SymptomState.Lungs: { // Design screen and place elements according to design for Extremities DesignScreenExamLungs(); PlaceElementsExamLungs(buttonTexture, font); break; } case SymptomState.Extremities: { // Design screen and place elements according to design for Extremities DesignScreenExamExtremities(); PlaceElementsExamExtremities(buttonTexture, font); break; } case SymptomState.Skin: { // Design screen and place elements according to design for Skin DesignScreenExamSkin(); PlaceElementsExamSkin(buttonTexture, font); break; } case SymptomState.Abdomen: { // Design screen and place elements according to design for Abdomen DesignScreenExamAbdomen(); PlaceElementsExamAbdomen(buttonTexture, font); break; } case SymptomState.Oxygen: { // Design screen and place elements according to design for Oxygen DesignScreenExamOxygen(); PlaceElementsExamOxygen(buttonTexture, font); break; } case SymptomState.Bloodwork: { // Design screen and place elements according to design for Bloodwork DesignScreenExamBloodwork(); PlaceElementsExamBloodwork(buttonTexture, font); break; } case SymptomState.Imaging: { // Design screen and place elements according to design for Imaging DesignScreenExamImaging(); PlaceElementsExamImaging(buttonTexture, font); break; } } return; }
public SymptomInfoPlayPage(PatientData patientInfo, SymptomState selectedSymptom, Texture2D buttonTexture, SpriteFont font) { PatientData = patientInfo; IsUserFinishedReviewing = false; SymptomInfoStatus = selectedSymptom; }
public void Update(GameTime gameTime) { switch (CurrentPlayState) { case PlayState.Initial: { // Check the flag stored in InitialPlayPage to see if user finished reading initial information if (initialPlayPage.IsUserFinishedWithPage) { // Reset Initial's state tracker initialPlayPage.IsUserFinishedWithPage = false; // Update state variable for next state in Play loop CurrentPlayState = PlayState.Main; } { // User is not done with the initial page yet, so update this page initialPlayPage.Update(gameTime); } break; } case PlayState.Main: { switch (mainPlayPage.CurrentMainPlayState) { case PlayState.Diagnose: { // Reset state tracker of main game play page mainPlayPage.CurrentMainPlayState = PlayState.Main; // Player is ready to diagnose the patient's ARF (switches screens) CurrentPlayState = PlayState.Diagnose; break; } case PlayState.SymptomList: { // Reset state tracker of main game play page mainPlayPage.CurrentMainPlayState = PlayState.Main; // Player wants to investigate a symptom (switches screens) CurrentPlayState = PlayState.SymptomList; break; } case PlayState.Back: { // Player wants to return to main menu of the whole app IsUserDoneWithPlay = true; // Reset the state tracker of the main game loop page mainPlayPage.CurrentMainPlayState = PlayState.Main; break; } default: { // User hasn't done anything on main play page yet, so update mainPlayPage.Update(gameTime); break; } } break; } case PlayState.SymptomList: { // Determine which symptom the user wants to investigate // The default value is SymptomState.Nothing switch (symptomListPlayPage.SelectedSymptom) { case SymptomState.Nothing: { // Default state, just update // This case MUST be explicitly written since its behavior differs from MainMenu and default symptomListPlayPage.Update(gameTime); break; } case SymptomState.MainMenu: { // The user wants to return to main page of play loop (switches screens) CurrentPlayState = PlayState.Main; // Reset state tracker of symptom list for next visit symptomListPlayPage.SelectedSymptom = SymptomState.Nothing; break; } default: { // For all other cases, the user wants to investigate a symptom // Re-create the symptom info page to display correct info symptomInfoPlayPage.ChangeSymptomInfo(symptomListPlayPage.SelectedSymptom, _buttonTexture, _font); // Update the PlayPage variable tracking last selected symptom (needed for reasoning page) lastSelectedSymptom = symptomListPlayPage.SelectedSymptom; // Update state to point to info page (switches screens) CurrentPlayState = PlayState.SymptomInfo; // Reset state tracker of symptom list for next visit // NOTE THIS UPDATE MUST BE THE LAST THING IN THIS CASE BLOCK symptomListPlayPage.SelectedSymptom = SymptomState.Nothing; break; } } break; } case PlayState.SymptomInfo: { // Check if user is done reviewing information on the symptom they selected if (symptomInfoPlayPage.IsUserFinishedReviewing) { // User is finished reviewing // Check for edge case (only present during alpha) for imaging if (symptomInfoPlayPage.SymptomInfoStatus == SymptomState.Imaging) { // Set play page back to Main Play page (skip reasoning) CurrentPlayState = PlayState.Main; } else { // Normal case displays reasoning page after symptom info // TODO: NEED TO CHECK WHICH VALUES THE USER HAS ALREADY SEEN AND NOT SEND THEM TO REASONING UpdateReasoningPage(lastSelectedSymptom); CurrentPlayState = PlayState.Reasoning; } // Reset state tracker within System Info page for next visit symptomInfoPlayPage.IsUserFinishedReviewing = false; symptomInfoPlayPage.SymptomInfoStatus = SymptomState.Nothing; } else { // User is not finished reviewing symptom info, so update page symptomInfoPlayPage.Update(gameTime); } break; } case PlayState.Reasoning: { // Check if the user is finished reviewing summary page if (reasoningPlayPage.IsUserFinishedWithPage) { // Update the dictionaries that track user reasoning choices UpdateUserReasoning(lastSelectedSymptom, reasoningPlayPage.SelectedReasoning); // Reset reasoning page's state tracker reasoningPlayPage.IsUserFinishedWithPage = false; reasoningPlayPage.SelectedReasoning = ReasoningState.Undecided; // User is finished with reasoning page (selected a reasoning), return to main page of play CurrentPlayState = PlayState.Main; } else { // User is not yet finished, update page reasoningPlayPage.Update(gameTime); } break; } case PlayState.Diagnose: { switch (diagnosePlayPage.PatientDiagnosis) { case DiagnosisState.Undiagnosed: { // Undiagnosed (player hasn't selected anything) diagnosePlayPage.Update(gameTime); break; } case DiagnosisState.Back: { // Update diagnosePlayPage's game state diagnosePlayPage.PatientDiagnosis = DiagnosisState.Undiagnosed; // Player mistakenly chose diagnose and wants to return to main play page CurrentPlayState = PlayState.Main; break; } default: { // In all other cases, Player has made a diagnosis // Update diagnosis variable _playerDiagnosis = diagnosePlayPage.PatientDiagnosis; // Update diagnosePlayPage's game state (reset for next visit) diagnosePlayPage.PatientDiagnosis = DiagnosisState.Undiagnosed; // Make sure summary page is up to date with reasoning values SendSummaryPageReasoning(); // Change state to go to summary CurrentPlayState = PlayState.Summary; break; } } break; } case PlayState.Summary: { // Check if the user is finished reviewing summary page if (summaryPlayPage.IsUserFinishedWithPage) { // Reset summary page's state tracker summaryPlayPage.IsUserFinishedWithPage = false; // DO NOT call resetPlayLoop() here. There will be an infinite loop // User is finished with summary page, return to main menu of app IsUserDoneWithPlay = true; CurrentPlayState = PlayState.Main; } else { // User is not yet finished, update page summaryPlayPage.Update(gameTime); } break; } } return; }
// Function for updating the reasoning page for the user to select from public void UpdateReasoningPage(SymptomState selectedSymptom) { // Reset the reasoningChoices dictionary reasoningChoices = new Dictionary <ReasoningState, String>(); // Populate reasoningChoices with corresponding reasoning choices switch (selectedSymptom) { case SymptomState.General: { reasoningChoices[ReasoningState.Correct] = "General Exam Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "General Exam Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "General Exam Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "General Exam Incorrect Reasoning 3"; break; } case SymptomState.Head: { reasoningChoices[ReasoningState.Correct] = "Head Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Head Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Head Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Head Incorrect Reasoning 3"; break; } case SymptomState.Neck: { reasoningChoices[ReasoningState.Correct] = "Neck Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Neck Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Neck Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Neck Incorrect Reasoning 3"; break; } case SymptomState.Lungs: { reasoningChoices[ReasoningState.Correct] = "Lungs Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Lungs Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Lungs Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Lungs Incorrect Reasoning 3"; break; } case SymptomState.Extremities: { reasoningChoices[ReasoningState.Correct] = "Extremities Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Extremities Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Extremities Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Extremities Incorrect Reasoning 3"; break; } case SymptomState.Skin: { reasoningChoices[ReasoningState.Correct] = "Skin Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Skin Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Skin Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Skin Incorrect Reasoning 3"; break; } case SymptomState.Abdomen: { reasoningChoices[ReasoningState.Correct] = "Abdomen Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Abdomen Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Abdomen Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Abdomen Incorrect Reasoning 3"; break; } case SymptomState.Oxygen: { reasoningChoices[ReasoningState.Correct] = "Oxygen Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Oxygen Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Oxygen Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Oxygen Incorrect Reasoning 3"; break; } case SymptomState.Bloodwork: { reasoningChoices[ReasoningState.Correct] = "Bloodwork Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Bloodwork Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Bloodwork Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Bloodwork Incorrect Reasoning 3"; break; } case SymptomState.Imaging: { reasoningChoices[ReasoningState.Correct] = "Imaging Correct Reasoning"; reasoningChoices[ReasoningState.Incorrect1] = "Imaging Incorrect Reasoning 1"; reasoningChoices[ReasoningState.Incorrect2] = "Imaging Incorrect Reasoning 2"; reasoningChoices[ReasoningState.Incorrect3] = "Imaging Incorrect Reasoning 3"; break; } } // Force the page to redraw with the new reasoning values reasoningPlayPage.ReasoningChoices = reasoningChoices; reasoningPlayPage.UpdateReasoningPage(); return; }