Exemple #1
0
 public override void HandleInput(GamePadState gamePadState, KeyboardState keyState, MouseState mouseState)
 {
     if (InputHandler.WasKeyPressed(keyState, KeyConfig.KeyList[4], 10))
     {
         if (remainingText.Replace(" ", "") == "")
         {
             if (messageQueue.Count > 0)
             {
                 splitMessage(messageQueue.Dequeue());
                 setPosition();
             }
             else
             {
                 Close();
             }
         }
         else
         {
             splitMessage(remainingText);
             menuWindow.ChangeOption(0, lineOne);
             if (lineTwo.Replace(" ", "") == "")
             {
                 menuWindow.RemoveOption(1);
                 setPosition();
             }
             else
             {
                 menuWindow.ChangeOption(1, lineTwo);
                 setPosition();
             }
         }
     }
 }
Exemple #2
0
 public override void HandleInput(GamePadState gamePadState, KeyboardState keyState, MouseState mouseState)
 {
     if (InputHandler.WasKeyPressed(keyState, KeyConfig.Action))
     {
         //handle options
         if (OptionBox.isVisible && OptionBox.isActive)
         {
             //finalize the choice the user makes
             OptionBox.isVisible = false;
             lock (TFSH.PokeEngineScriptHelper.lockObject)
             {
                 //send pulse to method to continue execution
                 Monitor.PulseAll(TFSH.PokeEngineScriptHelper.lockObject);
             }
             Close();
         }
         //handle regular text
         else
         {
             if (remainingText.Replace(" ", "") == "")
             {
                 if (messageQueue.Count > 0)
                 {
                     ShowDialog(messageQueue.Dequeue());
                     setPosition();
                 }
                 else if (!currentMessage.hasOptions)
                 {
                     Close();
                 }
             }
             else
             {
                 ShowDialog(new Message(remainingText));
                 menuWindow.ChangeOption(0, lineOne);
                 if (lineTwo.Replace(" ", "") == "")
                 {
                     menuWindow.RemoveOption(1);
                     setPosition();
                 }
                 else
                 {
                     menuWindow.ChangeOption(1, lineTwo);
                     setPosition();
                 }
             }
         }
     }
     //press up to decrease option choice by 1, minimum is zero
     if (InputHandler.WasKeyPressed(keyState, KeyConfig.Up, 10))
     {
         if (OptionBox.isVisible)
         {
             choice--;
             if (choice < 0)
             {
                 choice = 0;
             }
             if (choice < OptionBox.topChoice)
             {
                 OptionBox.topChoice--;
             }
         }
     }
     //press down to increase option choice by 1, maximum of options.length-1 (cause zero index)
     if (InputHandler.WasKeyPressed(keyState, KeyConfig.Down, 10))
     {
         if (OptionBox.isVisible)
         {
             choice++;
             if (choice >= OptionBox.options.Length)
             {
                 choice = OptionBox.options.Length - 1;
             }
             if (choice > OptionBox.topChoice + 3)
             {
                 OptionBox.topChoice++;
             }
         }
     }
 }