Example #1
0
        private void HandleKeyUp(string message, int keyCode)
        {
            // if (stopKeyInput == true)
            //     return;
            if (keyCode == 20)
            {
                this.Invoke(new Action(() =>
                {
                    StopAllAction();
                }));
            }
            else if (GameInput.Windows2DirectXInputs.ContainsKey(keyCode))
            {
                Keyboard.DirectXKeyStrokes key = GameInput.Windows2DirectXInputs[keyCode];
                // CAP LOCK PRESS

                if (KeyDownLog.ContainsKey(key) && KeyDownLog[key] > 0)
                {
                    // KeyDownLog.Remove(key) ;
                    KeyDownLog[key] = 0;

                    // System.Console.Beep();
#if DEBUG
                    Console.WriteLine("----- External key up Pressed--------" + key.ToString());
#endif
                    //Keyboard.SendKey(key, Keyboard.KEY_UP, Keyboard.InputType.Keyboard);
                }
            }
        }
Example #2
0
        private void HandleKeyDown(string message, int keyCode)
        {
            // if (stopKeyInput == true)
            //   return;

            if (GameInput.Windows2DirectXInputs.ContainsKey(keyCode))
            {
                Keyboard.DirectXKeyStrokes key = GameInput.Windows2DirectXInputs[keyCode];

                if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] <= 0)
                {
                    KeyDownLog[key] = 1;

                    if (GVCommand.gvSetup.gameName == "FORNITE")
                    {
                        Keyboard.DirectXKeyStrokes okey = GVCommand.KeySwitchPairing(key);
                        if (okey != Keyboard.DirectXKeyStrokes.DIK_NULL)
                        {
                            SimulateKeyUp(okey);
                        }
                    }

                    //  System.Console.Beep();
#if DEBUG
                    Console.WriteLine("----- External key down Pressed--------" + key.ToString());
#endif
                    //  Keyboard.SendKey(key, Keyboard.KEY_DOWN, Keyboard.InputType.Keyboard);
                }
            }
        }
Example #3
0
        private void SaveKeybinds()
        {
            //set keybind data
            enginePowerKey     = (Keyboard.DirectXKeyStrokes)enginePowerKeybind.SelectedItem;
            weaponPowerKey     = (Keyboard.DirectXKeyStrokes)weaponPowerKeybind.SelectedItem;
            shieldPowerKey     = (Keyboard.DirectXKeyStrokes)shieldPowerKeybind.SelectedItem;
            balancePowerKey    = (Keyboard.DirectXKeyStrokes)balancePowerKeybind.SelectedItem;
            counterKey         = (Keyboard.DirectXKeyStrokes)countermeasureKeybind.SelectedItem;
            forwardShieldKey   = (Keyboard.DirectXKeyStrokes)forwardShieldKeybind.SelectedItem;
            rearShieldKey      = (Keyboard.DirectXKeyStrokes)rearShieldKeybind.SelectedItem;
            balanceShieldKey   = (Keyboard.DirectXKeyStrokes)balanceShieldKeybind.SelectedItem;
            cycleTargetsKey    = (Keyboard.DirectXKeyStrokes)cycleKeybind.SelectedItem;
            targetAttackerKey  = (Keyboard.DirectXKeyStrokes)targetAttackerKeybind.SelectedItem;
            targetAlliesKey    = (Keyboard.DirectXKeyStrokes)targetAlliesKeybind.SelectedItem;
            targetHostilesKey  = (Keyboard.DirectXKeyStrokes)targetHostilesKeybind.SelectedItem;
            targetSystemsKey   = (Keyboard.DirectXKeyStrokes)targetSystemsKeybind.SelectedItem;
            targetAIKey        = (Keyboard.DirectXKeyStrokes)targetAIKeybind.SelectedItem;
            targetsFollowerKey = (Keyboard.DirectXKeyStrokes)targetsFollowerKeybind.SelectedItem;
            targetMissilesKey  = (Keyboard.DirectXKeyStrokes)targetMissilesKeybind.SelectedItem;
            pingKey            = (Keyboard.DirectXKeyStrokes)pingKeybind.SelectedItem;
            acknowledgeKey     = (Keyboard.DirectXKeyStrokes)acknowledgeKeybind.SelectedItem;
            modKey             = (Keyboard.DirectXKeyStrokes)modKeyKeybind.SelectedItem;

            //save to application settings file
            Properties.Settings.Default.enginePowerKey  = enginePowerKey.ToString();
            Properties.Settings.Default.weaponPowerKey  = weaponPowerKey.ToString();
            Properties.Settings.Default.shieldPowerKey  = shieldPowerKey.ToString();
            Properties.Settings.Default.balancePowerKey = balancePowerKey.ToString();
            Properties.Settings.Default.counterKey      = counterKey.ToString();
            Properties.Settings.Default.fShieldKey      = forwardShieldKey.ToString();
            Properties.Settings.Default.rShieldKey      = rearShieldKey.ToString();
            Properties.Settings.Default.bShieldKey      = balanceShieldKey.ToString();

            Properties.Settings.Default.cycleKey    = cycleTargetsKey.ToString();
            Properties.Settings.Default.attackerKey = targetAttackerKey.ToString();
            Properties.Settings.Default.alliesKey   = targetAlliesKey.ToString();
            Properties.Settings.Default.hostilesKey = targetHostilesKey.ToString();
            Properties.Settings.Default.systemsKey  = targetSystemsKey.ToString();
            Properties.Settings.Default.AIKey       = targetAIKey.ToString();
            Properties.Settings.Default.followerKey = targetsFollowerKey.ToString();
            Properties.Settings.Default.missileKey  = targetMissilesKey.ToString();
            Properties.Settings.Default.pingKey     = pingKey.ToString();
            Properties.Settings.Default.ackKey      = acknowledgeKey.ToString();
            Properties.Settings.Default.modKey      = modKey.ToString();
            Properties.Settings.Default.Save();

            changesMade = false;
            MessageBox.Show("Keybinds saved.");
        }
Example #4
0
        private void SimulateKeyDown(Keyboard.DirectXKeyStrokes key)
        {
            if (stopKeyInput == true)
            {
                return;
            }

            if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] <= 0)
            {
#if DEBUG
                Console.WriteLine("----- SimulateKeyDown--------" + key.ToString());
#endif
                Keyboard.SendKey(key, Keyboard.KEY_DOWN);
                //KeyDownLog[key] = 1;
            }
        }
Example #5
0
        private void SimulateKeyUp(Keyboard.DirectXKeyStrokes key)
        {
            if (stopKeyInput == true)
            {
                return;
            }

            if (KeyDownLog.ContainsKey(key) && KeyDownLog[key] > 0)
            {
#if DEBUG
                Console.WriteLine("----- SimulateKeyUp--------" + key.ToString());
#endif
                Keyboard.SendKey(key, Keyboard.KEY_UP);
                //KeyDownLog.Remove(key);
            }
        }
Example #6
0
        private void SimulateKeyPress(Keyboard.DirectXKeyStrokes key)
        {
            if (stopKeyInput == true)
            {
                return;
            }

            if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] == 0)
            {
#if DEBUG
                Console.WriteLine("----- SimulateKeyPress--------" + key.ToString());
#endif
                Keyboard.SendKey(key, Keyboard.KEY_DOWN);
                System.Threading.Thread.Sleep(Properties.Settings.Default.KeyPressSpeed);
                Keyboard.SendKey(key, Keyboard.KEY_UP);
            }
        }
Example #7
0
        // The opposing keys that must be release e.g LEFT - RIGHT key are mutually exclusive.
        // TODO: This should be defined in the XML, as this is hardcoded to handle specific keys
        //       which is wrong.
        //       Should use the action name not the key input e.g. "MOVE RIGHT", "MOVE LEFT"
        public static Keyboard.DirectXKeyStrokes KeySwitchPairing(Keyboard.DirectXKeyStrokes key)
        {
            Keyboard.DirectXKeyStrokes okey = Keyboard.DirectXKeyStrokes.DIK_NULL;
            string c = key.ToString();
            string o = "";

            c = c.Replace("DIK_", "");

            switch (c)
            {
            case "A": o = "D"; break;

            case "D": o = "A"; break;

            case "S": o = "W"; break;
            }

            if (GameInput.Inputs.ContainsKey(o))
            {
                okey = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[o];
            }

            return(okey);
        }