public GamepadButtonAssigner(IGamepad gamepad, float triggerThreshold, bool forStick) { _gamepad = gamepad; _detector = new JoystickButtonDetector(); _forStick = forStick; _gamepad?.SetTriggerThreshold(triggerThreshold); }
private static JoystickButtonDetector AddNewJoystickButtonDetector(string name) { int kIndex = name.IndexOf("k"); int BIndex = name.IndexOf("B"); int nIndex = name.IndexOf("n"); int joystickIndex = Int32.Parse(name.Substring(kIndex + 1, BIndex - kIndex - 1)); int inputIndex = Int32.Parse(name.Substring(nIndex + 1, name.Length - nIndex - 1)); JoystickButtonDetector detector = new JoystickButtonDetector(joystickIndex, inputIndex); joystickButtonDetectors.Add(name, detector); return(detector); }
static InputMapper() { defaultSwitchProControllerMap = new Dictionary <string, InputDetector>(11) { [MOVE_LEFT] = JoystickAxisDetector.ToJoystickAxisDetector("Joystick0Axis0Negative"), [MOVE_RIGHT] = JoystickAxisDetector.ToJoystickAxisDetector("Joystick0Axis0Positive"), [ACCELERATE] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button10"), [JUMP] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button0"), [ATTACK] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button2"), [DODGE] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button1"), [INTERACT] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button3"), [RECOVER] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button7"), [SWITCH_PREV] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button13"), [SWITCH_NEXT] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button14"), [SWITCH_UP] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button11"), [SWITCH_DOWN] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button12"), [SWITCH_CAMERA] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button9"), [PAUSE] = JoystickButtonDetector.ToJoystickButtonDetector("Joystick0Button8") }; defaultKeyboardMap = new Dictionary <string, InputDetector>(11) { [MOVE_LEFT] = KeyDetector.ToKeyDetector("A"), [MOVE_RIGHT] = KeyDetector.ToKeyDetector("D"), [ACCELERATE] = KeyDetector.ToKeyDetector("N"), [JUMP] = KeyDetector.ToKeyDetector("W"), [ATTACK] = KeyDetector.ToKeyDetector("J"), [DODGE] = KeyDetector.ToKeyDetector("K"), [INTERACT] = KeyDetector.ToKeyDetector("U"), [RECOVER] = KeyDetector.ToKeyDetector("F"), [SWITCH_PREV] = KeyDetector.ToKeyDetector("Q"), [SWITCH_NEXT] = KeyDetector.ToKeyDetector("E"), [SWITCH_UP] = KeyDetector.ToKeyDetector("Y"), [SWITCH_DOWN] = KeyDetector.ToKeyDetector("H"), [SWITCH_CAMERA] = KeyDetector.ToKeyDetector("Tab"), [PAUSE] = KeyDetector.ToKeyDetector("Escape") }; }
public JoystickButtonAssigner(int index, double triggerThreshold) { _index = index; _triggerThreshold = triggerThreshold; _detector = new JoystickButtonDetector(); }