Пример #1
0
 internal void ProcessInput(IKeyboard keyboard)
 {
     if (IsBindingKey)
     {
         if (keyboard.IsKeyPressed(Options.KeyBindings[GameAction.OpenMenu]))
         {
             this.IsBindingKey = false;
             // Don't allow the parent (keybindings console) to abort back to the options menu
             keyboard.Clear();
         }
         else
         {
             var keys = keyboard.GetKeysPressed();
             if (keys.Any())
             {
                 // Rebind
                 var selectedItem = this.controls[selectedIndex];
                 Options.KeyBindings[selectedItem] = keys.First();
                 this.IsBindingKey = false;
             }
         }
     }
     else
     {
         if (keyboard.IsKeyPressed(Options.KeyBindings[GameAction.MoveUp]))
         {
             this.selectedIndex--;
             if (this.selectedIndex == -1)
             {
                 this.selectedIndex = this.controls.Count - 1;
             }
         }
         if (keyboard.IsKeyPressed(Options.KeyBindings[GameAction.MoveDown]))
         {
             this.selectedIndex = (this.selectedIndex + 1) % this.controls.Count;
         }
         if (keyboard.IsKeyPressed(Options.KeyBindings[GameAction.SkipTurn]))
         {
             this.IsBindingKey = true;
         }
     }
 }