예제 #1
0
        internal static IEnumerable <ControllerInputBinding> createButtonLootBindings(Buttons buttons)
        {
            ControllerInputBinding addResult = new ControllerInputBinding();

            addResult.button      = buttons;
            addResult.buttonState = ControllerButtonState.WhileDown;

            MouseButtonCommand newCommand = new MouseButtonCommand();

            newCommand.mouseButton    = System.Windows.Forms.MouseButtons.Left;
            newCommand.commandState   = ButtonState.Down;
            newCommand.target         = CommandTarget.CenterRandom;
            newCommand.applicableMode = InputMode.Move;
            addResult.commands.Add(newCommand);

            newCommand                = new MouseButtonCommand();
            newCommand.mouseButton    = System.Windows.Forms.MouseButtons.Left;
            newCommand.commandState   = ButtonState.Up;
            newCommand.target         = CommandTarget.CenterRandom;
            newCommand.applicableMode = InputMode.Move;
            addResult.commands.Add(newCommand);

            return(new ControllerInputBinding[1] {
                addResult
            });
        }
예제 #2
0
        /// <summary>
        /// createButtonKeyBindings creates two new binding and command sets, which directly maps a controller button to a mouse button.
        /// Given mouse button is signalled as down when the button is down, and up when the button is up.
        /// </summary>
        /// <param name="buttons">Controller button to bind</param>
        /// <param name="mouseButtons">Mouse button to bind</param>
        /// <param name="applicableMode">Which input mode in which this binding is active - all modes by default.</param>
        /// <param name="target">Indicates if the mouse button should be pressed with the mouse cursor at a particular location (cursorPosition, reticulePosition, or none)</param>
        /// <returns></returns>
        internal static ControllerInputBinding[] createMouseButtonBindings(Buttons button, System.Windows.Forms.MouseButtons mouseButton, InputMode applicableMode = InputMode.All, CommandTarget target = CommandTarget.None, ControllerButtonState cbState = ControllerButtonState.WhileDown)
        {
            ControllerInputBinding downResult = new ControllerInputBinding();

            downResult.button      = button;
            downResult.buttonState = cbState;
            MouseButtonCommand newCommand = new MouseButtonCommand();

            newCommand.mouseButton    = mouseButton;
            newCommand.commandState   = ButtonState.Down;
            newCommand.applicableMode = applicableMode;
            newCommand.target         = target;
            downResult.commands.Add(newCommand);


            ControllerInputBinding upResult = new ControllerInputBinding();

            upResult                  = new ControllerInputBinding();
            upResult.button           = button;
            upResult.buttonState      = ControllerButtonState.OnUp;
            newCommand                = new MouseButtonCommand();
            newCommand.mouseButton    = mouseButton;
            newCommand.commandState   = ButtonState.Up;
            newCommand.applicableMode = applicableMode;
            newCommand.target         = target;
            upResult.commands.Add(newCommand);

            return(new ControllerInputBinding[2] {
                downResult, upResult
            });
        }