示例#1
0
    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);
    }
示例#2
0
    private ZMInputEventArgs GetInputForControl(InputControl control, int userIndex)
    {
        var state = GetStateForControl(control);
        var input = new ZMInput(state, userIndex);
        var args  = new ZMInputEventArgs(input);

        return(args);
    }
示例#3
0
    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);
    }
示例#4
0
 // Should be overridden if used.
 protected virtual bool IsValidInputControl(ZMInput input)
 {
     return(input.ID == _playerInfo.ID);
 }
示例#5
0
 public ZMInputFloatEventArgs(ZMInput inputParam, float valueParam)
 {
     input = inputParam;
     value = valueParam;
 }
示例#6
0
 public ZMInputVector2EventArgs(Vector2 valueParam, ZMInput inputParam)
 {
     input = inputParam;
     value = valueParam;
 }
示例#7
0
 public ZMInputEventArgs(ZMInput inputParam)
 {
     input = inputParam;
 }
示例#8
0
 public ZMPlayerInfoInputEventArgs(ZMPlayerInfo playerInfo, ZMInput inputParam)
 {
     info  = playerInfo;
     input = inputParam;
 }
示例#9
0
 protected override bool IsValidInputControl(ZMInput input)
 {
     return(IsValidInputControl(input.ID));
 }
示例#10
0
 protected override bool IsValidInputControl(ZMInput input)
 {
     return(input.ID == -1 || input.ID == _playerInfo.ID);
 }