public void HandleKeyboardEvent(object sender, KeyboardInputEventArgs e)
 {
     if(_keyStates.ContainsKey(e.Key))
     {
         _keyStates[e.Key] = e.State;
     }
 }
Beispiel #2
0
 private void keyboardInput(object sender, KeyboardInputEventArgs e)
 {
     if (e.State.HasFlag(KeyState.Pressed))
     {
         if (Pressed.ContainsKey(e.Key))
         {
             Pressed[e.Key] = true;
         }
         else
         {
             Pressed.Add(e.Key, true);
         }
     }
     else if (e.State.HasFlag(KeyState.Released))
     {
         if (Pressed.ContainsKey(e.Key))
         {
             Pressed[e.Key] = false;
         }
         else
         {
             Pressed.Add(e.Key, false);
         }
     }
 }
 /// <summary>
 /// This method needs to be overriden by SlimDX.RawInput.Device.
 /// </summary>
 public void UpdateInput(object sender, KeyboardInputEventArgs e)
 {
     if (!KeyStates.ContainsKey((Key)e.MakeCode))
     {
         KeyStates.Add((Key)e.MakeCode, e.State);
     }
     else
     {
         KeyStates[(Key)e.MakeCode] = e.State;
     }
 }
 public void KeyDown(KeyboardInputEventArgs e)
 {
     if (e.Key == KeyboardKeys.Enter || e.Key == KeyboardKeys.Return)
     {
         _gameMain.SendChat(_messageTextBox.Text);
         _messageTextBox.SetText(string.Empty);
     }
     else
     {
         _messageTextBox.KeyDown(e);
     }
 }
Beispiel #5
0
 public void Device_KeyboardInput(object sender, KeyboardInputEventArgs e)
 {
     if (e.State == KeyState.Pressed)
     {
         if (KeysDown.Contains(e.Key) == false)
         {
             KeysPressed.Add(e.Key);
             KeysDown.Add(e.Key);
         }
     }
     else if (e.State == KeyState.Released)
     {
         KeysReleased.Add(e.Key);
         KeysDown.Remove(e.Key);
     }
 }
Beispiel #6
0
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     if (!base.KeyDown(e))
         return input.KeyDown(e);
     else return false;
 }
Beispiel #7
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     UserInterfaceManager.KeyDown(e);
 }
Beispiel #8
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     _screenInterface.KeyDown(e);
 }
Beispiel #9
0
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     if (_promptShowing)
     {
         bool result = _saveGameNameField.KeyDown(e);
         if (e.Key == KeyboardKeys.Enter || e.Key == KeyboardKeys.Return)
         {
             result = true;
             _promptShowing = false;
             _gameMain.SaveGame(_saveGameNameField.Text);
             GetSaveList(); //Refresh the list after saving
         }
         else if (e.Key == KeyboardKeys.Escape)
         {
             _promptShowing = false;
             result = true;
         }
         return result;
     }
     if (e.Key == KeyboardKeys.Escape && CloseWindow != null)
     {
         CloseWindow();
         return true;
     }
     return false;
 }
Beispiel #10
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
 }
Beispiel #11
0
        public override bool KeyDown(KeyboardInputEventArgs e)
        {
            if (!Focus) return false;

            if (e.Ctrl && e.CharacterMapping.Character == 'v')
            {
                if (Clipboard.ContainsText())
                {
                    string ret = Clipboard.GetText();
                    Text = Text.Insert(_caretIndex, ret);
                    if (_caretIndex < _text.Length) _caretIndex += ret.Length;
                    SetVisibleText();
                    return true;
                }
            }

            if (e.Ctrl && e.CharacterMapping.Character == 'c')
            {
                Clipboard.SetText(Text);
                return true;
            }

            if (e.Key == KeyboardKeys.Left)
            {
                if (_caretIndex > 0) _caretIndex--;
                SetVisibleText();
                return true;
            }
            else if (e.Key == KeyboardKeys.Right)
            {
                if (_caretIndex < _text.Length) _caretIndex++;
                SetVisibleText();
                return true;
            }

            if (e.Key == KeyboardKeys.Return && Text.Length >= 1)
            {
                Submit();
                return true;
            }

            if (e.Key == KeyboardKeys.Back && Text.Length >= 1)
            {
                if (_caretIndex == 0) return true;

                Text = Text.Remove(_caretIndex - 1, 1);
                if (_caretIndex > 0 && _caretIndex < Text.Length) _caretIndex--;
                SetVisibleText();
                return true;
            }

            if (e.Key == KeyboardKeys.Delete && Text.Length >= 1)
            {
                if (_caretIndex >= Text.Length) return true;
                Text = Text.Remove(_caretIndex, 1);
                SetVisibleText();
                return true;
            }

            if (char.IsLetterOrDigit(e.CharacterMapping.Character) || char.IsPunctuation(e.CharacterMapping.Character) ||
                char.IsWhiteSpace(e.CharacterMapping.Character))
            {
                if (Text.Length == MaxCharacters) return false;
                if (e.Shift)
                {
                    Text = Text.Insert(_caretIndex, e.CharacterMapping.Shifted.ToString());
                    if (_caretIndex < _text.Length) _caretIndex++;
                    SetVisibleText();
                }
                else
                {
                    Text = Text.Insert(_caretIndex, e.CharacterMapping.Character.ToString());
                    if (_caretIndex < _text.Length) _caretIndex++;
                    SetVisibleText();
                }
                return true;
            }
            return false;
        }
Beispiel #12
0
 private void KeyboardOnKeyDown(object sender, KeyboardInputEventArgs e)
 {
     if (e.Alt && e.Key == KeyboardKeys.Enter)
     {
         Gorgon.Screen.Windowed = !Gorgon.Screen.Windowed;
     }
     _gameMain.KeyDown(e);
 }
        /*private void RefreshContactList()
        {
            foreach (Button button in empireButtons)
            {
                button.Selected = false;
            }
            int whichButton = whichContactSelected - empireScrollBar.TopIndex;
            if (whichButton >= 0 && whichButton < 4)
            {
                empireButtons[whichButton].Selected = true;
            }
            for (int i = 0; i < maxVisible; i++)
            {
                spyEffortScrollbars[i].TopIndex = empiresInContact[i + empireScrollBar.TopIndex].SpyEffort;
                spyDefenseScrollbars[i].TopIndex = empiresInContact[i + empireScrollBar.TopIndex].AntiSpyEffort;
                avatars[i] = empiresInContact[i + empireScrollBar.TopIndex].EmpireInContact.EmpireRace.GetMiniAvatar();
                relationLabels[i] = new Label(Utility.RelationToLabel(empiresInContact[i + empireScrollBar.TopIndex].RelationshipStatus), x + 165, y + 104 + (i * 150));
                empireNameLabels[i] = new Label(empiresInContact[i + empireScrollBar.TopIndex].EmpireInContact.EmpireName, x + 145, y + 3 + (i * 150), empiresInContact[i + empireScrollBar.TopIndex].EmpireInContact.EmpireColor);
            }
        }

        private void LoadContact()
        {
            isViewingReceivedMessage = false;
            for (int i = 0; i < messageOptions.Length; i++)
            {
                messageOptions[i].Selected = false;
                messageOptions[i].Active = true;
            }
            Contact contact = empiresInContact[whichContactSelected];
            Expression whichExpression = Expression.NEUTRAL;
            if (contact.RelationshipStatus < 70)
            {
                whichExpression = Expression.ANGRY;
            }
            else if (contact.RelationshipStatus > 130)
            {
                whichExpression = Expression.HAPPY;
            }
            profile = contact.EmpireInContact.EmpireRace.GetAvatar(whichExpression);
            if (contact.AtWar)
            {
                messageOptions[TRADE].Active = false;
                messageOptions[RESEARCH].Active = false;
                messageOptions[ALLY].Active = false;
                messageOptions[UNALLY].Active = false;
                messageOptions[HARASS].Active = false;
                messageOptions[RECONCILE].Active = false;
                messageOptions[WAR].Active = true;
                messageOptions[WAR].SetText("Offer Peace");
            }
            else
            {
                messageOptions[TRADE].Active = true;
                messageOptions[RESEARCH].Active = true;
                messageOptions[ALLY].Active = true;
                messageOptions[UNALLY].Active = true;
                messageOptions[HARASS].Active = true;
                messageOptions[RECONCILE].Active = true;
                messageOptions[WAR].Active = true;
                messageOptions[WAR].SetText("Declare War");
            }
            if (contact.Allied)
            {
                messageOptions[ALLY].Active = false;
                messageOptions[ALLY].SetText("Already Allied");
                messageOptions[UNALLY].SetText("Break Alliance");
            }
            else if (contact.NonAggression)
            {
                messageOptions[ALLY].SetText("Offer Alliance");
                messageOptions[UNALLY].SetText("Break Non-Aggression");
            }
            else if (!contact.AtWar)
            {
                messageOptions[UNALLY].Active = false;
                messageOptions[ALLY].SetText("Offer Non-Aggression");
                messageOptions[UNALLY].SetText("No Military Pacts to Break");
            }
            if (contact.TradeTreaty)
            {
                messageOptions[TRADE].SetText("Halt Trade");
            }
            else
            {
                messageOptions[TRADE].SetText("Offer Trade");
            }
            if (contact.ResearchTreaty)
            {
                messageOptions[RESEARCH].SetText("Halt Shared Research");
            }
            else
            {
                messageOptions[RESEARCH].SetText("Offer Shared Research");
            }

            List<string> empires = new List<string>();
            adjustedEmpiresForSelection = new List<Empire>();
            foreach (Contact empireInContact in empiresInContact)
            {
                if (empireInContact != empiresInContact[whichContactSelected])
                {
                    empires.Add(empireInContact.EmpireInContact.EmpireName);
                    adjustedEmpiresForSelection.Add(empireInContact.EmpireInContact);
                }
            }

            listOfEmpires = new ComboBox(spriteNames, empires, x + 505, y + 440, 200, 25, 6);
            if (empires.Count == 0)
            {
                listOfEmpires.Active = false;
                messageOptions[RECONCILE].Active = false;
                messageOptions[HARASS].Active = false;
            }

            if (empiresInContact[whichContactSelected].OutgoingMessage != MessageType.NONE)
            {
                //already sending a message, disable everything
                for (int i = 0; i < 8; i++)
                {
                    messageOptions[i].Active = false;
                }
                listOfEmpires.Active = false;
                switch (empiresInContact[whichContactSelected].OutgoingMessage)
                {
                    case MessageType.BREAK_TRADE:
                    case MessageType.TRADE: messageOptions[TRADE].Selected = true;
                        break;
                    case MessageType.BREAK_RESEARCH:
                    case MessageType.RESEARCH: messageOptions[RESEARCH].Selected = true;
                        break;
                    case MessageType.ALLIANCE:
                    case MessageType.NONAGGRESSION: messageOptions[ALLY].Selected = true;
                        break;
                    case MessageType.BREAK_NONAGGRESSION:
                    case MessageType.BREAK_ALLIANCE: messageOptions[UNALLY].Selected = true;
                        break;
                    case MessageType.HARASS_EMPIRE: messageOptions[HARASS].Selected = true;
                        for (int i = 0; i < adjustedEmpiresForSelection.Count; i++)
                        {
                            if (adjustedEmpiresForSelection[i] == empiresInContact[whichContactSelected].OutgoingEmpireRequest)
                            {
                                listOfEmpires.SelectedIndex = i;
                                break;
                            }
                        }
                        break;
                    case MessageType.RECONCILE_EMPIRE: messageOptions[RECONCILE].Selected = true;
                        for (int i = 0; i < adjustedEmpiresForSelection.Count; i++)
                        {
                            if (adjustedEmpiresForSelection[i] == empiresInContact[whichContactSelected].OutgoingEmpireRequest)
                            {
                                listOfEmpires.SelectedIndex = i;
                                break;
                            }
                        }
                        break;
                    case MessageType.WAR:
                    case MessageType.OFFER_PEACE: messageOptions[WAR].Selected = true;
                        break;
                }
                messageOptions[7].Selected = true;
            }
        }
        private void LoadMessage()
        {
            isViewingReceivedMessage = true;
            Contact contact = empiresInContact[whichContactSelected];
            Expression whichExpression = Expression.NEUTRAL;
            if (contact.RelationshipStatus < 70)
            {
                whichExpression = Expression.ANGRY;
            }
            else if (contact.RelationshipStatus > 130)
            {
                whichExpression = Expression.HAPPY;
            }
            profile = contact.EmpireInContact.EmpireRace.GetAvatar(whichExpression);
            MessageType whichMessage = empiresInContact[whichContactSelected].IncomingMessage;
            switch (contact.IncomingMessage)
            {
                case MessageType.TRADE:
                    IncomingMessageTextBox.SetText("We want trade agreement, do you agree?");
                    break;
                case MessageType.BREAK_TRADE:
                    IncomingMessageTextBox.SetText("We don't want your cheap items anymore!");
                    break;
                case MessageType.RESEARCH:
                    IncomingMessageTextBox.SetText("We would like us to share our research.");
                    break;
                case MessageType.BREAK_RESEARCH:
                    IncomingMessageTextBox.SetText("We don't want your lousy research!");
                    break;
                case MessageType.NONAGGRESSION:
                    IncomingMessageTextBox.SetText("We want non-aggression!");
                    break;
                case MessageType.ALLIANCE:
                    IncomingMessageTextBox.SetText("We want alliance!");
                    break;
                case MessageType.BREAK_NONAGGRESSION:
                    IncomingMessageTextBox.SetText("We want aggression!");
                    break;
                case MessageType.BREAK_ALLIANCE:
                    IncomingMessageTextBox.SetText("We want to break our alliance!");
                    break;
                case MessageType.HARASS_EMPIRE:
                    IncomingMessageTextBox.SetText("We want you to bully " + empiresInContact[whichContactSelected].IncomingEmpireRequest.EmpireName + "!");
                    break;
                case MessageType.RECONCILE_EMPIRE:
                    IncomingMessageTextBox.SetText("We want you to make peace with " + empiresInContact[whichContactSelected].IncomingEmpireRequest.EmpireName + "!");
                    break;
                case MessageType.WAR:
                    IncomingMessageTextBox.SetText("We're going to KILL you!");
                    break;
                case MessageType.OFFER_PEACE:
                    IncomingMessageTextBox.SetText("Please have mercy on us!");
                    break;
                case MessageType.ACCEPT_ALLIANCE:
                    IncomingMessageTextBox.SetText("We agree to ally with you!");
                    break;
                case MessageType.ACCEPT_NONAGGRESSION:
                    IncomingMessageTextBox.SetText("We agree to not be aggressive!");
                    break;
                case MessageType.ACCEPT_PEACE:
                    IncomingMessageTextBox.SetText("We will spare you for now!");
                    break;
                case MessageType.ACCEPT_RECONCILE:
                    IncomingMessageTextBox.SetText("We will make peace with " + "!");
                    break;
                case MessageType.ACCEPT_HARASS:
                    IncomingMessageTextBox.SetText("We will bully " + "!");
                    break;
                case MessageType.ACCEPT_RESEARCH:
                    IncomingMessageTextBox.SetText("We accept the deal to share research!");
                    break;
                case MessageType.ACCEPT_TRADE:
                    IncomingMessageTextBox.SetText("We accept the trade offer!");
                    break;
                case MessageType.DECLINE_REQUEST:
                    IncomingMessageTextBox.SetText("We decline your request.");
                    break;
            }
            if (whichMessage == MessageType.BREAK_ALLIANCE || whichMessage == MessageType.BREAK_NONAGGRESSION || whichMessage == MessageType.BREAK_RESEARCH ||
                whichMessage == MessageType.BREAK_TRADE || whichMessage == MessageType.WAR || whichMessage == MessageType.DECLINE_REQUEST)
            {
                messageOptions[ACCEPT].SetText("Oh really?");
                messageOptions[ACCEPT].Active = false;
                messageOptions[REJECT].SetText(string.Empty);
                messageOptions[REJECT].Active = false;
            }
            else if (whichMessage == MessageType.ACCEPT_ALLIANCE || whichMessage == MessageType.ACCEPT_HARASS || whichMessage == MessageType.ACCEPT_NONAGGRESSION ||
                whichMessage == MessageType.ACCEPT_PEACE || whichMessage == MessageType.ACCEPT_RECONCILE || whichMessage == MessageType.ACCEPT_RESEARCH ||
                whichMessage == MessageType.ACCEPT_TRADE)
            {
                messageOptions[ACCEPT].SetText("Yayification!");
                messageOptions[ACCEPT].Active = false;
                messageOptions[REJECT].SetText(string.Empty);
                messageOptions[REJECT].Active = false;
            }
            else
            {
                messageOptions[ACCEPT].SetText("Accept Offer");
                messageOptions[ACCEPT].Active = true;
                messageOptions[REJECT].SetText("Reject Offer");
                messageOptions[REJECT].Active = true;
            }
            messageOptions[ACCEPT].Selected = false;
            messageOptions[REJECT].Selected = false;
            if (empiresInContact[whichContactSelected].OutgoingMessage != MessageType.NONE)
            {
                messageOptions[ACCEPT].Active = false;
                messageOptions[REJECT].Active = false;
                switch(empiresInContact[whichContactSelected].OutgoingMessage)
                {
                    case MessageType.ACCEPT_ALLIANCE:
                    case MessageType.ACCEPT_HARASS:
                    case MessageType.ACCEPT_NONAGGRESSION:
                    case MessageType.ACCEPT_PEACE:
                    case MessageType.ACCEPT_RECONCILE:
                    case MessageType.ACCEPT_RESEARCH:
                    case MessageType.ACCEPT_TRADE:
                        messageOptions[ACCEPT].Selected = true;
                        break;
                    case MessageType.DECLINE_REQUEST:
                        messageOptions[REJECT].Selected = true;
                        break;
                }
            }
        }*/
        public void KeyDown(KeyboardInputEventArgs e)
        {
            if (e.Key == KeyboardKeys.Escape)
            {
                gameMain.ChangeToScreen(Screen.Galaxy);
            }
        }
Beispiel #14
0
        public override bool KeyDown(KeyboardInputEventArgs e)
        {
            if (e.Key == KeyboardKeys.T && !Active)
            {
                _userInterfaceManager.SetFocus(this);
                Active = true;
                return true;
            }

            if (!Active)
                return false;

            if (e.Key == KeyboardKeys.Enter)
            {
                if (TextSubmitted != null && !String.IsNullOrWhiteSpace(_currentInputText.ToString()))
                {
                    TextSubmitted(this, _currentInputText.ToString());
                    _inputHistory.Insert(0, _currentInputText.ToString());

                    while (_inputHistory.Count() > MaxHistory)
                    {
                        _inputHistory.RemoveAt(MaxHistory);
                    }
                }

                _inputIndex = -1;
                _currentInputText.Clear();

                Active = false;
                return true;
            }

            if (e.Key == KeyboardKeys.Up)
            {
                if (_inputIndex == -1 && _inputHistory.Any())
                {
                    _inputTemp = _currentInputText.ToString();
                    _inputIndex++;
                }
                else if (_inputIndex + 1 < _inputHistory.Count())
                {
                    _inputIndex++;
                }


                if (_inputIndex != -1)
                {
                    _currentInputText.Clear();
                    _currentInputText.Append(_inputHistory[_inputIndex]);
                }

                return true;
            }

            if (e.Key == KeyboardKeys.Down)
            {
                if (_inputIndex == 0)
                {
                    _currentInputText.Clear();
                    _currentInputText.Append(_inputTemp);
                    _inputTemp = "";
                    _inputIndex--;
                }
                else if (_inputIndex != -1)
                {
                    _inputIndex--;
                    _currentInputText.Clear();
                    _currentInputText.Append(_inputHistory[_inputIndex]);
                }
            }

            if (e.Key == KeyboardKeys.Back)
            {
                if (_currentInputText.Length > 0)
                    _currentInputText.Remove(_currentInputText.Length - 1, 1);
                return true;
            }

            if (char.IsLetterOrDigit(e.CharacterMapping.Character) || char.IsPunctuation(e.CharacterMapping.Character) ||
                char.IsWhiteSpace(e.CharacterMapping.Character) || char.IsSymbol(e.CharacterMapping.Character))
            {
                _currentInputText.Append(e.Shift ? e.CharacterMapping.Shifted : e.CharacterMapping.Character);
            }

            return true;
        }
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     _mainMenuButton.KeyDown(e);
     return true;
 }
        public bool KeyDown(KeyboardInputEventArgs e)
        {
            if (isSelected)
            {
                if (e.Key == KeyboardKeys.Enter || e.Key == KeyboardKeys.Return)
                {
                    isSelected = false;
                }
                else if (e.Key == KeyboardKeys.Back)
                {
                    if (SelectedText.Length > 0)
                    {
                        DeleteSelectedText();
                    }
                    else if (Text.Length > 0)
                    {
                        Text = Text.Substring(0, Text.Length - 1);
                    }
                }
                else if (e.Key == KeyboardKeys.Delete)
                {
                    if (SelectedText.Length > 0)
                    {
                        DeleteSelectedText();
                    }
                }
                else if (e.Key == KeyboardKeys.A && e.ModifierKeys == KeyboardKeys.Control)
                {
                    SelectedText = Text;
                    SelectedTextIndex = 0;
                }
                else if (char.IsLetterOrDigit(e.CharacterMapping.Character) ||
                    char.IsLetterOrDigit(e.CharacterMapping.Shifted) ||
                    char.IsSymbol(e.CharacterMapping.Character) ||
                    char.IsSymbol(e.CharacterMapping.Shifted) ||
                    char.IsPunctuation(e.CharacterMapping.Character) ||
                    char.IsPunctuation(e.CharacterMapping.Shifted) ||
                    char.IsWhiteSpace(e.CharacterMapping.Character))
                {
                    if (SelectedText.Length > 0)
                    {
                        ReplaceSelectedText(e.Shift ? e.CharacterMapping.Shifted.ToString() : e.CharacterMapping.Character.ToString());
                        return true;
                    }

                    string prevText = Text;
                    Text = Text + (e.Shift ? e.CharacterMapping.Shifted : e.CharacterMapping.Character);
                    text.SetText(Text);
                    if (text.GetWidth() > width - 8)
                    {
                        text.SetText(prevText);
                        Text = prevText;
                    }
                }
                else if (e.Key == KeyboardKeys.Decimal)
                {
                    if (SelectedText.Length > 0)
                    {
                        ReplaceSelectedText(".");
                        return true;
                    }
                    string prevText = Text;
                    Text = Text + ".";
                    text.SetText(Text);
                    if (text.GetWidth() > width - 8)
                    {
                        text.SetText(prevText);
                        Text = prevText;
                    }
                }
                return true;
            }
            return false;
        }
Beispiel #17
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     if (_windowShowing != null)
     {
         if (!_windowShowing.KeyDown(e))
         {
             if (e.Key == KeyboardKeys.Escape)
             {
                 //Parent window didn't handle escape, so close window
                 //Close the current window
                 CloseWindow();
                 return;
             }
         }
         return;
     }
     if (e.Key == KeyboardKeys.Escape)
     {
         Empire currentEmpire = _gameMain.EmpireManager.CurrentEmpire;
         StarSystem selectedSystem = currentEmpire.SelectedSystem;
         FleetGroup selectedFleetGroup = currentEmpire.SelectedFleetGroup;
         if (selectedFleetGroup != null)
         {
             currentEmpire.SelectedFleetGroup = null;
         }
         if (selectedSystem != null)
         {
             currentEmpire.SelectedSystem = null;
         }
         return;
     }
     if (_gameMain.EmpireManager.CurrentEmpire.SelectedSystem != null)
     {
         if (_systemView.KeyDown(e))
         {
             return;
         }
     }
     if (e.Key == KeyboardKeys.F)
     {
         _showingRadarRange = false;
         _showingFuelRange = !_showingFuelRange;
     }
     if (e.Key == KeyboardKeys.R)
     {
         _showingFuelRange = false;
         _showingRadarRange = !_showingRadarRange;
     }
     if (e.Key == KeyboardKeys.B)
     {
         _showingOwners = !_showingOwners; //This does not affect the other two toggable views since it only changes the stars' color
     }
     if (e.Key == KeyboardKeys.Escape)
     {
         _taskBar.SetToScreen(Screen.InGameMenu);
         ShowInGameMenu();
     }
     if (e.Key == KeyboardKeys.Space)
     {
         _gameMain.ToggleSitRep();
     }
 }
Beispiel #18
0
 public virtual bool KeyDown(KeyboardInputEventArgs e)
 {
     return false;
 }
Beispiel #19
0
 private void remap_input(object sender, KeyboardInputEventArgs e)
 {
     result = (byte)e.MakeCode;
     DialogResult = DialogResult.OK;
     Close();
 }
Beispiel #20
0
        public override bool KeyDown(KeyboardInputEventArgs e)
        {
            if (e.Key == KeyboardKeys.I)
            {
                _showTabbedWindow = !_showTabbedWindow;
                _craftStatus.Text = "Status";
                _craftStatus.Color = Color.White;
                return true;
            }

            return false;
        }
Beispiel #21
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     if (_generatingGalaxy)
     {
         return;
     }
     if (e.Key == KeyboardKeys.Escape)
     {
         if (_showingSelection)
         {
             //Close the race selection
             _showingSelection = false;
             return;
         }
         _gameMain.ChangeToScreen(Screen.MainMenu);
     }
     if (_playerEmperorName.KeyDown(e))
     {
         return;
     }
     if (_playerHomeworldName.KeyDown(e))
     {
         return;
     }
 }
Beispiel #22
0
        void KeyboardInput_Handler(object sender, KeyboardInputEventArgs e)
        {
            if (!_isEnabled) { return; }
            if (e.State == KeyState.Hotkey) { return; }
            if (e.Device == IntPtr.Zero) { return; }

            int keyboard;
            if (!_handleToIndex.TryGetValue(e.Device, out keyboard))
            {
                AddKeyboard(e.Device);
                keyboard = _handleToIndex[e.Device];
            }

            CheckKeyboards();

            int key = (int)e.Key;
            bool isPressed = (e.State == KeyState.Pressed) || (e.State == KeyState.SystemKeyPressed);

            if (key >= 0 && key <= 255 && _keyStates[keyboard, key] != isPressed)
            {
                _keyStates[keyboard, key] = isPressed;

                OnInputReceived(new DigitalInputReceivedEventArgs(this, new Input(Name, _keyboardNames[keyboard], _keyToName[e.Key],
                                                          InputDimensionality.Digital, InputScale.Integer, InputSemantic.Absolute),
                                _keyStates[keyboard, key]));
            }
        }
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     foreach (GuiComponent component in components)
         if (component.KeyDown(e)) return true;
     return false;
 }
Beispiel #24
0
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     if (e.Key == KeyboardKeys.Escape && CloseWindow != null)
     {
         CloseWindow();
         return true;
     }
     return false;
 }
Beispiel #25
0
 public void KeyUp(KeyboardInputEventArgs e)
 {
 }
Beispiel #26
0
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     return false;
 }
Beispiel #27
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     if (e.Key == KeyboardKeys.Escape)
     {
         _gameMain.ExitGame();
     }
 }
Beispiel #28
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     if (_playerNameTextBox.KeyDown(e))
     {
         return;
     }
     if (_ipAddressTextBox.KeyDown(e))
     {
         if (_ipAddressTextBox.Text.Length == 0)
         {
             _hostOrConnectButton.SetText("Host");
             _hostOrConnectButton.Active = true;
         }
         else
         {
             _hostOrConnectButton.SetText("Connect");
             _hostOrConnectButton.Active = IsValidIpAddress();
         }
     }
 }
 public override bool KeyDown(KeyboardInputEventArgs e)
 {
     if (base.KeyDown(e)) return true;
     return false;
 }
Beispiel #30
0
 public void KeyDown(KeyboardInputEventArgs e)
 {
     /*if (e.Key == KeyboardKeys.Escape)
     {
         _gameMain.ChangeToScreen(Screen.Galaxy);
     }
     if (e.Key == KeyboardKeys.Space)
     {
         _gameMain.ToggleSitRep();
     }*/
 }