private void BroadcastDigitalGamepadEvents(InputDevice device, int userIndex) { var startInput = new ZMInput(device.MenuWasPressed, userIndex); var startArgs = new ZMInputEventArgs(startInput); Notifier.SendEventNotification(OnAction1, GetInputForControl(device.Action1, userIndex)); Notifier.SendEventNotification(OnAction2, GetInputForControl(device.Action2, userIndex)); Notifier.SendEventNotification(OnAction3, GetInputForControl(device.Action3, userIndex)); Notifier.SendEventNotification(OnAction4, GetInputForControl(device.Action4, userIndex)); Notifier.SendEventNotification(OnLeftBumper, GetInputForControl(device.LeftBumper, userIndex)); Notifier.SendEventNotification(OnLeftTrigger, GetInputForControl(device.LeftTrigger, userIndex)); Notifier.SendEventNotification(OnRightBumper, GetInputForControl(device.RightBumper, userIndex)); Notifier.SendEventNotification(OnRightTrigger, GetInputForControl(device.RightTrigger, userIndex)); Notifier.SendEventNotification(OnLeftAnalogStickButton, GetInputForControl(device.LeftStickButton, userIndex)); Notifier.SendEventNotification(OnRightAnalogStickButton, GetInputForControl(device.RightStickButton, userIndex)); Notifier.SendEventNotification(OnAnyButton, GetInputForControl(device.AnyButton, userIndex)); Notifier.SendEventNotification(OnAnyButton, GetInputForControl(device.LeftBumper, userIndex)); Notifier.SendEventNotification(OnAnyButton, GetInputForControl(device.LeftTrigger, userIndex)); Notifier.SendEventNotification(OnAnyButton, GetInputForControl(device.RightBumper, userIndex)); Notifier.SendEventNotification(OnAnyButton, GetInputForControl(device.RightTrigger, userIndex)); Notifier.SendEventNotification(OnAnyButton, startArgs); Notifier.SendEventNotification(OnStartButton, startArgs); }
private ZMInputEventArgs GetInputForControl(InputControl control, int userIndex) { var state = GetStateForControl(control); var input = new ZMInput(state, userIndex); var args = new ZMInputEventArgs(input); return(args); }
private void BroadcastAnalogGamepadEvents(InputDevice device, int userIndex) { var input = new ZMInput(ZMInput.State.HELD, userIndex); var args = new ZMInputVector2EventArgs(Vector2.zero, input); var floatArgs = new ZMInputFloatEventArgs(input, 0); args.value = device.LeftStick.Vector; Notifier.SendEventNotification(OnLeftAnalogStickMove, args); args.value = device.RightStick.Vector; Notifier.SendEventNotification(OnRightAnalogStickMove, args); args.value = device.DPad.Vector; Notifier.SendEventNotification(OnDirectionalPadMove, args); floatArgs.value = device.RightTrigger.Value; Notifier.SendEventNotification(OnRightTriggerAnalog, floatArgs); floatArgs.value = device.LeftTrigger.Value; Notifier.SendEventNotification(OnLeftTriggerAnalog, floatArgs); }
// Should be overridden if used. protected virtual bool IsValidInputControl(ZMInput input) { return(input.ID == _playerInfo.ID); }
public ZMInputFloatEventArgs(ZMInput inputParam, float valueParam) { input = inputParam; value = valueParam; }
public ZMInputVector2EventArgs(Vector2 valueParam, ZMInput inputParam) { input = inputParam; value = valueParam; }
public ZMInputEventArgs(ZMInput inputParam) { input = inputParam; }
public ZMPlayerInfoInputEventArgs(ZMPlayerInfo playerInfo, ZMInput inputParam) { info = playerInfo; input = inputParam; }
protected override bool IsValidInputControl(ZMInput input) { return(IsValidInputControl(input.ID)); }
protected override bool IsValidInputControl(ZMInput input) { return(input.ID == -1 || input.ID == _playerInfo.ID); }