/// <summary> /// 捕获控制器数据 /// </summary> private void Update() { try { var joys = curJoystick.GetCurrentState(); // 摇杆 if (RockerData == null || !Enumerable.SequenceEqual(RockerData, joys.PointOfViewControllers)) { RockerData = joys.PointOfViewControllers; RockerChange?.Invoke(RockerData); } // 按钮 if (ButtonData == null || !Enumerable.SequenceEqual(ButtonData, joys.Buttons)) { ButtonData = joys.Buttons; ButtonChange?.Invoke(ButtonData); } } catch (Exception) { BreakOffGamepad(); } }
private void onChange() { ButtonChange?.Invoke(this, CanUndo(), CanRedo()); }