/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { InputManager.Update(); base.Update(gameTime); }
/// <summary> /// Handle user input. /// </summary> public override void HandleInput() { bool stayClicked = false; bool leaveClicked = false; if (InputManager.IsButtonClicked(new Rectangle((int)stayPosition.X, (int)stayPosition.Y, 120, 40))) { int partyCharge = GetChargeForParty(Session.Party); if (Session.Party.PartyGold >= partyCharge) { AudioManager.PlayCue("Money"); Session.Party.PartyGold -= partyCharge; selectionMark = 2; ChangeDialogue(serviceRenderedMessage); HealParty(Session.Party); } else { selectionMark = 2; ChangeDialogue(noGoldMessage); } } if (InputManager.IsButtonClicked(new Rectangle((int)leavePosition.X, (int)leavePosition.Y, 120, 40))) { ExitScreen(); } // exit the screen if (InputManager.IsActionTriggered(InputManager.Action.Back)) { ExitScreen(); return; } // move the cursor up else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp) || stayClicked) { if (selectionMark == 2) { selectionMark = 1; } } // move the cursor down else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown) || leaveClicked) { if (selectionMark == 1) { selectionMark = 2; } } // select an option else if (InputManager.IsActionTriggered(InputManager.Action.Ok)) { if (selectionMark == 1) { int partyCharge = GetChargeForParty(Session.Party); if (Session.Party.PartyGold >= partyCharge) { AudioManager.PlayCue("Money"); Session.Party.PartyGold -= partyCharge; selectionMark = 2; ChangeDialogue(serviceRenderedMessage); HealParty(Session.Party); } else { selectionMark = 2; ChangeDialogue(noGoldMessage); } } else { ExitScreen(); return; } } }