Esempio n. 1
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput()
        {
            int oldSelectedEntry = selectedEntry;

            foreach (MenuEntry entry in MenuEntries)
            {
                Rectangle entryRecg = new Rectangle((int)entry.Position.X, (int)entry.Position.Y,
                                                    entry.Texture.Width, entry.Texture.Height);

                if (InputManager.IsButtonClicked(entryRecg))
                {
                    entry.OnSelectEntry();
                    return;
                }
            }

            if (InputManager.IsActionTriggered(InputManager.Action.Back) ||
                InputManager.IsActionTriggered(InputManager.Action.ExitGame))
            {
                OnCancel();
            }
            else if (selectedEntry != oldSelectedEntry)
            {
                AudioManager.PlayCue("MenuMove");
            }
        }
 /// <summary>
 /// Handles user input.
 /// </summary>
 public override void HandleInput()
 {
     // exit the screen
     if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
         InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
         // give the rewards to the party
         Session.Party.PartyGold += goldReward;
         foreach (Gear gear in gearReward)
         {
             Session.Party.AddToInventory(gear, 1);
         }
         Session.Party.GiveExperience(experienceReward);
     }
     // Scroll up
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
     {
         if (startIndex > 0)
         {
             startIndex--;
             endIndex--;
         }
     }
     // Scroll down
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
     {
         if (startIndex < gearReward.Count - maxLines)
         {
             endIndex++;
             startIndex++;
         }
     }
 }
 /// <summary>
 /// Handles user input.
 /// </summary>
 public override void HandleInput()
 {
     // exits the screen
     if (InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
         return;
     }
     // scroll down
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
     {
         // Traverse down the help text
         if (startIndex + maxLineDisplay < textLines.Count)
         {
             startIndex += 1;
         }
     }
     // scroll up
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
     {
         // Traverse up the help text
         if (startIndex > 0)
         {
             startIndex -= 1;
         }
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Handles user input.
 /// </summary>
 public override void HandleInput()
 {
     // exit the screen
     if (InputManager.IsActionTriggered(InputManager.Action.Back) ||
         InputManager.IsActionTriggered(InputManager.Action.Ok))
     {
         ExitScreen();
         return;
     }
     // scroll up
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
     {
         if (startIndex > 0)
         {
             startIndex--;
             endIndex--;
         }
     }
     // scroll Down
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
     {
         if (endIndex < currentDialogue.Count)
         {
             startIndex++;
             endIndex++;
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool resumeClicked = false;

            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)(backPosition.X),
                                                 (int)(backPosition.Y),
                                                 (int)(backTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(backTexture.Height * ScaledVector2.DrawFactor))))
            {
                resumeClicked = true;
            }


            if (InputManager.IsActionTriggered(InputManager.Action.Back) || resumeClicked &&
                Session.IsActive)
            {
                Session.MapCache.Clear();
                AudioManager.PopMusic();
                ExitScreen();
                return;
            }

            base.HandleInput();
        }
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput()
        {
            if (InputManager.IsActionTriggered(InputManager.Action.MainMenu))
            {
                ScreenManager.AddScreen(new MainMenuScreen());
                return;
            }

            if (InputManager.IsActionTriggered(InputManager.Action.ExitGame))
            {
                // add a confirmation message box
                const string message =
                    "Are you sure you want to exit?  All unsaved progress will be lost.";
                MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);
                confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
                ScreenManager.AddScreen(confirmExitMessageBox);
                return;
            }

            if (!CombatEngine.IsActive &&
                InputManager.IsActionTriggered(InputManager.Action.CharacterManagement))
            {
                ScreenManager.AddScreen(new StatisticsScreen(Session.Party.Players[0]));
                return;
            }
        }
        /// <summary>
        /// Handles user input to the dialog.
        /// </summary>
        public override void HandleInput()
        {
            // Press Select or Bback
            if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
                InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                ExitScreen();
                return;
            }

            // Scroll up
            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
            {
                if (startIndex > 0)
                {
                    startIndex--;
                    endIndex--;
                }
            }
            // Scroll down
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
            {
                if (startIndex < dialogueList.Count - drawMaxLines)
                {
                    endIndex++;
                    startIndex++;
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool okClicked   = false;
            bool backclicked = false;

            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)selectButtonPosition.X, (int)selectButtonPosition.Y,
                                                 selectButtonTexture.Width, selectButtonTexture.Height)))
            {
                okClicked = true;
            }

            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)backButtonPosition.X, (int)backButtonPosition.Y,
                                                 backButtonTexture.Width, backButtonTexture.Height)))
            {
                backclicked = true;
            }

            // view the player's statistics
            if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
            {
                ScreenManager.AddScreen(new StatisticsScreen(character as Player));
                return;
            }

            if (isIntroduction)
            {
                // accept the invitation
                if (okClicked)
                {
                    isIntroduction = false;
                    Player player = character as Player;
                    Session.Party.JoinParty(player);
                    Session.RemovePlayerNpc(mapEntry);
                    this.DialogueText = player.JoinAcceptedDialogue;
                    this.BackText     = "Back";
                    this.SelectText   = "Continue";
                }
                // reject the invitation
                if (backclicked)
                {
                    isIntroduction = false;
                    Player player = character as Player;
                    this.DialogueText = player.JoinRejectedDialogue;
                    this.BackText     = "Back";
                    this.SelectText   = "Continue";
                }
            }
            else
            {
                // exit the screen
                if (okClicked || backclicked)
                {
                    ExitScreen();
                    return;
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool okClicked = false;

            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)selectIconPosition.X, (int)selectIconPosition.Y,
                                                 (int)(selectIconTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(selectIconTexture.Height * ScaledVector2.DrawFactor))))
            {
                okClicked = true;
            }

            // exit without bothering to see the rest
            if (InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                ExitScreen();
            }
            // advance to the next player to have leveled up
            else if (okClicked)
            {
                if (leveledUpPlayers.Count <= 0)
                {
                    // no players at all
                    ExitScreen();
                    return;
                }
                if (index < leveledUpPlayers.Count - 1)
                {
                    // move to the next player
                    index++;
                    GetSpellList();
                }
                else
                {
                    // no more players
                    ExitScreen();
                    return;
                }
            }
            // Scroll up
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
            {
                if (startIndex > 0)
                {
                    startIndex--;
                    endIndex--;
                }
            }
            // Scroll down
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
            {
                if (startIndex < spellList.Count - maxLines)
                {
                    endIndex++;
                    startIndex++;
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool upperClicked = false;
            bool lowerClicked = false;
            bool backClicked  = false;

            if (InputManager.IsButtonClicked(new Rectangle
                                                 ((int)scrollUpPosition.X - scrollUpTexture.Width,
                                                 (int)scrollUpPosition.Y - scrollUpTexture.Height,
                                                 scrollUpTexture.Width * 2, scrollUpTexture.Height * 2)))
            {
                upperClicked = true;
            }

            if (InputManager.IsButtonClicked(new Rectangle
                                                 ((int)scrollDownPosition.X - scrollDownTexture.Width,
                                                 (int)scrollDownPosition.Y - scrollDownTexture.Height,
                                                 scrollDownTexture.Width * 2, scrollDownTexture.Height * 2)))
            {
                lowerClicked = true;
            }

            if (InputManager.IsButtonClicked(new Rectangle
                                                 ((int)backPosition.X, (int)backPosition.Y,
                                                 (int)(backTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(backTexture.Height * ScaledVector2.DrawFactor))))
            {
                backClicked = true;
            }


            // exits the screen
            if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked)
            {
                ExitScreen();
                return;
            }
            // scroll down
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown) ||
                     lowerClicked)
            {
                // Traverse down the help text
                if (startIndex + maxLineDisplay < textLines.Count)
                {
                    startIndex += 1;
                }
            }
            // scroll up
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp) ||
                     upperClicked)
            {
                // Traverse up the help text
                if (startIndex > 0)
                {
                    startIndex -= 1;
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Handle user input.
 /// </summary>
 public override void HandleInput()
 {
     if (InputManager.IsActionTriggered(InputManager.Action.PageLeft))
     {
         PageScreenLeft();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.PageRight))
     {
         PageScreenRight();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
     {
         MoveCursorUp();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
     {
         MoveCursorDown();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.IncreaseAmount))
     {
         MoveCursorRight();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.DecreaseAmount))
     {
         MoveCursorLeft();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         BackTriggered();
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
     {
         ReadOnlyCollection <T> dataList = GetDataList();
         if ((selectedIndex >= 0) && (selectedIndex < dataList.Count))
         {
             SelectTriggered(dataList[selectedIndex]);
         }
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.DropUnEquip))
     {
         ReadOnlyCollection <T> dataList = GetDataList();
         if ((selectedIndex >= 0) && (selectedIndex < dataList.Count))
         {
             ButtonXPressed(dataList[selectedIndex]);
         }
     }
     else if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
     {
         ReadOnlyCollection <T> dataList = GetDataList();
         if ((selectedIndex >= 0) && (selectedIndex < dataList.Count))
         {
             ButtonYPressed(dataList[selectedIndex]);
         }
     }
     base.HandleInput();
 }
Esempio n. 12
0
 /// <summary>
 /// Handles user input.
 /// </summary>
 public override void HandleInput()
 {
     if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
         InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
         ScreenManager.AddScreen(new MainMenuScreen());
         return;
     }
 }
Esempio n. 13
0
        /// <summary>
        /// Handles user input to the dialog.
        /// </summary>
        public override void HandleInput()
        {
            bool upperClicked = false;
            bool lowerClicked = false;

            if (InputManager.IsButtonClicked(upperArrow))
            {
                upperClicked = true;
            }

            if (InputManager.IsButtonClicked(lowerArrow))
            {
                lowerClicked = true;
            }



            // Scroll up
            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp) || upperClicked)
            {
                if (startIndex > 0)
                {
                    startIndex--;
                    endIndex--;
                }
            }
            // Scroll down
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown) || lowerClicked)
            {
                if (startIndex < dialogueList.Count - drawMaxLines)
                {
                    endIndex++;
                    startIndex++;
                }
            }

            // Press Select or back
            else if (InputManager.IsActionTriggered(InputManager.Action.Back) ||
                     InputManager.IsButtonClicked(new Rectangle(
                                                      (int)backButtonPosition.X,
                                                      (int)backButtonPosition.Y,
                                                      (int)(backButtonTexture.Width * ScaledVector2.DrawFactor),
                                                      (int)(backButtonTexture.Height * ScaledVector2.DrawFactor))) ||
                     InputManager.IsButtonClicked(new Rectangle(
                                                      (int)selectButtonPosition.X,
                                                      (int)selectButtonPosition.Y,
                                                      (int)(selectButtonTexture.Width * ScaledVector2.DrawFactor),
                                                      (int)(selectButtonTexture.Height * ScaledVector2.DrawFactor))))
            {
                ExitScreen();
                return;
            }
        }
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            if (InputManager.IsActionTriggered(InputManager.Action.Back) &&
                Session.IsActive)
            {
                AudioManager.PopMusic();
                ExitScreen();
                return;
            }

            base.HandleInput();
        }
Esempio n. 15
0
 /// <summary>
 /// Handle user input.
 /// </summary>
 public override void HandleInput()
 {
     // exit the screen
     if (InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
         return;
     }
     // move the cursor up
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
     {
         if (selectionMark == 2)
         {
             selectionMark = 1;
         }
     }
     // move the cursor down
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
     {
         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;
         }
     }
 }
Esempio n. 16
0
        /// <summary>
        /// Allows the screen to handle user input.
        /// </summary>
        public override void HandleInput()
        {
            // if the chestEntry.Content is empty, exit immediately
            if (chestEntry.Content.IsEmpty)
            {
                BackTriggered();
                return;
            }

            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
            {
                MoveCursorUp();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
            {
                MoveCursorDown();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.IncreaseAmount))
            {
                MoveCursorRight();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.DecreaseAmount))
            {
                MoveCursorLeft();
            }
            // Close is pressed
            else if (InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                BackTriggered();
            }
            // Take is pressed
            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
            {
                if (IsGoldSelected)
                {
                    SelectTriggered(null);
                }
                else
                {
                    ReadOnlyCollection <ContentEntry <Gear> > dataList = GetDataList();
                    SelectTriggered(dataList[SelectedGearIndex]);
                }
            }
            // Take All is pressed
            else if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
            {
                ButtonYPressed(null); // take-all doesn't need an entry
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Handles user input.
 /// </summary>
 public override void HandleInput()
 {
     // exit without bothering to see the rest
     if (InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
     }
     // advance to the next player to have leveled up
     else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
     {
         if (leveledUpPlayers.Count <= 0)
         {
             // no players at all
             ExitScreen();
             return;
         }
         if (index < leveledUpPlayers.Count - 1)
         {
             // move to the next player
             index++;
             GetSpellList();
         }
         else
         {
             // no more players
             ExitScreen();
             return;
         }
     }
     // Scroll up
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
     {
         if (startIndex > 0)
         {
             startIndex--;
             endIndex--;
         }
     }
     // Scroll down
     else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
     {
         if (startIndex < spellList.Count - maxLines)
         {
             endIndex++;
             startIndex++;
         }
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Handles user input.
 /// </summary>
 public override void HandleInput()
 {
     // exits the screen
     if (InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
         return;
     }
     // select one of the buttons
     else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
     {
         if (currentCursor == 0)
         {
             ScreenManager.AddScreen(new StoreBuyScreen(store));
         }
         else if (currentCursor == 1)
         {
             ScreenManager.AddScreen(new StoreSellScreen(store));
         }
         else
         {
             ExitScreen();
         }
         return;
     }
     // move the cursor up
     else if (InputManager.IsActionTriggered(
                  InputManager.Action.MoveCharacterUp))
     {
         currentCursor--;
         if (currentCursor < 0)
         {
             currentCursor = 0;
         }
     }
     // move the cursor down
     else if (InputManager.IsActionTriggered(
                  InputManager.Action.MoveCharacterDown))
     {
         currentCursor++;
         if (currentCursor > 2)
         {
             currentCursor = 2;
         }
     }
 }
Esempio n. 19
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput()
        {
            bool confirmationClicked = false;
            bool backClicked         = false;


            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)selectPosition.X,
                                                 (int)selectPosition.Y,
                                                 (int)(backTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(backTexture.Height * ScaledVector2.DrawFactor))))
            {
                confirmationClicked = true;
            }

            if (InputManager.IsButtonClicked(new Rectangle
                                                 ((int)backPosition.X,
                                                 (int)backPosition.Y,
                                                 (int)(backTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(backTexture.Height * ScaledVector2.DrawFactor))))
            {
                backClicked = true;
            }


            if (confirmationClicked)
            {
                // Raise the accepted event, then exit the message box.
                if (Accepted != null)
                {
                    Accepted(this, EventArgs.Empty);
                }

                ExitScreen();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked)
            {
                // Raise the cancelled event, then exit the message box.
                if (Cancelled != null)
                {
                    Cancelled(this, EventArgs.Empty);
                }

                ExitScreen();
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool backClicked = false;

            if (InputManager.IsButtonClicked(new Rectangle
                                                 ((int)backPosition.X - backTexture.Width,
                                                 (int)backPosition.Y,
                                                 backTexture.Width * 6, backTexture.Height * 2)))
            {
                backClicked = true;
            }
            // exit the screen
            if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked)
            {
                ExitScreen();
            }
            // toggle between keyboard and gamepad controls
            else if (InputManager.IsActionTriggered(InputManager.Action.PageLeft) ||
                     InputManager.IsActionTriggered(InputManager.Action.PageRight))
            {
                isShowControlPad = !isShowControlPad;
            }
            // scroll through the keyboard controls
            if (isShowControlPad == false)
            {
                if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
                {
                    if (startIndex < keyboardInfo.totalActionList.Length -
                        maxActionDisplay)
                    {
                        startIndex++;
                        keyboardInfo.selectedIndex++;
                    }
                }
                if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
                {
                    if (startIndex > 0)
                    {
                        startIndex--;
                        keyboardInfo.selectedIndex--;
                    }
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool backClicked = false;

            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)selectIconPosition.X, (int)selectIconPosition.Y,
                                                 selectIconTexture.Width, selectIconTexture.Height)))
            {
                backClicked = true;
            }

            // exit the screen
            if (backClicked ||
                InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                ExitScreen();
                // give the rewards to the party
                Session.Party.PartyGold += goldReward;
                foreach (Gear gear in gearReward)
                {
                    Session.Party.AddToInventory(gear, 1);
                }
                Session.Party.GiveExperience(experienceReward);
            }
            // Scroll up
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
            {
                if (startIndex > 0)
                {
                    startIndex--;
                    endIndex--;
                }
            }
            // Scroll down
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
            {
                if (startIndex < gearReward.Count - maxLines)
                {
                    endIndex++;
                    startIndex++;
                }
            }
        }
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            // view the player's statistics
            if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
            {
                ScreenManager.AddScreen(new StatisticsScreen(character as Player));
                return;
            }

            if (isIntroduction)
            {
                // accept the invitation
                if (InputManager.IsActionTriggered(InputManager.Action.Ok))
                {
                    isIntroduction = false;
                    Player player = character as Player;
                    Session.Party.JoinParty(player);
                    Session.RemovePlayerNpc(mapEntry);
                    this.DialogueText = player.JoinAcceptedDialogue;
                    this.BackText     = "Back";
                    this.SelectText   = "Back";
                }
                // reject the invitation
                if (InputManager.IsActionTriggered(InputManager.Action.Back))
                {
                    isIntroduction = false;
                    Player player = character as Player;
                    this.DialogueText = player.JoinRejectedDialogue;
                    this.BackText     = "Back";
                    this.SelectText   = "Back";
                }
            }
            else
            {
                // exit the screen
                if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
                    InputManager.IsActionTriggered(InputManager.Action.Back))
                {
                    ExitScreen();
                    return;
                }
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            bool backClicked = false;

            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)backgroundPosition.X, (int)backgroundPosition.Y,
                                                 (int)(backTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(backTexture.Height * ScaledVector2.DrawFactor))))
            {
                backClicked = true;
            }

            if (backClicked ||
                InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                ExitScreen();
                ScreenManager.AddScreen(new MainMenuScreen());
                return;
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput()
        {
            int oldSelectedEntry = selectedEntry;

            // Move to the previous menu entry?
            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
            {
                selectedEntry--;
                if (selectedEntry < 0)
                {
                    selectedEntry = menuEntries.Count - 1;
                }
            }

            // Move to the next menu entry?
            if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
            {
                selectedEntry++;
                if (selectedEntry >= menuEntries.Count)
                {
                    selectedEntry = 0;
                }
            }

            // Accept or cancel the menu?
            if (InputManager.IsActionTriggered(InputManager.Action.Ok))
            {
                AudioManager.PlayCue("Continue");
                OnSelectEntry(selectedEntry);
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.Back) ||
                     InputManager.IsActionTriggered(InputManager.Action.ExitGame))
            {
                OnCancel();
            }
            else if (selectedEntry != oldSelectedEntry)
            {
                AudioManager.PlayCue("MenuMove");
            }
        }
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput()
        {
            if (InputManager.IsActionTriggered(InputManager.Action.Ok))
            {
                // Raise the accepted event, then exit the message box.
                if (Accepted != null)
                {
                    Accepted(this, EventArgs.Empty);
                }

                ExitScreen();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                // Raise the cancelled event, then exit the message box.
                if (Cancelled != null)
                {
                    Cancelled(this, EventArgs.Empty);
                }

                ExitScreen();
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Handles user input.
        /// </summary>
        public override void HandleInput()
        {
            // exit the screen
            if (InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                ExitScreen();
            }
#if !XBOX
            // toggle between keyboard and gamepad controls
            else if (InputManager.IsActionTriggered(InputManager.Action.PageLeft) ||
                     InputManager.IsActionTriggered(InputManager.Action.PageRight))
            {
                isShowControlPad = !isShowControlPad;
            }
            // scroll through the keyboard controls
            if (isShowControlPad == false)
            {
                if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
                {
                    if (startIndex < keyboardInfo.totalActionList.Length -
                        maxActionDisplay)
                    {
                        startIndex++;
                        keyboardInfo.selectedIndex++;
                    }
                }
                if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
                {
                    if (startIndex > 0)
                    {
                        startIndex--;
                        keyboardInfo.selectedIndex--;
                    }
                }
            }
#endif
        }
Esempio n. 27
0
 /// <summary>
 /// Handle user input.
 /// </summary>
 public override void HandleInput()
 {
     // exit the screen
     if (InputManager.IsActionTriggered(InputManager.Action.Back))
     {
         ExitScreen();
         return;
     }
     // shows the spells for this player
     else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
     {
         ScreenManager.AddScreen(new SpellbookScreen(player,
                                                     player.CharacterStatistics));
         return;
     }
     // show the equipment for this player, allowing the user to unequip
     else if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
     {
         ScreenManager.AddScreen(new EquipmentScreen(player));
         return;
     }
     else if (Session.Party.Players.Contains(player)) // player is in the party
     {
         // move to the previous screen
         if (InputManager.IsActionTriggered(InputManager.Action.PageLeft))
         {
             ExitScreen();
             ScreenManager.AddScreen(new QuestLogScreen(null));
             return;
         }
         // move to the next screen
         else if (InputManager.IsActionTriggered(InputManager.Action.PageRight))
         {
             ExitScreen();
             ScreenManager.AddScreen(new InventoryScreen(true));
             return;
         }
         // move to the previous party member
         else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
         {
             playerIndex--;
             if (playerIndex < 0)
             {
                 playerIndex = Session.Party.Players.Count - 1;
             }
             Player newPlayer = Session.Party.Players[playerIndex];
             if (newPlayer != player)
             {
                 player          = newPlayer;
                 screenAnimation = new AnimatingSprite();
                 screenAnimation.FrameDimensions =
                     player.MapSprite.FrameDimensions;
                 screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow;
                 screenAnimation.SourceOffset = player.MapSprite.SourceOffset;
                 screenAnimation.Texture      = player.MapSprite.Texture;
                 screenAnimation.AddAnimation(
                     new Animation("Idle", 43, 48, 150, true));
                 screenAnimation.PlayAnimation(0);
             }
         }
         // move to the next party member
         else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
         {
             playerIndex++;
             if (playerIndex >= Session.Party.Players.Count)
             {
                 playerIndex = 0;
             }
             Player newPlayer = Session.Party.Players[playerIndex];
             if (newPlayer != player)
             {
                 player          = newPlayer;
                 screenAnimation = new AnimatingSprite();
                 screenAnimation.FrameDimensions =
                     player.MapSprite.FrameDimensions;
                 screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow;
                 screenAnimation.SourceOffset = player.MapSprite.SourceOffset;
                 screenAnimation.Texture      = player.MapSprite.Texture;
                 screenAnimation.AddAnimation(
                     new Animation("Idle", 43, 48, 150, true));
                 screenAnimation.PlayAnimation(0);
             }
         }
     }
 }
        /// <summary>
        /// Respond to user input.
        /// </summary>
        public override void HandleInput()
        {
            // handle exiting the screen
            if (InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                ExitScreen();
                return;
            }

            // handle selecting a save game
            if (InputManager.IsActionTriggered(InputManager.Action.Ok) &&
                (Session.SaveGameDescriptions != null))
            {
                switch (mode)
                {
                case SaveLoadScreenMode.Load:
                    if ((currentSlot >= 0) &&
                        (currentSlot < Session.SaveGameDescriptions.Count) &&
                        (Session.SaveGameDescriptions[currentSlot] != null))
                    {
                        if (Session.IsActive)
                        {
                            MessageBoxScreen messageBoxScreen = new MessageBoxScreen(
                                "Are you sure you want to load this game?");
                            messageBoxScreen.Accepted +=
                                ConfirmLoadMessageBoxAccepted;
                            ScreenManager.AddScreen(messageBoxScreen);
                        }
                        else
                        {
                            ConfirmLoadMessageBoxAccepted(null, EventArgs.Empty);
                        }
                    }
                    break;

                case SaveLoadScreenMode.Save:
                    if ((currentSlot >= 0) &&
                        (currentSlot <= Session.SaveGameDescriptions.Count))
                    {
                        if (currentSlot == Session.SaveGameDescriptions.Count)
                        {
                            ConfirmSaveMessageBoxAccepted(null, EventArgs.Empty);
                        }
                        else
                        {
                            MessageBoxScreen messageBoxScreen = new MessageBoxScreen(
                                "Are you sure you want to overwrite this save game?");
                            messageBoxScreen.Accepted +=
                                ConfirmSaveMessageBoxAccepted;
                            ScreenManager.AddScreen(messageBoxScreen);
                        }
                    }
                    break;
                }
            }
            // handle deletion
            else if (InputManager.IsActionTriggered(InputManager.Action.DropUnEquip) &&
                     (Session.SaveGameDescriptions != null))
            {
                if ((currentSlot >= 0) &&
                    (currentSlot < Session.SaveGameDescriptions.Count) &&
                    (Session.SaveGameDescriptions[currentSlot] != null))
                {
                    MessageBoxScreen messageBoxScreen = new MessageBoxScreen(
                        "Are you sure you want to delete this save game?");
                    messageBoxScreen.Accepted += ConfirmDeleteMessageBoxAccepted;
                    ScreenManager.AddScreen(messageBoxScreen);
                }
            }
            // handle cursor-down
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown) &&
                     (Session.SaveGameDescriptions != null))
            {
                int maximumSlot = Session.SaveGameDescriptions.Count;
                if (mode == SaveLoadScreenMode.Save)
                {
                    maximumSlot = Math.Min(maximumSlot + 1,
                                           Session.MaximumSaveGameDescriptions);
                }
                if (currentSlot < maximumSlot - 1)
                {
                    currentSlot++;
                }
            }
            // handle cursor-up
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp) &&
                     (Session.SaveGameDescriptions != null))
            {
                if (currentSlot >= 1)
                {
                    currentSlot--;
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Allows the screen to handle user input.
        /// </summary>
        public override void HandleInput()
        {
            // if the chestEntry.Content is empty, exit immediately
            if (chestEntry.Content.IsEmpty)
            {
                BackTriggered();
                return;
            }

            bool takeAllClicked = false;
            bool backClicked    = false;
            bool okClicked      = false;


            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)yButtonTexturePosition.X,
                                                 (int)yButtonTexturePosition.Y,
                                                 (int)(yButtonTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(yButtonTexture.Height * ScaledVector2.DrawFactor))))
            {
                takeAllClicked = true;
            }
            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)backButtonTexturePosition.X,
                                                 (int)backButtonTexturePosition.Y,
                                                 (int)(backButtonTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(backButtonTexture.Height * ScaledVector2.DrawFactor))))
            {
                backClicked = true;
            }


            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)selectButtonTexturePosition.X,
                                                 (int)selectButtonTexturePosition.Y,
                                                 (int)(selectButtonTexture.Width * ScaledVector2.DrawFactor),
                                                 (int)(selectButtonTexture.Height * ScaledVector2.DrawFactor))))
            {
                okClicked = true;
            }



            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
            {
                MoveCursorUp();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
            {
                MoveCursorDown();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.IncreaseAmount))
            {
                MoveCursorRight();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.DecreaseAmount))
            {
                MoveCursorLeft();
            }
            // Close is pressed
            else if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked)
            {
                BackTriggered();
            }
            // Take All is pressed
            else if (InputManager.IsActionTriggered(InputManager.Action.TakeView) || takeAllClicked)
            {
                ButtonYPressed(null); // take-all doesn't need an entry
            }
            // Take is pressed
            else if (okClicked)
            {
                if (IsGoldSelected)
                {
                    SelectTriggered(null);
                }
                else
                {
                    ReadOnlyCollection <ContentEntry <Gear> > dataList = GetDataList();
                    SelectTriggered(dataList[SelectedGearIndex]);
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Handle user input.
        /// </summary>
        public override void HandleInput()
        {
            bool equClicked   = false;
            bool backClicked  = false;
            bool spellClicked = false;


            if (InputManager.IsButtonClicked(new Rectangle(
                                                 (int)(backButtonPosition.X),
                                                 (int)(backButtonPosition.Y),
                                                 (int)(backButton.Width * ScaledVector2.DrawFactor),
                                                 (int)(backButton.Height * ScaledVector2.DrawFactor))))
            {
                backClicked = true;
            }
            if (InputManager.IsButtonClicked(equipmentRecangle))
            {
                equClicked = true;
            }
            if (InputManager.IsButtonClicked(spellRecangle))
            {
                spellClicked = true;
            }
            // exit the screen
            if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked)
            {
                ExitScreen();
                return;
            }
            // shows the spells for this player
            else if (spellClicked) //InputManager.IsActionTriggered(InputManager.Action.Ok))
            {
                ScreenManager.AddScreen(new SpellbookScreen(player,
                                                            player.CharacterStatistics));
                return;
            }
            // show the equipment for this player, allowing the user to unequip
            else if (InputManager.IsActionTriggered(InputManager.Action.TakeView) || equClicked)
            {
                ScreenManager.AddScreen(new EquipmentScreen(player));
                return;
            }
            else if (Session.Party.Players.Contains(player)) // player is in the party
            {
                // move to the previous screen
                if (InputManager.IsActionTriggered(InputManager.Action.PageLeft))
                {
                    ExitScreen();
                    ScreenManager.AddScreen(new QuestLogScreen(null));
                    return;
                }
                // move to the next screen
                else if (InputManager.IsActionTriggered(InputManager.Action.PageRight))
                {
                    ExitScreen();
                    ScreenManager.AddScreen(new InventoryScreen(true));
                    return;
                }
                // move to the previous party member
                else if (InputManager.IsActionTriggered(InputManager.Action.TargetUp))
                {
                    playerIndex--;
                    if (playerIndex < 0)
                    {
                        playerIndex = Session.Party.Players.Count - 1;
                    }
                    Player newPlayer = Session.Party.Players[playerIndex];
                    if (newPlayer != player)
                    {
                        player          = newPlayer;
                        screenAnimation = new AnimatingSprite();
                        screenAnimation.FrameDimensions =
                            player.MapSprite.FrameDimensions;
                        screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow;
                        screenAnimation.SourceOffset = player.MapSprite.SourceOffset;
                        screenAnimation.Texture      = player.MapSprite.Texture;
                        screenAnimation.AddAnimation(
                            new Animation("Idle", 43, 48, 150, true));
                        screenAnimation.PlayAnimation(0);
                    }
                }
                // move to the next party member
                else if (InputManager.IsActionTriggered(InputManager.Action.TargetDown))
                {
                    playerIndex++;
                    if (playerIndex >= Session.Party.Players.Count)
                    {
                        playerIndex = 0;
                    }
                    Player newPlayer = Session.Party.Players[playerIndex];
                    if (newPlayer != player)
                    {
                        player          = newPlayer;
                        screenAnimation = new AnimatingSprite();
                        screenAnimation.FrameDimensions =
                            player.MapSprite.FrameDimensions;
                        screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow;
                        screenAnimation.SourceOffset = player.MapSprite.SourceOffset;
                        screenAnimation.Texture      = player.MapSprite.Texture;
                        screenAnimation.AddAnimation(
                            new Animation("Idle", 43, 48, 150, true));
                        screenAnimation.PlayAnimation(0);
                    }
                }
            }
        }