コード例 #1
0
        protected override bool OnMouseDown(EMouseButtons button)
        {
            if (base.OnMouseDown(button))
            {
                return(true);
            }
            if (_newJoystickValue != null || _newKeyboardMousevalue != null)
            {
                return(true);
            }
            if (controlItem != null && _oldKeyboardMouseValue != null)
            {
                _newKeyboardMousevalue = new GameControlsManager.SystemKeyboardMouseValue(button)
                {
                    Parent = controlItem
                };
                GameControlsManager.SystemKeyboardMouseValue key;
                if (GameControlsManager.Instance.IsAlreadyBinded(button, out key))
                {
                    _conflictKeyboardMouseValue = key;
                    CreateConfirmDialogue("Mouse button " + button + " is already bound to " + key.Parent.ControlKey + ". Override ? or Click Clear to remove the bind");
                    return(true);
                }
                SetKey();
                SetShouldDetach();
                return(true);
            }

            return(false);
        }
コード例 #2
0
 protected override bool OnMouseWheel(int delta)
 {
     if (base.OnMouseWheel(delta))
     {
         return(true);
     }
     if (_newJoystickValue != null || _newKeyboardMousevalue != null)
     {
         return(true);
     }
     if (controlItem != null && _oldKeyboardMouseValue != null)
     {
         var scrollDirection = delta > 0 ? MouseScroll.ScrollUp : MouseScroll.ScrollDown;
         _newKeyboardMousevalue = new GameControlsManager.SystemKeyboardMouseValue(scrollDirection)
         {
             Parent = controlItem
         };                                                                                                                  //Incin -- test delta on scroll strength
         GameControlsManager.SystemKeyboardMouseValue key;
         if (GameControlsManager.Instance.IsAlreadyBinded(scrollDirection, out key))
         {
             _conflictKeyboardMouseValue = key;
             CreateConfirmDialogue("Mouse scroll " + scrollDirection + " is already bound to " + key.Parent.ControlKey + ". Override? or Click Clear to remove the bind");
             return(true);
         }
         SetKey();
         SetShouldDetach();
         return(true);
     }
     return(false);
 }
コード例 #3
0
        protected override bool OnKeyDown(KeyEvent e)
        {
            if (base.OnKeyDown(e))
            {
                return(true);
            }
            if (_newJoystickValue != null || _newKeyboardMousevalue != null)
            {
                return(true);
            }
            if (e.Key == EKeys.Escape)
            {
                SetShouldDetach();
                return(true);
            }

            if (controlItem != null && _oldKeyboardMouseValue != null)
            {
                //Incin =--= Order Due, Follow Command bind wizard list, order of succession
                //Selected Strength 1st
                //bool commandbound = checkCommandConflict(controlItem.ControlKey);
                _newKeyboardMousevalue = new GameControlsManager.SystemKeyboardMouseValue(e.Key)
                {
                    Parent = controlItem
                };
                GameControlsManager.SystemKeyboardMouseValue key;
                //if (commandbound && _conflictCommand != null)
                //{
                //    CreateConfirmDialogue("Command " + _conflictCommand.ControlKey.ToString() + " is already bound to " + key.Parent.ControlKey + ". Override ?, or Click Clear to remove the bind");
                //    return true;
                //}
                //else
                if (GameControlsManager.Instance.IsAlreadyBinded(e.Key, out key))
                {
                    _conflictKeyboardMouseValue = key;
                    CreateConfirmDialogue("Key " + e.Key + " is already bound to " + key.Parent.ControlKey + ". Override ?, or Click Clear to remove the bind");
                    return(true);
                }

                //wizard? if selecected strentgh not same, and another key
                SetKey();
                SetShouldDetach();
                return(true);
            }

            return(false);
        }
コード例 #4
0
        public KeyListener(object sender)
        {
            var list = sender as ListBox;

            var keybordvalue = list.SelectedItem as GameControlsManager.SystemKeyboardMouseValue;

            if (keybordvalue != null)
            {
                _oldKeyboardMouseValue = keybordvalue;
                controlItem            = keybordvalue.Parent;
            }
            var joystickvalue = list.SelectedItem as GameControlsManager.SystemJoystickValue;

            if (joystickvalue != null)
            {
                _oldJoystickValue = joystickvalue;
                controlItem       = joystickvalue.Parent;
            }
        }
コード例 #5
0
        /// <summary>
        /// Process pressed key in order to bind it
        /// </summary>
        protected override bool OnKeyDown(KeyEvent e)
        {
            if (base.OnKeyDown(e))
            {
                return(true);
            }
            //new key allready detected
            if (_newJoystickValue != null || _newKeyboardMousevalue != null)
            {
                return(true);
            }

            if (e.Key == EKeys.Escape)
            {
                SetShouldDetach();
                return(true);
            }

            if (controlItem != null && _oldKeyboardMouseValue != null)
            {
                _newKeyboardMousevalue = new GameControlsManager.SystemKeyboardMouseValue(e.Key)
                {
                    Parent = controlItem
                };
                GameControlsManager.SystemKeyboardMouseValue key;
                if (GameControlsManager.Instance.IsAlreadyBinded(e.Key, out key))
                {
                    _conflictKeyboardMouseValue = key;
                    CreateConfirmDialogue("Key " + e.Key + " is already bound to " + key.Parent.ControlKey + ". Override ?, or Click Clear to remove the bind");

                    return(true);
                }
                SetKey();
                SetShouldDetach();
                return(true);
            }

            return(false);
        }
コード例 #6
0
        //private GameControlsManager.GameControlItem _selected_strength;

        public KeyListener(object sender)
        {
            //try{CommandBindingWindow.Listener(as Listener)
            //{ catch {CommandBindingWindow.Listener(as Listener)}};

            MouseCover = true;
            var list = sender as ListBox;

            var keybordvalue = list.SelectedItem as GameControlsManager.SystemKeyboardMouseValue;

            if (keybordvalue != null)
            {
                _oldKeyboardMouseValue = keybordvalue;
                controlItem            = keybordvalue.Parent;
            }
            var joystickvalue = list.SelectedItem as GameControlsManager.SystemJoystickValue;

            if (joystickvalue != null)
            {
                _oldJoystickValue = joystickvalue;
                controlItem       = joystickvalue.Parent;
            }
        }