public static DeviceBindingCategory MapCategory(BindingCategory bindingInfoCategory) { switch (bindingInfoCategory) { case BindingCategory.Event: return DeviceBindingCategory.Event; case BindingCategory.Momentary: return DeviceBindingCategory.Momentary; case BindingCategory.Signed: case BindingCategory.Unsigned: return DeviceBindingCategory.Range; case BindingCategory.Delta: return DeviceBindingCategory.Delta; default: throw new ArgumentOutOfRangeException(nameof(bindingInfoCategory), bindingInfoCategory, null); } }
private bool IsInputValid(BindingCategory bindingCategory, int value) { switch (DeviceBinding.MapCategory(bindingCategory)) { case DeviceBindingCategory.Delta: case DeviceBindingCategory.Event: return(true); case DeviceBindingCategory.Momentary: return(value != 0); case DeviceBindingCategory.Range: return(Constants.AxisMaxValue * 0.4 < Math.Abs(value) && Constants.AxisMaxValue * 0.6 > Math.Abs(value)); default: return(false); } }
private bool IsInputValid(BindingCategory bindingCategory, short value) { switch (DeviceBinding.MapCategory(bindingCategory)) { case DeviceBindingCategory.Delta: case DeviceBindingCategory.Event: return(true); case DeviceBindingCategory.Momentary: return(value != 0); case DeviceBindingCategory.Range: var wideVal = Functions.WideAbs(value); return(Constants.AxisMaxValue * 0.4 < wideVal && Constants.AxisMaxValue * 0.6 > wideVal); default: return(false); } }
public static BindingDescriptor GetBindingDescriptor(BindingCategory bindingCategory, int value) { switch (bindingCategory) { case BindingCategory.Momentary: return(new BindingDescriptor() { Index = value, SubIndex = 0, Type = BindingType.Button }); case BindingCategory.Event: return(new BindingDescriptor() { Index = value, SubIndex = 1, Type = BindingType.Button }); case BindingCategory.Signed: case BindingCategory.Unsigned: return(new BindingDescriptor() { Index = value, SubIndex = 0, Type = BindingType.Axis }); case BindingCategory.Delta: return(new BindingDescriptor() { Index = value, SubIndex = 1, Type = BindingType.Axis }); default: throw new ArgumentOutOfRangeException(nameof(bindingCategory), bindingCategory, $"Unable to get BindingDescriptor for category: {bindingCategory}"); } }
private DeviceReportNode BuildOutputNodes(string name, BindingCategory bindingCategory, List <IODescriptor> descriptors) { var bindings = new List <BindingReport>(); foreach (var ioDescriptor in descriptors) { bindings.Add(new BindingReport() { Title = ioDescriptor.Name, Category = bindingCategory, Path = $"{name} > {ioDescriptor.Name}", Blockable = false, BindingDescriptor = EspUtility.GetBindingDescriptor(bindingCategory, ioDescriptor.Value) }); } return(new DeviceReportNode() { Title = name, Bindings = bindings }); }
public IEnumerable <Binding> GetBindingByCategory(BindingCategory categ) { return(new SkillHillRepo <Binding>(new SkiHillDb()).GetElements(x => x.Category == categ)); }