private void OnJoystickPressEvent(int xxx, int yyy, int zzz, JoystickButtonType btt) { if (JoystickPressEvent != null) { JoystickPressEvent(null, new JoystickPressEventArgs(xxx, yyy, zzz, btt)); } }
public JoystickPressEventArgs(int xx, int yy, int zz, JoystickButtonType btt) { this.X = xx; this.Y = yy; this.Z = zz; ButtonType = btt; }
private static void JoystickService_JoystickPressEvent(object sender, JoystickPressEventArgs args) { //保存当前按钮状态 if (SuperObject.Config.CurrentGoType == GoType.Joy && args.ButtonType != JoystickButtonType.None) { if (args.ButtonType == JoystickButtonType.MiddleCenter) { if (LastJoystickButtonType != JoystickButtonType.TopLeft && LastJoystickButtonType != JoystickButtonType.TopCenter && LastJoystickButtonType != JoystickButtonType.TopRight && LastJoystickButtonType != JoystickButtonType.MiddleLeft && LastJoystickButtonType != JoystickButtonType.MiddleRight && LastJoystickButtonType != JoystickButtonType.BottomLeft && LastJoystickButtonType != JoystickButtonType.BottomCenter && LastJoystickButtonType != JoystickButtonType.MiddleRight) { return; } } if (LastJoystickButtonType == args.ButtonType) { return; } LastJoystickButtonType = args.ButtonType; TaskService.Request(TaskActionType.Joy, args.ButtonType); } #region 向ConfigUI界面中的手柄测试界面传递按键指令 if (MainUIObj != null) { if (MainUIObj.IsHandleCreated) { MainUIObj.Invoke(new MethodInvoker(delegate() { if (ConfigUIObj != null) { ConfigUIObj.JoystickStateInfo.ProcessorJoystickButtons(args); } })); } } #endregion }
/// <summary> /// ボタンの状態を種類から取得します。 /// </summary> /// <param name="joystickIndex">検索するジョイスティックのインデックス</param> /// <param name="type">状態を検索するボタンの種類</param> /// <returns>指定種類のボタンの状態</returns> public ButtonState GetButtonState(int joystickIndex, JoystickButtonType type) => (ButtonState)cbg_Joystick_GetButtonStateByType(selfPtr, joystickIndex, (int)type);
private void OnJoystickPressEvent(JoystickButtonType bttt) { OnJoystickPressEvent(0, 0, 0, bttt); }