public ButtonInputMap(ButtonState stateToCapture, ButtonSource primarySource, ButtonSource secondarySource = null) { if (primarySource == null) throw new ArgumentException("A button input must have at least the primary source."); this.StateToCapture = stateToCapture; this.PrimarySource = primarySource; this.SecondarySource = secondarySource; }
public ButtonInputMap(ButtonState stateToCapture, ButtonSource primarySource, ButtonSource secondarySource = null) { if (primarySource == null) { throw new ArgumentException("A button input must have at least the primary source."); } this.StateToCapture = stateToCapture; this.PrimarySource = primarySource; this.SecondarySource = secondarySource; }
protected void MapInputsPerMapInButtonSource( ButtonSource buttonSource, Maps map, Dictionary<MappableKeys, HashSet<Maps>> mapsPerKeyboardKey, Dictionary<MouseButton, HashSet<Maps>> mapsPerMouseButton, Dictionary<XboxJoystickButtons, HashSet<Maps>> mapsPerJoystickButton, Dictionary<XboxJoystickDPad, HashSet<Maps>> mapsPerJoystickDPad, Dictionary<MouseAxis, HashSet<Maps>> mapsPerMouseAxis, Dictionary<XboxJoystickAxis, HashSet<Maps>> mapsPerJoystickAxis ) { if (buttonSource == null) return; if (buttonSource.GetType() == typeof(KeyboardButtonSource)) RelateMapWithKeyboardKey(map, mapsPerKeyboardKey, ((KeyboardButtonSource)buttonSource).keyCode); else if (buttonSource.GetType() == typeof(MouseButtonSource)) RelateMapWithMouseButton(map, mapsPerMouseButton, ((MouseButtonSource)buttonSource).button); else if (buttonSource.GetType() == typeof(XboxJoystickAxisAsButtonSource)) RelateMapWithJoystickAxis(map, mapsPerJoystickAxis, ((XboxJoystickAxisAsButtonSource)buttonSource).axis); else if (buttonSource.GetType() == typeof(XboxJoystickButtonSource)) RelateMapWithJoystickButton(map, mapsPerJoystickButton, ((XboxJoystickButtonSource)buttonSource).button); else if (buttonSource.GetType() == typeof(XboxJoystickDPadButtonSource)) RelateMapWithJoystickDPad(map, mapsPerJoystickDPad, ((XboxJoystickDPadButtonSource)buttonSource).button); }