private void Awake() { analogChildren = GetComponentsInChildren <RectTransform>(); rawImage = GetComponent <RawImage>(); if (analogChildren != null && analogChildren.Length > 0) { analogControls = analogChildren[1].gameObject.GetComponent <AnalogControls>(); } }
private static PadSchema AnalogController(int controller) { var controllerDefRanges = new AnalogControls(controller).Definition.FloatRanges; return(new PadSchema { IsConsole = false, DefaultSize = new Size(280, 380), Buttons = new[] { new PadSchema.ButtonSchema { Name = $"P{controller} Button 1", DisplayName = "1", Location = new Point(74, 34), Type = PadSchema.PadInputType.Boolean }, new PadSchema.ButtonSchema { Name = $"P{controller} Button 2", DisplayName = "2", Location = new Point(98, 34), Type = PadSchema.PadInputType.Boolean }, new PadSchema.ButtonSchema { Name = $"P{controller} Button 3", DisplayName = "3", Location = new Point(122, 34), Type = PadSchema.PadInputType.Boolean }, new PadSchema.ButtonSchema { Name = $"P{controller} Button 4", DisplayName = "4", Location = new Point(146, 34), Type = PadSchema.PadInputType.Boolean }, new PadSchema.ButtonSchema { Name = $"P{controller} Stick X", Location = new Point(2, 80), AxisRange = controllerDefRanges[0], SecondaryAxisRange = controllerDefRanges[1], Type = PadSchema.PadInputType.AnalogStick, SecondaryNames = new[] { $"P{controller} Stick Y", } } } }); }
private static PadSchema AnalogController(int controller) { var defAxes = new AnalogControls(controller).Definition.Axes; return(new PadSchema { Size = new Size(280, 300), Buttons = new PadSchemaControl[] { Button(74, 34, controller, 1), Button(98, 34, controller, 2), Button(122, 34, controller, 3), Button(146, 34, controller, 4), new AnalogSchema(2, 80, $"P{controller} Stick X") { Spec = defAxes.SpecAtIndex(0), SecondarySpec = defAxes.SpecAtIndex(1) } } }); }
private static PadSchema AnalogController(int controller) { var controllerDefRanges = new AnalogControls(controller).Definition.AxisRanges; return(new PadSchema { Size = new Size(280, 300), Buttons = new PadSchemaControl[] { Button(74, 34, controller, 1), Button(98, 34, controller, 2), Button(122, 34, controller, 3), Button(146, 34, controller, 4), new AnalogSchema(2, 80, $"P{controller} Stick X") { AxisRange = controllerDefRanges[0], SecondaryAxisRange = controllerDefRanges[1] } } }); }