public ActionResult SetDeadzone(string id, InputDeviceMethod method, int offset, [FromBody] double deadzone) { var device = inputDeviceManager.FindInputDevice(id); if (device == null) { return(NotFound("Device not found")); } var inputDevice = device.FindInput(method); if (inputDevice == null) { return(NotFound("Input device method not found")); } var source = inputDevice.FindSource(offset); if (source == null) { return(NotFound("ForceFeedback target not found")); } inputDeviceManager.ChangeInputConfiguration(id, method, (inputDevice) => { var config = inputDevice.InputConfiguration.Sources.FirstOrDefault(s => s.Offset == offset); if (config == null) { config = new InputSourceConfig { Offset = offset, }; inputDevice.InputConfiguration.Sources.Add(config); } config.Deadzone = deadzone; }); return(NoContent()); }
public void SetForceFeedback(InputDeviceMethod method, int offset, double value) { var target = FindInput(method)?.FindTarget(offset); if (target != null) { target.Value = value; } }
public bool RemoveInput(InputDeviceMethod method) { if (devices.ContainsKey(method)) { devices.Remove(method); Disconnected?.Invoke(this, new DeviceDisconnectedEventArgs(devices[method])); } return(!devices.Any()); }
public void SetInput(InputDeviceMethod method, IInputDevice device) { if (devices.ContainsKey(method)) { Disconnected?.Invoke(this, new DeviceDisconnectedEventArgs(devices[method])); } devices[method] = device; Connected?.Invoke(this, new DeviceConnectedEventArgs(devices[method])); }
public bool ChangeInputConfiguration(string id, InputDeviceMethod method, Action <InputConfig> configuration) { var inputDevice = FindInputDevice(id)?.FindInput(method); if (inputDevice == null) { return(false); } configuration(inputDevice.InputConfiguration); inputConfigManager.SaveConfig(inputDevice); return(true); }
public ActionResult StopForceFeedback(string id, InputDeviceMethod method) { var inputDevice = inputDeviceManager.FindInputDevice(id); if (inputDevice == null) { return(NotFound("Device not found")); } var target = inputDevice.FindInput(method); if (target == null) { return(NotFound("Input device not found")); } target.Stop(); return(NoContent()); }
public ForceFeedbackTarget FindTarget(InputDeviceMethod method, int offset) { return(FindInput(method)?.FindTarget(offset)); }
public InputSource FindSource(InputDeviceMethod method, int offset) { return(FindInput(method)?.FindSource(offset)); }
public bool RemoveInput(InputDeviceMethod method) { devices.Remove(method); return(!devices.Any()); }
public void SetInput(InputDeviceMethod method, IInputDevice device) { devices[method] = device; }
public IInputDevice FindInput(InputDeviceMethod method) { return(devices[method]); }
void updateLastUsedInputDevice(InputDeviceMethod inputDevice) { gameObject.SetActive(inputDevice == this.inputDevice); }
public IInputDevice FindInputDevice(string id, InputDeviceMethod method) { return(FindInputDevice(id)?.FindInput(method)); }