protected override void FinishSetup(InputControlSetup setup) { var buttons = new List <ButtonControl>(); var axes = new List <AxisControl>(); FindControlsRecursive(this, buttons, x => !(x.parent is StickControl) && !(x.parent is DpadControl)); FindControlsRecursive(this, axes, x => !(x is ButtonControl)); if (buttons.Count > 0) { m_Buttons = buttons.ToArray(); } if (axes.Count > 0) { m_Axes = axes.ToArray(); } // Mandatory controls. trigger = setup.GetControl <ButtonControl>("{PrimaryTrigger}"); stick = setup.GetControl <StickControl>("{Primary2DMotion}"); // Optional controls. twist = setup.TryGetControl <AxisControl>("{Twist}"); hat = setup.TryGetControl <DpadControl>("{Hatswitch}"); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { x = setup.GetControl <AxisControl>(this, "x"); y = setup.GetControl <AxisControl>(this, "y"); z = setup.GetControl <AxisControl>(this, "z"); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { xButton = setup.GetControl <ButtonControl>(this, "buttonWest"); yButton = setup.GetControl <ButtonControl>(this, "buttonNorth"); aButton = setup.GetControl <ButtonControl>(this, "buttonSouth"); bButton = setup.GetControl <ButtonControl>(this, "buttonEast"); startButton = setup.GetControl <ButtonControl>(this, "start"); selectButton = setup.GetControl <ButtonControl>(this, "select"); leftStickButton = setup.GetControl <ButtonControl>(this, "leftStickPress"); rightStickButton = setup.GetControl <ButtonControl>(this, "rightStickPress"); dpad = setup.GetControl <DpadControl>(this, "dpad"); leftShoulder = setup.GetControl <ButtonControl>(this, "leftShoulder"); rightShoulder = setup.GetControl <ButtonControl>(this, "rightShoulder"); leftStick = setup.GetControl <StickControl>(this, "leftStick"); rightStick = setup.GetControl <StickControl>(this, "rightStick"); leftTrigger = setup.GetControl <ButtonControl>(this, "leftTrigger"); rightTrigger = setup.GetControl <ButtonControl>(this, "rightTrigger"); leftMotor = setup.GetControl <AxisControl>(this, "leftMotor"); rightMotor = setup.GetControl <AxisControl>(this, "rightMotor"); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { scroll = setup.GetControl <Vector2Control>(this, "scroll"); leftButton = setup.GetControl <ButtonControl>(this, "leftButton"); middleButton = setup.GetControl <ButtonControl>(this, "middleButton"); rightButton = setup.GetControl <ButtonControl>(this, "rightButton"); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { up = setup.GetControl <ButtonControl>(this, "up"); down = setup.GetControl <ButtonControl>(this, "down"); left = setup.GetControl <ButtonControl>(this, "left"); right = setup.GetControl <ButtonControl>(this, "right"); base.FinishSetup(setup); }
internal bool m_ConfigUpToDate; // The device resets this when its configuration changes. // This method exists only to not slap the internal modifier on all overrides of // FinishSetup(). internal void CallFinishSetupRecursive(InputControlSetup setup) { for (var i = 0; i < m_ChildrenReadOnly.Count; ++i) { m_ChildrenReadOnly[i].CallFinishSetupRecursive(setup); } FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { position = setup.GetControl <Vector3Control>(this, "position"); rotation = setup.GetControl <QuaternionControl>(this, "rotation"); velocity = setup.GetControl <Vector3Control>(this, "velocity"); angularVelocity = setup.GetControl <Vector3Control>(this, "angularVelocity"); acceleration = setup.GetControl <Vector3Control>(this, "acceleration"); angularAcceleration = setup.GetControl <Vector3Control>(this, "angularAcceleration"); base.FinishSetup(setup); }
//needs to enforce layout/format protected override void FinishSetup(InputControlSetup setup) { touchId = setup.GetControl <DiscreteControl>(this, "touchId"); position = setup.GetControl <Vector2Control>(this, "position"); delta = setup.GetControl <Vector2Control>(this, "delta"); pressure = setup.GetControl <AxisControl>(this, "pressure"); radius = setup.GetControl <Vector2Control>(this, "radius"); phase = setup.GetControl <DiscreteControl>(this, "phase"); displayIndex = setup.GetControl <DiscreteControl>(this, "displayIndex"); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { position = setup.GetControl <Vector2Control>(this, "position"); delta = setup.GetControl <Vector2Control>(this, "delta"); tilt = setup.GetControl <Vector2Control>(this, "tilt"); radius = setup.GetControl <Vector2Control>(this, "radius"); pressure = setup.GetControl <AxisControl>(this, "pressure"); twist = setup.GetControl <AxisControl>(this, "twist"); pointerId = setup.GetControl <DiscreteControl>(this, "pointerId"); phase = setup.GetControl <DiscreteControl>(this, "phase"); displayIndex = setup.GetControl <DiscreteControl>(this, "displayIndex"); button = setup.GetControl <ButtonControl>(this, "button"); base.FinishSetup(setup); }
private static int ResolveModifiers(string modifierString, ref List <ModifierState> modifiers) { ////REVIEW: We're piggybacking off the processor parsing here as the two syntaxes are identical. Might consider //// moving the logic to a shared place. //// Alternatively, may split the paths. May help in getting rid of unnecessary allocations. var firstModifierIndex = modifiers != null ? modifiers.Count : 0; ////TODO: get rid of the extra array allocations here var list = InputTemplate.ParseNameAndParameterList(modifierString); for (var i = 0; i < list.Length; ++i) { // Look up modifier. var type = InputSystem.TryGetModifier(list[i].name); if (type == null) { throw new Exception(string.Format( "No modifier with name '{0}' (mentioned in '{1}') has been registered", list[i].name, modifierString)); } // Instantiate it. var modifier = Activator.CreateInstance(type) as IInputActionModifier; if (modifier == null) { throw new Exception(string.Format("Modifier '{0}' is not an IInputActionModifier", list[i].name)); } // Pass parameters to it. InputControlSetup.SetParameters(modifier, list[i].parameters); // Add to list. if (modifiers == null) { modifiers = new List <ModifierState>(); } modifiers.Add(new ModifierState { modifier = modifier, phase = InputAction.Phase.Waiting }); } return(firstModifierIndex); }
protected override void FinishSetup(InputControlSetup setup) { var touchArray = new TouchControl[TouchscreenState.kMaxTouches]; touchArray[0] = setup.GetControl <TouchControl>(this, "touch0"); touchArray[1] = setup.GetControl <TouchControl>(this, "touch1"); touchArray[2] = setup.GetControl <TouchControl>(this, "touch2"); touchArray[3] = setup.GetControl <TouchControl>(this, "touch3"); touchArray[4] = setup.GetControl <TouchControl>(this, "touch4"); touchArray[5] = setup.GetControl <TouchControl>(this, "touch5"); touchArray[6] = setup.GetControl <TouchControl>(this, "touch6"); touchArray[7] = setup.GetControl <TouchControl>(this, "touch7"); touchArray[8] = setup.GetControl <TouchControl>(this, "touch8"); touchArray[9] = setup.GetControl <TouchControl>(this, "touch9"); touches = new ReadOnlyArray <TouchControl>(touchArray); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { pose = setup.GetControl <PoseControl>("pose"); base.FinishSetup(setup); }
protected override void FinishSetup(InputControlSetup setup) { any = setup.GetControl <AnyKeyControl>("AnyKey"); space = setup.GetControl <KeyControl>("Space"); enter = setup.GetControl <KeyControl>("Enter"); tab = setup.GetControl <KeyControl>("Tab"); backquote = setup.GetControl <KeyControl>("Backquote"); quote = setup.GetControl <KeyControl>("Quote"); semicolon = setup.GetControl <KeyControl>("Semicolon"); comma = setup.GetControl <KeyControl>("Comma"); period = setup.GetControl <KeyControl>("Period"); slash = setup.GetControl <KeyControl>("Slash"); backslash = setup.GetControl <KeyControl>("Backslash"); leftBracket = setup.GetControl <KeyControl>("LeftBracket"); rightBracket = setup.GetControl <KeyControl>("RightBracket"); minus = setup.GetControl <KeyControl>("Minus"); equals = setup.GetControl <KeyControl>("Equals"); a = setup.GetControl <KeyControl>("A"); b = setup.GetControl <KeyControl>("B"); c = setup.GetControl <KeyControl>("C"); d = setup.GetControl <KeyControl>("D"); e = setup.GetControl <KeyControl>("E"); f = setup.GetControl <KeyControl>("F"); g = setup.GetControl <KeyControl>("G"); h = setup.GetControl <KeyControl>("H"); i = setup.GetControl <KeyControl>("I"); j = setup.GetControl <KeyControl>("J"); k = setup.GetControl <KeyControl>("K"); l = setup.GetControl <KeyControl>("L"); m = setup.GetControl <KeyControl>("M"); n = setup.GetControl <KeyControl>("N"); o = setup.GetControl <KeyControl>("O"); p = setup.GetControl <KeyControl>("P"); q = setup.GetControl <KeyControl>("Q"); r = setup.GetControl <KeyControl>("R"); s = setup.GetControl <KeyControl>("S"); t = setup.GetControl <KeyControl>("T"); u = setup.GetControl <KeyControl>("U"); v = setup.GetControl <KeyControl>("V"); w = setup.GetControl <KeyControl>("W"); x = setup.GetControl <KeyControl>("X"); y = setup.GetControl <KeyControl>("Y"); z = setup.GetControl <KeyControl>("Z"); digit1 = setup.GetControl <KeyControl>("1"); digit2 = setup.GetControl <KeyControl>("2"); digit3 = setup.GetControl <KeyControl>("3"); digit4 = setup.GetControl <KeyControl>("4"); digit5 = setup.GetControl <KeyControl>("5"); digit6 = setup.GetControl <KeyControl>("6"); digit7 = setup.GetControl <KeyControl>("7"); digit8 = setup.GetControl <KeyControl>("8"); digit9 = setup.GetControl <KeyControl>("9"); digit0 = setup.GetControl <KeyControl>("0"); leftShift = setup.GetControl <KeyControl>("LeftShift"); rightShift = setup.GetControl <KeyControl>("RightShift"); leftAlt = setup.GetControl <KeyControl>("LeftAlt"); rightAlt = setup.GetControl <KeyControl>("RightAlt"); leftCtrl = setup.GetControl <KeyControl>("LeftCtrl"); rightCtrl = setup.GetControl <KeyControl>("RightCtrl"); leftMeta = setup.GetControl <KeyControl>("LeftMeta"); rightMeta = setup.GetControl <KeyControl>("RightMeta"); leftWindows = setup.GetControl <KeyControl>("LeftWindows"); rightWindows = setup.GetControl <KeyControl>("RightWindows"); leftApple = setup.GetControl <KeyControl>("LeftApple"); rightApple = setup.GetControl <KeyControl>("RightApple"); leftCommand = setup.GetControl <KeyControl>("LeftCommand"); rightCommand = setup.GetControl <KeyControl>("RightCommand"); contextMenu = setup.GetControl <KeyControl>("ContextMenu"); escape = setup.GetControl <KeyControl>("Escape"); leftArrow = setup.GetControl <KeyControl>("LeftArrow"); rightArrow = setup.GetControl <KeyControl>("RightArrow"); upArrow = setup.GetControl <KeyControl>("UpArrow"); downArrow = setup.GetControl <KeyControl>("DownArrow"); backspace = setup.GetControl <KeyControl>("Backspace"); pageDown = setup.GetControl <KeyControl>("PageDown"); pageUp = setup.GetControl <KeyControl>("PageUp"); home = setup.GetControl <KeyControl>("Home"); end = setup.GetControl <KeyControl>("End"); insert = setup.GetControl <KeyControl>("Insert"); delete = setup.GetControl <KeyControl>("Delete"); numpadEnter = setup.GetControl <KeyControl>("NumpadEnter"); numpadDivide = setup.GetControl <KeyControl>("NumpadDivide"); numpadMultiply = setup.GetControl <KeyControl>("NumpadMultiply"); numpadPlus = setup.GetControl <KeyControl>("NumpadPlus"); numpadMinus = setup.GetControl <KeyControl>("NumpadMinus"); numpadPeriod = setup.GetControl <KeyControl>("NumpadPeriod"); numpadEquals = setup.GetControl <KeyControl>("NumpadEquals"); numpad0 = setup.GetControl <KeyControl>("Numpad0"); numpad1 = setup.GetControl <KeyControl>("Numpad1"); numpad2 = setup.GetControl <KeyControl>("Numpad2"); numpad3 = setup.GetControl <KeyControl>("Numpad3"); numpad4 = setup.GetControl <KeyControl>("Numpad4"); numpad5 = setup.GetControl <KeyControl>("Numpad5"); numpad6 = setup.GetControl <KeyControl>("Numpad6"); numpad7 = setup.GetControl <KeyControl>("Numpad7"); numpad8 = setup.GetControl <KeyControl>("Numpad8"); numpad9 = setup.GetControl <KeyControl>("Numpad9"); f1 = setup.GetControl <KeyControl>("F1"); f2 = setup.GetControl <KeyControl>("F2"); f3 = setup.GetControl <KeyControl>("F3"); f4 = setup.GetControl <KeyControl>("F4"); f5 = setup.GetControl <KeyControl>("F5"); f6 = setup.GetControl <KeyControl>("F6"); f7 = setup.GetControl <KeyControl>("F7"); f8 = setup.GetControl <KeyControl>("F8"); f9 = setup.GetControl <KeyControl>("F9"); f10 = setup.GetControl <KeyControl>("F10"); f11 = setup.GetControl <KeyControl>("F11"); f12 = setup.GetControl <KeyControl>("F12"); capsLock = setup.GetControl <KeyControl>("CapsLock"); numLock = setup.GetControl <KeyControl>("NumLock"); scrollLock = setup.GetControl <KeyControl>("ScrollLock"); printScreen = setup.GetControl <KeyControl>("PrintScreen"); pause = setup.GetControl <KeyControl>("Pause"); oem1 = setup.GetControl <KeyControl>("OEM1"); oem2 = setup.GetControl <KeyControl>("OEM2"); oem3 = setup.GetControl <KeyControl>("OEM3"); oem4 = setup.GetControl <KeyControl>("OEM4"); oem5 = setup.GetControl <KeyControl>("OEM5"); ////REVIEW: Ideally, we'd have a way to do this through templates; this way nested key controls could work, too, //// and it just seems somewhat dirty to jam the data into the control here // Assign key code to all keys. for (var key = 1; key < (int)Key.Count; ++key) { this[(Key)key].keyCode = (Key)key; } base.FinishSetup(setup); }
// Set up of the control has been finalized. This can be used, for example, to look up // child controls for fast access. // NOTE: This function will be called repeatedly in case the setup is changed repeatedly. protected virtual void FinishSetup(InputControlSetup setup) { }