public void RefreshCurrentPosition(JoystickVerticalPosition newVerticalPosition, JoystickHorizontalPosition newHorizontalPosition, bool newButtonPressedState) { if (newVerticalPosition != currentVerticalPosition) { if (currentVerticalPosition != JoystickVerticalPosition.Center) { computerKeyboard.OnKeyRelease(GetKeyForVerticalPosition()); } currentVerticalPosition = newVerticalPosition; if (newVerticalPosition != JoystickVerticalPosition.Center) { computerKeyboard.OnKeyPress(GetKeyForVerticalPosition()); } } if (newHorizontalPosition != currentHorizontalPosition) { if (currentHorizontalPosition != JoystickHorizontalPosition.Center) { computerKeyboard.OnKeyRelease(GetKeyForHorizontalPosition()); } currentHorizontalPosition = newHorizontalPosition; if (newHorizontalPosition != JoystickHorizontalPosition.Center) { computerKeyboard.OnKeyPress(GetKeyForHorizontalPosition()); } } if (newButtonPressedState != currentButtonPressedState) { if (newButtonPressedState) { computerKeyboard.OnKeyPress(GetKeyForButton()); } else { computerKeyboard.OnKeyRelease(GetKeyForButton()); } currentButtonPressedState = newButtonPressedState; } }