Example #1
0
        // Constructor
        public PlayPage(Texture2D patientTexture, Texture2D buttonTexture, SpriteFont font)
        {
            // Set state variables
            CurrentPlayState   = PlayState.Initial;
            IsUserDoneWithPlay = false;
            _playerDiagnosis   = DiagnosisState.Undiagnosed;

            // Set asset variables
            _patientTexture = patientTexture;
            _buttonTexture  = buttonTexture;
            _font           = font;

            // Initialize variables


            // Initialize child page objects
            initialPlayPage     = new InitialPlayPage(buttonTexture, font);
            mainPlayPage        = new MainPlayPage(patientTexture, buttonTexture, font);
            diagnosePlayPage    = new DiagnosePlayPage(buttonTexture, font);
            symptomListPlayPage = new SymptomListPage(buttonTexture, font);
            reasoningPlayPage   = new ReasoningPlayPage(buttonTexture, font);
            summaryPlayPage     = new SummaryPlayPage(buttonTexture, font);

            // Get data before passing it into info page (and set data in initialPlayPage)
            getData();

            // Required to ensure screen is properly updated
            initialPlayPage.UpdateInitialPlayPage();


            symptomInfoPlayPage = new SymptomInfoPlayPage(patientData, SymptomState.Nothing, buttonTexture, font);
        }
Example #2
0
        public DiagnosePlayPage(Texture2D buttonTexture, SpriteFont font)
        {
            // Initialize diagnosis as undiagnosed
            PatientDiagnosis = DiagnosisState.Undiagnosed;

            DesignScreenLayout();

            CreateAndPlaceElements(buttonTexture, font);
        }
Example #3
0
        // Function that can be called by Game's state manager to reset the play loop thoroughly
        public void ResetPlayLoop()
        {
            // Set state variables for the PlayPage object
            CurrentPlayState   = PlayState.Initial;
            IsUserDoneWithPlay = false;
            userReasoning      = new Dictionary <SymptomState, string>();
            correctReasoning   = new Dictionary <SymptomState, string>();
            _playerDiagnosis   = DiagnosisState.Undiagnosed;

            // Reset state variables for all pages
            initialPlayPage.IsUserFinishedWithPage      = false;
            mainPlayPage.CurrentMainPlayState           = PlayState.Main;
            symptomListPlayPage.SelectedSymptom         = SymptomState.Nothing;
            symptomInfoPlayPage.IsUserFinishedReviewing = false;
            symptomInfoPlayPage.SymptomInfoStatus       = SymptomState.Nothing;
            reasoningPlayPage.IsUserFinishedWithPage    = false;
            diagnosePlayPage.PatientDiagnosis           = DiagnosisState.Undiagnosed;
            summaryPlayPage.IsUserFinishedWithPage      = false;
        }
        // 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;
        }
        // Helper to set the enum for the true diagnosis for easier comparison
        private static void SetDiagnosisEnum()
        {
            string diagnosis = patient.Diagnosis;

            diagnosis = diagnosis.ToLower();

            if (diagnosis == "pneumonia")
            {
                TrueDiagnosis = DiagnosisState.Pneumonia;
            }
            else if (diagnosis == "copd")
            {
                TrueDiagnosis = DiagnosisState.COPD;
            }
            else if (diagnosis == "heart failure")
            {
                TrueDiagnosis = DiagnosisState.CHF;
            }

            return;
        }
        private String getDiagnosisString(DiagnosisState diagnosis)
        {
            switch (diagnosis)
            {
            case DiagnosisState.CHF:
            {
                return("CHF");
            }

            case DiagnosisState.COPD:
            {
                return("COPD");
            }

            case DiagnosisState.Pneumonia:
            {
                return("Pneumonia");
            }
            }

            return("Diagnosis");
        }
Example #7
0
 private void ChfButton_Click(object sender, EventArgs e)
 {
     PatientDiagnosis = DiagnosisState.CHF;
 }
Example #8
0
 private void CopdButton_Click(object sender, EventArgs e)
 {
     PatientDiagnosis = DiagnosisState.COPD;
 }
Example #9
0
 private void PneumoniaButton_Click(object sender, EventArgs e)
 {
     PatientDiagnosis = DiagnosisState.Pneumonia;
 }
Example #10
0
 private void BackButton_Click(object sender, EventArgs e)
 {
     PatientDiagnosis = DiagnosisState.Back;
 }
Example #11
0
        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;
        }