Beyond_Beyaan.Screens.ColonizeScreen.KeyDown C# (CSharp) Метод

KeyDown() публичный Метод

public KeyDown ( GorgonLibrary e ) : bool
e GorgonLibrary
Результат bool
        public override bool KeyDown(GorgonLibrary.InputDevices.KeyboardInputEventArgs e)
        {
            if (_showingText)
            {
                if ((e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Enter || e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Return) && !string.IsNullOrEmpty(_nameTextBox.Text))
                {
                    _starSystem.Name = _nameTextBox.Text;
                    _colonizing = false;
                    _showingText = false;
                    //Done
                    if (Completed != null)
                    {
                        Completed();
                    }
                }
                _nameTextBox.KeyDown(e);
            }
            else if (e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Enter || e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Return)
            {
                _showingText = true;
                _landingShipPos = _gameMain.ScreenHeight / 2 + 50;
            }
            return true;
        }

Usage Example

 public void KeyDown(KeyboardInputEventArgs e)
 {
     if (_colonizableFleetsThisTurn.Count > 0)
     {
         _colonizeScreen.KeyDown(e);
     }
 }