Пример #1
0
        public PauseState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content, State state)
            : base(game, graphicsDevice, content)
        {
            this.state = state;
            var buttonTexture = _content.Load <Texture2D>("Button");
            var buttonFont    = _content.Load <SpriteFont>("DebugFont");

            var resumeGameButton = new Controls.Button(buttonTexture, buttonFont)
            {
                ButtonInfo = ControlConstants.PAUSEMENU_RESUMEGAME,
            };

            resumeGameButton.Click += ResumeGameButton_Click;

            var quitGameButton = new Controls.Button(buttonTexture, buttonFont)
            {
                ButtonInfo = ControlConstants.PAUSEMENU_QUITGAME,
            };

            quitGameButton.Click += QuitGameButton_Click;

            _components = new List <Controls.Button>()
            {
                resumeGameButton,
                quitGameButton
            };
        }
        private void CreateAndPlaceElements(Texture2D mmButtonTexture, SpriteFont mmButtonFont)
        {
            // Create Button Objects
            Controls.Button playButton = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "Play"
            };
            Controls.Button shopButton = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "Shop"
            };
            Controls.Button customizeButton = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "Customize"
            };
            Controls.Button statsButton = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "Statistics"
            };

            // Assign event handlers for the buttons (so they actually do something)
            playButton.Click      += PlayButton_Click;
            shopButton.Click      += ShopButton_Click;
            customizeButton.Click += CustomizeButton_Click;
            statsButton.Click     += StatsButton_Click;

            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)
            _screen.Place(shopButton, 1, 1);
            _screen.Place(customizeButton, 1, 2);
            _screen.Place(statsButton, 3, 1);
            _screen.Place(playButton, 3, 2);
        }
Пример #3
0
        public void PlaceElementsExamGeneral(Texture2D buttonTexture, SpriteFont font)
        {
            Controls.Button continueButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Continue"
            };
            Controls.Textbox textTitle = new Controls.Textbox(font, "Results of General Exam");

            Controls.Textbox textTemp            = new Controls.Textbox(font, $"Temperature: {PatientData.GeneralExamData[0]}");
            Controls.Textbox textHeartRate       = new Controls.Textbox(font, $"Heart Rate: {PatientData.GeneralExamData[1]}");
            Controls.Textbox textRespiratoryRate = new Controls.Textbox(font, $"Respiratory Rate: {PatientData.GeneralExamData[2]}");
            Controls.Textbox textBloodPressure   = new Controls.Textbox(font, $"Blood Pressure: {PatientData.GeneralExamData[3]}");
            Controls.Textbox textObservations    = new Controls.Textbox(font, $"Observations: {PatientData.GeneralExamData[4]}");

            // Add event handler
            continueButton.Click += ContinueButton_Click;

            // Place elements
            _screen.Place(textTitle, 0, 0);
            _screen.Place(textTemp, 2, 0);
            _screen.Place(textHeartRate, 4, 0);
            _screen.Place(textRespiratoryRate, 6, 0);
            _screen.Place(textBloodPressure, 8, 0);
            _screen.Place(textObservations, 10, 0);
            _screen.Place(continueButton, 12, 1);
        }
        private void CreateAndPlaceElements(Texture2D mmButtonTexture, SpriteFont mmButtonFont)
        {
            // Create Button Objects
            Controls.Button backButton = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "Back"
            };
            Controls.Button addcorrectcopd = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "correctcopd"
            };
            Controls.Button addcorrectpneumonia = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "correctpneumonia"
            };
            Controls.Button addcorrectchf = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "correctcopd"
            };
            Controls.Button addincorrectcopd = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "incorrectcopd"
            };
            Controls.Button addincorrectpneumonia = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "incorrectpneumonia"
            };
            Controls.Button addincorrectchf = new Controls.Button(mmButtonTexture, mmButtonFont)
            {
                Text = "incorrectcopd"
            };

            Controls.Textbox displayCoins = new Controls.Textbox(mmButtonFont, $"my accuracy is: {_playerManager.Player.NumCoins}");

            _screen.Place(displayCoins, 0, 2);

            // Assign event handlers for the buttons (so they actually do something)
            backButton.Click            += BackButton_Click;
            addcorrectcopd.Click        += addcorrectcopd_Click;
            addcorrectpneumonia.Click   += addcorrectpneumonia_Click;
            addcorrectchf.Click         += addcorrectchf_Click;
            addincorrectcopd.Click      += addincorrectcopd_Click;
            addincorrectpneumonia.Click += addincorrectpneumonia_Click;
            addincorrectchf.Click       += addincorrectchf_Click;
            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)

            _screen.Place(backButton, 0, 0);
            _screen.Place(addcorrectcopd, 1, 0);
            _screen.Place(addcorrectchf, 1, 1);
            _screen.Place(addcorrectpneumonia, 1, 2);
            _screen.Place(addincorrectcopd, 2, 0);
            _screen.Place(addincorrectchf, 2, 1);
            _screen.Place(addincorrectpneumonia, 2, 2);
        }
Пример #5
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            Controls.Button btn = (Controls.Button)sender;
            bool            isDirectorySelected = Imaging.Capture.CaptureControlImageAndSave(DrawingCanvas);

            //turn button off after dialog closes.
            if (isDirectorySelected == true || isDirectorySelected == false)
            {
                btn.IsSelected = false;
            }
        }
Пример #6
0
        private void CreateAndPlaceElements(Texture2D mmButtonTexture)
        {
            // Create Button Objects
            Controls.Button backButton = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "Back"
            };
            Controls.Button titleButton = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "Customize"
            };
            Controls.Button instaButton = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "Click on an item to add to your avatar"
            };

            Controls.Button sprite1 = new Controls.Button(sprite, MmButtonFont);

            //Controls.Button monkey = new Controls.Button(images["monkey"].ComponentTexture, MmButtonFont);
            Controls.Button blackST = new Controls.Button(Images["blackST"].ComponentTexture, MmButtonFont);
            //Controls.Button silverST = new Controls.Button(images["silverST"].ComponentTexture, mmButtonFont);
            //Controls.Button goldST = new Controls.Button(images["goldST"].ComponentTexture, mmButtonFont);
            Controls.Button mask = new Controls.Button(Images["mask"].ComponentTexture, MmButtonFont);
            Controls.Button hat  = new Controls.Button(Images["hat"].ComponentTexture, MmButtonFont);



            // Assign event handlers for the buttons (so they actually do something)
            backButton.Click += BackButton_Click;

            blackST.Click += BlackST_Click;

            hat.Click += Hat_Click;

            mask.Click += Mask_Click;


            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)

            _screen.Place(backButton, 0, 0);
            _screen.Place(titleButton, 0, 1);

            _screen.Place(sprite1, 1, 0);

            _screen.Place(blackST, 2, 0);
            _screen.Place(mask, 2, 1);
            _screen.Place(hat, 2, 2);

            _screen.Place(instaButton, 3, 0);
        }
Пример #7
0
        private void CreateAndPlaceElements(Texture2D buttonTexture, SpriteFont font)
        {
            // Add elements
            #region CreateElements

            // Create Button Objects
            Controls.Button backButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Back"
            };
            Controls.Button pneumoniaButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Pneumonia"
            };
            Controls.Button copdButton = new Controls.Button(buttonTexture, font)
            {
                Text = "COPD"
            };
            Controls.Button chfButton = new Controls.Button(buttonTexture, font)
            {
                Text = "CHF"
            };


            // Text describing what to do
            Controls.Textbox instructionText = new Controls.Textbox(font, "Diagnose the underlying cause of the patient's Acute Respiratory Failure");

            #endregion

            // Assign event handlers for the buttons (so they actually do something)
            #region AssignEventHandlers
            chfButton.Click       += ChfButton_Click;
            copdButton.Click      += CopdButton_Click;
            pneumoniaButton.Click += PneumoniaButton_Click;
            backButton.Click      += BackButton_Click;

            #endregion

            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)
            #region PlaceElements

            _screen.Place(backButton, 0, 0);
            _screen.Place(instructionText, 2, 0);
            _screen.Place(chfButton, 4, 1);
            _screen.Place(copdButton, 6, 1);
            _screen.Place(pneumoniaButton, 8, 1);

            #endregion
        }
Пример #8
0
        public void PlaceElementsExamImaging(Texture2D buttonTexture, SpriteFont font)
        {
            Controls.Textbox titleText  = new Controls.Textbox(font, "Imaging Results");
            Controls.Button  okayButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Okay"
            };
            Controls.Textbox infoText = new Controls.Textbox(font, "At the time of the alpha release, no imaging results are available. Stay tuned for imaging results in the Beta release.");

            okayButton.Click += OkayButton_Click;

            _screen.Place(titleText, 0, 0);
            _screen.Place(infoText, 2, 0);
            _screen.Place(okayButton, 4, 1);
        }
Пример #9
0
        public void PlaceElementsExamAbdomen(Texture2D buttonTexture, SpriteFont font)
        {
            Controls.Textbox textTitle   = new Controls.Textbox(font, "Results from Abdomen Exam");
            Controls.Textbox examResults = new Controls.Textbox(font, $"Observations: {PatientData.AbdomenData}");

            Controls.Button continueButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Continue"
            };

            continueButton.Click += ContinueButton_Click;

            _screen.Place(textTitle, 0, 0);
            _screen.Place(examResults, 2, 0);
            _screen.Place(continueButton, 4, 1);
        }
        private void CreateAndPlaceElements(Texture2D spriteTexture, Texture2D buttonTexture, SpriteFont font)
        {
            // Add elements
            #region CreateElements

            // Create Button Objects
            Controls.Button backButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Main Menu"
            };
            Controls.Button diagnoseButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Diagnose Patient"
            };
            Controls.Button investigateButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Investigate Symptom"
            };

            // Patient sprite
            Controls.Sprite patientSprite = new Controls.Sprite(spriteTexture);

            // Text describing what to do
            Controls.Textbox instructionText = new Controls.Textbox(font, "Diagnose the patient's cause of ARF or select a symptom to investigate");

            #endregion

            // Assign event handlers for the buttons (so they actually do something)
            #region AssignEventHandlers

            backButton.Click        += BackButton_Click;
            diagnoseButton.Click    += DiagnoseButton_Click;
            investigateButton.Click += InvestigateButton_Click;

            #endregion

            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)
            #region PlaceElements

            _screen.Place(backButton, 0, 1);
            _screen.Place(patientSprite, 2, 1);
            _screen.Place(instructionText, 4, 0);
            _screen.Place(diagnoseButton, 5, 1);
            _screen.Place(investigateButton, 5, 3);

            #endregion
        }
Пример #11
0
        public void PlaceElementsExamOxygen(Texture2D buttonTexture, SpriteFont font)
        {
            Controls.Button continueButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Continue"
            };
            Controls.Textbox textTitle = new Controls.Textbox(font, "Review of Oxygen Information");

            Controls.Textbox dataValue1 = new Controls.Textbox(font, $"Oxygen Saturation: {PatientData.OxygenData[0]}");
            Controls.Textbox dataValue2 = new Controls.Textbox(font, $"Amount of Oxygen Given: {PatientData.OxygenData[1]}");

            // Add event handler
            continueButton.Click += ContinueButton_Click;

            // Place elements
            _screen.Place(textTitle, 0, 0);
            _screen.Place(dataValue1, 2, 0);
            _screen.Place(dataValue1, 4, 0);
            _screen.Place(continueButton, 6, 1);
        }
Пример #12
0
        public MenuState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content)
            : base(game, graphicsDevice, content)
        {
            var buttonTexture = _content.Load <Texture2D>("Button");
            var buttonFont    = _content.Load <SpriteFont>("DebugFont");

            var newGameButton = new Controls.Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(300, 200),
                Text     = "New Game",
            };

            newGameButton.Click += NewGameButton_Click;

            var loadGameButton = new Controls.Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(300, 250),
                Text     = "Load Game",
            };

            loadGameButton.Click += LoadGameButton_Click;

            var quitGameButton = new Controls.Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(300, 300),
                Text     = "Quit Game",
            };

            quitGameButton.Click += QuitGameButton_Click;

            _components = new List <Controls.Button>()
            {
                newGameButton,
                loadGameButton,
                quitGameButton,
            };
        }
Пример #13
0
        public GameScene(SceneManager manager)
            : base(manager)
        {
            //Test:
            this.Background = SpriteBank.GetSprite(@"Images\Controls\Background_Forest");

            this.moveTimer = new Counter.Timer(this.Game, 20);
            this.state = GameSceneState.MoveIn;
            this.moveTimer.OnMeet += new Counter.EventOnCounterMeet(this.MoveIn);
            this.moveTimer.Start();

            this.playButton = new Controls.Button(this.Game, SpriteBank.GetSprite(@"Images\Controls\Ready"), SpriteBank.GetSprite(@"Images\Controls\ReadyOver"), Vector2.Zero);
            this.playButton.Position = new Vector2(-315f, 220f);
            this.playButton.Clicked += new EventHandler(this.PlayButtonOnClick);

            this.Grid = new Griding.Griding(this.Game, new Rectangle(0, 60, 760, 380), 5, 9);
            this.PlantManager = new Plants_Bullets.Plant.PlantManager(this.Game, this.Grid);
            this.GrowManager = new Hospital.Hospital_GrowManager(this.PlantManager);
            this.PlantManager.GetSunManager.OnSunChanged += new SunManager.OnSunChangedProc(this.GrowManager.OnSunChanged);
            this.PlantManager.GetSunManager.NumberOfSuns = 100;

            this.ZombiesManager = new Zombies.Managers.ZombiesManager(this.Grid);
            this.ZombiesManager.Generator = new Hospital.Hospital_ZombiesGenerator(this.ZombiesManager);
        }
Пример #14
0
        /// <summary>
        /// Loads graphics content for this screen. 
        /// </summary>
        public override void LoadContent()
        {
            if(_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            var fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            var button_off_bg = _content.Load<Texture2D>("button_off");
            var button_on_bg = _content.Load<Texture2D>("button_on");
            var list_bg = _content.Load<Texture2D>("list");
            int width = button_off_bg.Width / 2;
            int height = button_off_bg.Height / 2;
            int topleftX = fullscreen.Center.X - list_bg.Width / 2;
            int topleftY = 16;

            var lstHighscores = new Controls.List(list_bg, new Vector2(topleftX, topleftY), "TOP 12");
            lstHighscores.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(lstHighscores);

            var btnBack = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX + button_off_bg.Width / 4,
                                            topleftY + list_bg.Height + 10),
                                          "BACK TO MAIN MENU");
            btnBack.Clicked += (sender, args) =>
            {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new MainMenu(), ControllingPlayer);
            };
            btnBack.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnBack);
        }
Пример #15
0
 private void Mask_Click(object sender, EventArgs e)
 {
     Controls.Button layover_mask = new Controls.Button(Images["layovermask"].ComponentTexture, MmButtonFont);
     _screen.Place(layover_mask, 1, 0);
 }
Пример #16
0
        /// <summary>
        /// Loads graphics content for this screen. 
        /// </summary>
        public override void LoadContent()
        {
            if(_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            var fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            var button_off_bg = _content.Load<Texture2D>("button_off");
            var button_on_bg = _content.Load<Texture2D>("button_on");
            int width = button_off_bg.Width / 2;
            int height = button_off_bg.Height / 2;
            int shift = height * 2 + 10;
            var blank = _content.Load<Texture2D>("blank");
            int topleftX = fullscreen.Center.X - width;
            int topleftY = fullscreen.Center.Y - 100 - height;

            var btn1 = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY),
                                          "NEW GAME");
            btn1.Clicked += (sender, args) => {
                Pilot pilot = new Pilot();
                pilot.Init(10.0, 10.0, 172, 54);
                Ship ship = new Ship(172, 54);
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new ShopScreen(pilot), ControllingPlayer);
            };
            btn1.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btn1);

            var btn2 = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift),
                                          "BACK TO MAIN MENU");
            btn2.Clicked += (sender, args) => {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new MainMenu(), ControllingPlayer);
            };
            btn2.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btn2);
        }
Пример #17
0
 private void BlackST_Click(object sender, EventArgs e)
 {
     Controls.Button layover_blackST = new Controls.Button(Images["layoverBST"].ComponentTexture, MmButtonFont);
     _screen.Place(layover_blackST, 1, 0);
 }
Пример #18
0
 private void Hat_Click(object sender, EventArgs e)
 {
     Controls.Button layover_hat = new Controls.Button(Images["hat"].ComponentTexture, MmButtonFont);
     _screen.Place(layover_hat, 1, 0);
 }
Пример #19
0
        /// <summary>
        /// Loads graphics content for this screen. 
        /// </summary>
        public override void LoadContent()
        {
            if (_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            var fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            var texture_button_off = _content.Load<Texture2D>("button_off");
            var texture_button_on = _content.Load<Texture2D>("button_on");
            var texture_bg = _content.Load<Texture2D>("list");
            var texture_plus_off = _content.Load<Texture2D>("plus_off");
            var texture_plus_on = _content.Load<Texture2D>("plus_on");
            var texture_minus_off = _content.Load<Texture2D>("minus_off");
            var texture_minus_on = _content.Load<Texture2D>("minus_on");
            var font = _content.Load<SpriteFont>("menufont");
            var hintFont = _content.Load<SpriteFont>("hintfont1");

            int width = texture_button_off.Width / 2;
            int height = texture_button_off.Height / 2;
            int shift = height * 2 + 10;
            int topleftX = fullscreen.Center.X - width;
            int topleftY = fullscreen.Center.Y - 100 - height;

            // Control to update player.
            var shopPlayer = new Controls.ShopPlayer(
                texture_bg,
                texture_plus_off,
                texture_plus_on,
                texture_minus_off,
                texture_minus_on,
                font,
                hintFont,
                new Vector2(fullscreen.Left - 20 + fullscreen.Width / 2 - texture_bg.Width, fullscreen.Top + 20),
                "PLAYER STATS",
                _pilot);
            _controls.Add(shopPlayer);

            // Control to buy modules.
            var shopModule = new Controls.ShopModules(
                texture_bg,
                texture_plus_off,
                texture_plus_on,
                font,
                hintFont,
                new Vector2(fullscreen.Left + 20 + fullscreen.Width / 2, fullscreen.Top + 20),
                "MODULES",
                _pilot);
            _controls.Add(shopModule);

            // Button to start the next map.
            var btnStart = new Controls.Button(
                texture_button_on,
                texture_button_off,
                new Vector2(
                    shopModule.Position.X + texture_bg.Width - texture_button_off.Width,
                    shopModule.Position.Y + texture_bg.Height + 20),
                "START GAME");
            btnStart.Clicked += (sender, args) =>
            {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new GameScreen(_pilot), ControllingPlayer);
            };
            btnStart.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnStart);

            // Button to quit to the main menu.
            var btnBack = new Controls.Button(
                texture_button_on,
                texture_button_off,
                new Vector2(shopPlayer.Position.X, shopPlayer.Position.Y + texture_bg.Height + 20),
                "BACK TO MAIN MENU");
            btnBack.Clicked += (sender, args) =>
            {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new MainMenu(), ControllingPlayer);
            };
            btnBack.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnBack);
        }
Пример #20
0
        public void PlaceElementsExamBloodwork(Texture2D buttonTexture, SpriteFont font)
        {
            Controls.Textbox titleText      = new Controls.Textbox(font, "Bloodwork Results");
            Controls.Button  continueButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Continue"
            };

            // Add event handler
            continueButton.Click += ContinueButton_Click;

            //Place title Text and button
            _screen.Place(titleText, 0, 0);
            _screen.Place(continueButton, 17, 1);

            #region PlacingDataInfo

            List <String> dataValueTitles = new List <String>();
            #region DefiningPossibleValues

            dataValueTitles.Add("White blood cells");
            dataValueTitles.Add("Hemoglobin");
            dataValueTitles.Add("Hematocrit");
            dataValueTitles.Add("Platelets");
            dataValueTitles.Add("Sodium");
            dataValueTitles.Add("Potassium");
            dataValueTitles.Add("Chloride");
            dataValueTitles.Add("Bicarbonate");
            dataValueTitles.Add("BUN");
            dataValueTitles.Add("Creatinine");
            dataValueTitles.Add("Glucose");
            dataValueTitles.Add("BNP");
            dataValueTitles.Add("ABG - pH");
            dataValueTitles.Add("ABG - pcO2");
            dataValueTitles.Add("ABG - pO2");
            dataValueTitles.Add("Lactate");

            #endregion

            int numberBloodworkValues = dataValueTitles.Count;



            int rowIndex = 2;
            int colIndex = 1;
            for (int i = 0; i < numberBloodworkValues; ++i)
            {
                _screen.Place((new Controls.Textbox(font, $"{dataValueTitles[i]}: {PatientData.BloodworkData[i]}")), rowIndex, colIndex);

                // Every other iteration, increase row value
                // Every iteration, swap between column index 1 and 3
                if (i % 2 == 1)
                {
                    rowIndex += 2;
                    colIndex  = 1;
                }
                else
                {
                    colIndex = 3;
                }
            }

            #endregion
        }
        private void CreateAndPlaceElements(Texture2D buttonTexture, SpriteFont font)
        {
            #region CreateElements
            Controls.Button finishButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Finish"
            };

            Controls.Textbox summaryTitle          = new Controls.Textbox(font, "Summary of Diagnostic Process");
            Controls.Textbox reasoningTitle        = new Controls.Textbox(font, "Reasoning Steps");
            Controls.Textbox correctDiagnosisTitle = new Controls.Textbox(font, "Correct Dignosis");
            Controls.Textbox userDiagnosisTitle    = new Controls.Textbox(font, "User Diagnosis");

            Controls.Textbox correctTitle   = new Controls.Textbox(font, "Correct");
            Controls.Textbox incorrectTitle = new Controls.Textbox(font, "Incorrect");

            Controls.Textbox userDiagnosisText    = new Controls.Textbox(font, getDiagnosisString(PlayerDiagnosis));
            Controls.Textbox correctDiagnosisText = new Controls.Textbox(font, getDiagnosisString(CorrectDiagnosis));

            Controls.Textbox coinAwarded = new Controls.Textbox(font, $"Coins Awarded: {_amountCoinsAwarded}");
            Controls.Textbox expAwarded  = new Controls.Textbox(font, $"Experience Awarded: {_amountExpAwarded}");


            #region CreatingReasoningElements

            List <Controls.Textbox> correctReasoningChoices = new List <Controls.Textbox>();
            List <Controls.Textbox> userReasoningChoices    = new List <Controls.Textbox>();

            // Create Textbox UI elements using reasoning choices
            int remainingReasoningSlots = 5;
            foreach (KeyValuePair <SymptomState, String> kvp in UserReasoning)
            {
                // Currently, only 5 reasoning slots can be shown (need to make a UI element with scrolling)
                if (remainingReasoningSlots == 0)
                {
                    break;
                }

                // Create textbox UI elements based upon reasoning choices selected by user
                // This assumes that for every symptom where reasoning is selected by the user,
                // the corresponding correct reasoning is added properly
                userReasoningChoices.Add(new Controls.Textbox(font, kvp.Value));
                correctReasoningChoices.Add(new Controls.Textbox(font, CorrectReasoning[kvp.Key]));

                // Decrement by one to indicate one less remaining slot
                remainingReasoningSlots -= 1;
            }
            #endregion

            #endregion


            // Add event handler for finish button
            finishButton.Click += FinishButton_Click;


            #region PlaceElements

            // Titles
            _screen.Place(summaryTitle, 0, 0);
            _screen.Place(reasoningTitle, 4, 1);
            _screen.Place(correctTitle, 5, 1);
            _screen.Place(incorrectTitle, 5, 3);
            _screen.Place(correctDiagnosisTitle, 1, 1);
            _screen.Place(userDiagnosisTitle, 1, 3);
            _screen.Place(userDiagnosisText, 2, 1);
            _screen.Place(correctDiagnosisText, 2, 3);


            // Button
            _screen.Place(finishButton, 12, 1);

            // Exp and coin values
            _screen.Place(coinAwarded, 11, 0);
            _screen.Place(expAwarded, 11, 1);

            #region AddReasoningElements
            int sizeOfLists = userReasoningChoices.Count;
            for (int i = 0; i < sizeOfLists; ++i)
            {
                // The rows where reasoning is placed are [5-9]
                int rowValue = i + 6;
                _screen.Place(correctReasoningChoices[i], rowValue, 1);
                _screen.Place(userReasoningChoices[i], rowValue, 3);
            }

            #endregion

            #endregion
        }
Пример #22
0
        private void CreateAndPlaceElements(Texture2D texture, SpriteFont font)
        {
            #region DefiningElements

            Textbox title = new Textbox(font, "Initial Patient Information");

            // Information being displayed to user
            Textbox age    = new Textbox(font, $"Age: {Age}");
            Textbox gender = new Textbox(font, $"Gender: {Gender}");

            Textbox pastMedicalHistoryTitle = new Textbox(font, "Past Medical History");
            Textbox pastMedicalHistory1     = new Textbox(font, PastMedicalHistory1);
            Textbox pastMedicalHistory2     = new Textbox(font, PastMedicalHistory2);
            Textbox pastMedicalHistory3     = new Textbox(font, PastMedicalHistory3);
            Textbox tobaccoUse = new Textbox(font, $"Tobacco use: {TobaccoUse}");

            Textbox symptomTitle       = new Textbox(font, "Symptom Information");
            Textbox symptomOnset       = new Textbox(font, SymptomOnset);
            Textbox symptomDuration    = new Textbox(font, SymptomDuration);
            Textbox symptomDescription = new Textbox(font, SymptomDescription);
            Textbox symptomSeverity    = new Textbox(font, SymptomSeverity);

            Textbox provocatingFactors = new Textbox(font, ProvocatingFactors);
            Textbox relievingFactors   = new Textbox(font, RelievingFactors);

            // Button to advance to core gameplay loop
            Controls.Button continueButton = new Controls.Button(texture, font)
            {
                Text = "Continue"
            };

            #endregion

            // Event handler for button
            continueButton.Click += ContinueButton_Click;


            // Placing all components on screen
            #region PlacingElements

            _screen.Place(title, 0, 0);

            _screen.Place(age, 2, 0);
            _screen.Place(gender, 3, 0);

            _screen.Place(pastMedicalHistoryTitle, 5, 0);
            _screen.Place(pastMedicalHistory1, 6, 1);
            _screen.Place(pastMedicalHistory2, 7, 1);
            _screen.Place(pastMedicalHistory3, 8, 1);
            _screen.Place(tobaccoUse, 9, 1);

            _screen.Place(symptomTitle, 11, 0);
            _screen.Place(symptomDescription, 12, 1);
            _screen.Place(symptomSeverity, 13, 1);
            _screen.Place(provocatingFactors, 14, 1);
            _screen.Place(relievingFactors, 15, 1);
            _screen.Place(symptomOnset, 16, 1);
            _screen.Place(symptomDuration, 17, 1);

            _screen.Place(continueButton, 19, 1);

            #endregion

            return;
        }
Пример #23
0
        /// <summary>
        /// Loads graphics content for this screen. 
        /// </summary>
        public override void LoadContent()
        {
            if(_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            var fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            var button_off_bg = _content.Load<Texture2D>("button_off");
            var button_on_bg = _content.Load<Texture2D>("button_on");

            int width = button_off_bg.Width / 2;
            int height = button_off_bg.Height / 2;
            int shift = height * 2 + 10;
            int topleftX = fullscreen.Center.X - width;
            int topleftY = fullscreen.Center.Y - 100 - height;

            // Adding the GAME MENU button to the main menu.
            var btnGameMenu = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY),
                                          "GAME MENU");
            btnGameMenu.Clicked += (sender, args) =>
            {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new GameMenu(), ControllingPlayer);
            };
            btnGameMenu.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnGameMenu);

            // Adding the TOGGLE FULLSCREEN button to the main menu.
            var btnFullscreen = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift),
                                          "TOGGLE FULLSCREEN");
            btnFullscreen.Clicked += (sender, args) =>
            {
                ((MainWindow)ScreenManager.Game).ToggleFullscreen();
            };
            btnFullscreen.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnFullscreen);

            // Adding the OPTIONS button to the main menu.
            var btnOptions = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift * 2),
                                          "OPTIONS");
            btnOptions.Clicked += (sender, args) =>
            {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new OptionsScreen(), ControllingPlayer);
            };
            btnOptions.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnOptions);

            // Adding the HIGHSCORES button to the main menu.
            var btnHighscores = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift * 3),
                                          "HIGHSCORES");
            btnHighscores.Clicked += (sender, args) =>
            {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new HighscoreScreen(), ControllingPlayer);
            };
            btnHighscores.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnHighscores);

            // Adding the EXIT button to the main menu.
            var btnExit = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift * 4),
                                          "EXIT");
            btnExit.Clicked += (sender, args) =>
            {
                ScreenManager.Game.Exit();
            };
            btnExit.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnExit);
        }
Пример #24
0
        /// <summary>
        /// Loads graphics content for this screen. 
        /// </summary>
        public override void LoadContent()
        {
            if(_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            var fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            var button_off_bg = _content.Load<Texture2D>("button_off");
            var button_on_bg = _content.Load<Texture2D>("button_on");
            int width = button_off_bg.Width / 2;
            int height = button_off_bg.Height / 2;
            int shift = height * 2 + 10;
            int topleftX = fullscreen.Center.X - width;
            int topleftY = fullscreen.Center.Y - 100 - height;

            var btnTitle = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY - shift),
                                          "ENTER NAME!");
            btnTitle.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnTitle);

            txtName = new Controls.TextBox(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY),
                                            Text);
            txtName.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(txtName);

            var btnSave = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift),
                                          "OK");
            btnSave.Clicked += (sender, args) =>
            {
                if (_fm.IsNewRecord(Score))
                {
                    if (txtName.Text.Trim() != String.Empty)
                        _fm.SaveHighscoreList(txtName.Text, Score);
                    else
                        _fm.SaveHighscoreList("Anonymous", Score);
                }

                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new HighscoreScreen(), ControllingPlayer);
            };
            btnSave.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btnSave);
        }
Пример #25
0
        private void CreateAndPlaceElements(Texture2D mmButtonTexture)
        {
            // Create Button Objects
            Controls.Button backButton = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "Back"
            };
            Controls.Button shopButton = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "Shop"
            };
            Controls.Button InstrButton = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "Click on price to buy an item!"
            };


            Controls.Button blackSTprice = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "$" + Images["blackST"].Price.ToString()
            };
            Controls.Button silverSTprice = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "LOCKED!!"
            };
            //TODO how to unlock - show that to user
            Controls.Button goldSTprice = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "LOCKED!!"
            };
            Controls.Button maskprice = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "$" + Images["mask"].Price.ToString()
            };
            Controls.Button hatprice = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "$" + Images["hat"].Price.ToString()
            };
            Controls.Button monkeyprice = new Controls.Button(mmButtonTexture, MmButtonFont)
            {
                Text = "$" + Images["monkey"].Price.ToString()
            };
            //

            Controls.Button monkey   = new Controls.Button(Images["monkey"].ComponentTexture, MmButtonFont);
            Controls.Button blackST  = new Controls.Button(Images["blackST"].ComponentTexture, MmButtonFont);
            Controls.Button silverST = new Controls.Button(Images["silverST"].ComponentTexture, MmButtonFont);
            Controls.Button goldST   = new Controls.Button(Images["goldST"].ComponentTexture, MmButtonFont);
            Controls.Button mask     = new Controls.Button(Images["mask"].ComponentTexture, MmButtonFont);
            Controls.Button hat      = new Controls.Button(Images["hat"].ComponentTexture, MmButtonFont);
            // Assign event handlers for the buttons (so they actually do something)
            backButton.Click += BackButton_Click;

            blackSTprice.Click  += BlackSTprice_Click;
            silverSTprice.Click += SilverSTprice_Click;
            goldSTprice.Click   += GoldSTprice_Click;
            maskprice.Click     += Maskprice_Click;
            hatprice.Click      += Hatprice_Click;
            monkeyprice.Click   += Monkeyprice_Click;



            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)

            _screen.Place(backButton, 0, 0);
            _screen.Place(shopButton, 0, 1);
            _screen.Place(blackST, 1, 0);
            _screen.Place(silverST, 1, 1);
            _screen.Place(goldST, 1, 2);

            _screen.Place(blackSTprice, 2, 0);
            _screen.Place(silverSTprice, 2, 1);
            _screen.Place(goldSTprice, 2, 2);

            _screen.Place(mask, 3, 0);
            _screen.Place(hat, 3, 1);
            _screen.Place(monkey, 3, 2);

            _screen.Place(maskprice, 4, 0);
            _screen.Place(hatprice, 4, 1);
            _screen.Place(monkeyprice, 4, 2);

            _screen.Place(InstrButton, 5, 0);
        }
        private void CreateAndPlaceElements(Texture2D buttonTexture, SpriteFont font)
        {
            // Add elements
            #region CreateElements

            // Create Button Objects
            Controls.Button backButton = new Controls.Button(buttonTexture, font)
            {
                Text = "Back"
            };
            Controls.Button examGeneral = new Controls.Button(buttonTexture, font)
            {
                Text = "Perform General Examination"
            };
            Controls.Button examHead = new Controls.Button(buttonTexture, font)
            {
                Text = "Examine Head"
            };
            Controls.Button examNeck = new Controls.Button(buttonTexture, font)
            {
                Text = "Examine Neck"
            };
            Controls.Button examLungs = new Controls.Button(buttonTexture, font)
            {
                Text = "Examine Lungs"
            };
            Controls.Button examExtremities = new Controls.Button(buttonTexture, font)
            {
                Text = "Examine Extremities"
            };
            Controls.Button examSkin = new Controls.Button(buttonTexture, font)
            {
                Text = "Examine Skin"
            };
            Controls.Button examAbdomen = new Controls.Button(buttonTexture, font)
            {
                Text = "Examine Abdomen"
            };
            Controls.Button examOxygen = new Controls.Button(buttonTexture, font)
            {
                Text = "Review Oxygen Information"
            };
            Controls.Button examBloodwork = new Controls.Button(buttonTexture, font)
            {
                Text = "Request Bloodwork"
            };
            Controls.Button examImaging = new Controls.Button(buttonTexture, font)
            {
                Text = "Request Imaging"
            };


            // Text describing what to do
            Controls.Textbox instructionText = new Controls.Textbox(font, "Select an action to further investigate the patient's condition");

            #endregion

            // Assign event handlers for the buttons (so they actually do something)
            #region AssignEventHandlers

            backButton.Click      += BackButton_Click;
            examGeneral.Click     += ExamGeneral_Click;
            examHead.Click        += ExamHead_Click;
            examNeck.Click        += ExamNeck_Click;
            examLungs.Click       += ExamLungs_Click;
            examExtremities.Click += ExamExtremities_Click;
            examSkin.Click        += ExamSkin_Click;
            examAbdomen.Click     += ExamAbdomen_Click;
            examOxygen.Click      += ExamOxygen_Click;
            examBloodwork.Click   += ExamBloodwork_Click;
            examImaging.Click     += ExamImaging_Click;

            #endregion

            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)
            #region PlaceElements

            _screen.Place(backButton, 0, 0);
            _screen.Place(instructionText, 2, 0);

            _screen.Place(examGeneral, 4, 1);
            _screen.Place(examHead, 6, 1);
            _screen.Place(examNeck, 8, 1);
            _screen.Place(examLungs, 10, 1);
            _screen.Place(examExtremities, 12, 1);
            _screen.Place(examSkin, 14, 1);
            _screen.Place(examAbdomen, 16, 1);
            _screen.Place(examOxygen, 18, 1);
            _screen.Place(examBloodwork, 20, 1);
            _screen.Place(examImaging, 22, 1);

            #endregion
        }
Пример #27
0
        private void CreateAndPlaceElements(Texture2D buttonTexture, SpriteFont font)
        {
            // Add elements
            #region CreateElements

            // Create Button Objects
            Controls.Button reasoningButtonCorrect = new Controls.Button(buttonTexture, font)
            {
                Text = ReasoningChoices[ReasoningState.Correct]
            };

            List <Controls.Button> incorrectButtons = new List <Controls.Button>();
            incorrectButtons.Add(new Controls.Button(buttonTexture, font)
            {
                Text = ReasoningChoices[ReasoningState.Incorrect1]
            });
            incorrectButtons.Add(new Controls.Button(buttonTexture, font)
            {
                Text = ReasoningChoices[ReasoningState.Incorrect2]
            });
            incorrectButtons.Add(new Controls.Button(buttonTexture, font)
            {
                Text = ReasoningChoices[ReasoningState.Incorrect3]
            });


            // Text describing what to do
            Controls.Textbox instructionText = new Controls.Textbox(font, "Please select the correct conclusion from the symptom information");

            #endregion

            // Assign event handlers for the buttons (so they actually do something)
            #region AssignEventHandlers
            reasoningButtonCorrect.Click += ReasoningButtonCorrect_Click;
            incorrectButtons[0].Click    += ReasoningButtonIncorrect1_Click;
            incorrectButtons[1].Click    += ReasoningButtonIncorrect2_Click;
            incorrectButtons[2].Click    += ReasoningButtonIncorrect3_Click;

            #endregion

            // Place button objects (row and col indices gotten from DesignScreenLayout() function above)
            #region PlaceElements
            _screen.Place(instructionText, 0, 0);

            // Randomly assign correctButton's position
            Random rnd             = new Random();
            int    correctRowIndex = rnd.Next(1, 5);

            _screen.Place(reasoningButtonCorrect, correctRowIndex * 2, 1);

            // Determine what indices remain for the other three buttons
            List <int> incorrectRowIndices = new List <int>();
            for (int i = 1; i < 5; ++i)
            {
                if (i != correctRowIndex)
                {
                    incorrectRowIndices.Add(i * 2);
                }
            }

            // Add incorrect buttons at the remaining indices
            for (int i = 0; i < 3; ++i)
            {
                _screen.Place(incorrectButtons[i], incorrectRowIndices[i], 1);
            }



            #endregion
        }