コード例 #1
0
        private String WriteGamepadButtonInputConfiguration(IButtonInput input, String name)
        {
            if (input is KeyboardKeyInput keyboard)
            {
                var    enumValue   = (KeyboardKeyCode)keyboard.KeyCode;
                String stringValue = enumValue.ToString() == "0" ? "" : enumValue.ToString();

                return($"{name} = {stringValue}");
            }
            else if (input is KeyboardMacroInput keyboardMacro)
            {
                var    enumValue   = keyboardMacro.Macro;
                String stringValue = enumValue.ToString() == "0" ? "" : enumValue.ToString();

                return($"{name} = {stringValue}");
            }
            else if (input is MouseKeyInput mouse)
            {
                var    enumValue   = (MouseKeyCode)mouse.KeyCode;
                String stringValue = enumValue.ToString() == "0" ? "" : enumValue.ToString();

                return($"{name} = {stringValue}");
            }
            else if (input is MouseMacroInput mouseMacro)
            {
                var    enumValue   = mouseMacro.Macro;
                String stringValue = enumValue.ToString() == "0" ? "" : enumValue.ToString();

                return($"{name} = {stringValue}");
            }
            else
            {
                return("");
            }
        }
コード例 #2
0
        public InputComponent(Dictionary <Buttons, InputAction> buttonMappings, IButtonInput buttonInput, params IMovementComponent[] movementComponent)
        {
            _buttonMappings = buttonMappings;

            Contract.Assert(movementComponent != null, "InputComponent has a dependency on the MovementComponent");
            _movementComponent = movementComponent;
            _buttonInput       = buttonInput;
        }
コード例 #3
0
 public void AddButtonInput(IButtonInput buttonInput)
 {
     if (this.buttonInputs == null)
     {
         this.buttonInputs    = new IButtonInput[1];
         this.buttonInputs[0] = buttonInput;
     }
     else
     {
         System.Array.Resize(ref this.buttonInputs, this.buttonInputs.Length + 1);
         this.buttonInputs[this.buttonInputs.Length - 1] = buttonInput;
     }
 }
コード例 #4
0
    // Token: 0x06000EB2 RID: 3762 RVA: 0x0005B598 File Offset: 0x00059798
    private bool KeyboardUsedLast(IButtonInput iButtonInput)
    {
        if (iButtonInput is KeyCodeButtonInput)
        {
            return(true);
        }
        AxisButtonInput axisButtonInput = iButtonInput as AxisButtonInput;

        if (axisButtonInput != null)
        {
            return(this.KeyboardUsedLast(axisButtonInput.GetAxisInput()));
        }
        CompoundButtonInput compoundButtonInput = iButtonInput as CompoundButtonInput;

        if (compoundButtonInput != null)
        {
            return(this.KeyboardUsedLast(compoundButtonInput.GetLastPressed()));
        }
        return(iButtonInput is ControllerButtonInput && false);
    }
コード例 #5
0
 public ButtonEventHandler GetGamepadButtonEvent(IButtonInput input, KeyBindings keyBindings, Gamepad gamepad, Mouse mouse, Keyboard keyboard)
 {
     if (input is MouseKeyInput)
     {
         return(MouseEventHandler(input as MouseKeyInput, mouse));
     }
     else if (input is MouseMacroInput)
     {
         return(MouseMacroEventHandler(input as MouseMacroInput));
     }
     else if (input is KeyboardKeyInput)
     {
         return(KeyboardEventHandler(input as KeyboardKeyInput, keyboard));
     }
     else if (input is KeyboardMacroInput)
     {
         return(KeyboardMacroEventHandler(input as KeyboardMacroInput, gamepad, keyboard));
     }
     else
     {
         return(null);
     }
 }
コード例 #6
0
 public KeyboardAndMouseInputProvider()
 {
     this.triggerButtonInput = new CTriggerButtonInput();
     this.button1Input       = new CButton1Input();
     this.button2Input       = new CButton2Input();
 }