FReply FSceneViewport::OnControllerButtonReleased( const FGeometry& MyGeometry, const FControllerEvent& ControllerEvent ) { // Start a new reply state CurrentReplyState = FReply::Handled(); KeyStateMap.Add( ControllerEvent.GetEffectingButton(), false ); if( ViewportClient ) { // Switch to the viewport clients world before processing input FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient ); if( !ViewportClient->InputKey( this, ControllerEvent.GetUserIndex(), ControllerEvent.GetEffectingButton(), IE_Released, 1.0f, true ) ) { CurrentReplyState = FReply::Unhandled(); } } return CurrentReplyState; }
FReply FSceneViewport::OnControllerAnalogValueChanged( const FGeometry& MyGeometry, const FControllerEvent& ControllerEvent ) { // Start a new reply state CurrentReplyState = FReply::Handled(); KeyStateMap.Add( ControllerEvent.GetEffectingButton(), true ); if( ViewportClient ) { // Switch to the viewport clients world before processing input FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient ); if (!ViewportClient->InputAxis(this, ControllerEvent.GetUserIndex(), ControllerEvent.GetEffectingButton(), ControllerEvent.GetEffectingButton() == EKeys::Gamepad_RightY ? -ControllerEvent.GetAnalogValue() : ControllerEvent.GetAnalogValue(), FApp::GetDeltaTime(), 1, true)) { CurrentReplyState = FReply::Unhandled(); } } return CurrentReplyState; }
virtual FReply OnControllerButtonPressed( const FGeometry& MyGeometry, const FControllerEvent& ControllerEvent ) override { const FKey Key = ControllerEvent.GetEffectingButton(); if (Key == EKeys::Gamepad_FaceButton_Bottom) { bool bSkipToMainMenu = true; const auto OnlineSub = IOnlineSubsystem::Get(); if(OnlineSub) { const auto IdentityInterface = OnlineSub->GetIdentityInterface(); if(IdentityInterface.IsValid()) { const auto LoginStatus = IdentityInterface->GetLoginStatus(ControllerEvent.GetUserIndex()); if(LoginStatus == ELoginStatus::NotLoggedIn) { // Show the account picker. const auto ExternalUI = OnlineSub->GetExternalUIInterface(); if(ExternalUI.IsValid()) { ExternalUI->ShowLoginUI(ControllerEvent.GetUserIndex(), false, IOnlineExternalUI::FOnLoginUIClosedDelegate::CreateSP(MenuOwner, &FShooterWelcomeMenu::HandleLoginUIClosed)); bSkipToMainMenu = false; } } } } if(bSkipToMainMenu) { // If we couldn't show the external login UI for any reason, or if the user is // already logged in, just advance to the main menu immediately. MenuOwner->SetControllerAndAdvanceToMainMenu(ControllerEvent.GetUserIndex()); } return FReply::Handled(); } return FReply::Unhandled(); }
float UKismetInputLibrary::ControllerEvent_GetAnalogValue(const FControllerEvent& Input) { return Input.GetAnalogValue(); }
int32 UKismetInputLibrary::ControllerEvent_GetUserIndex(const FControllerEvent& Input) { return Input.GetUserIndex(); }
FKey UKismetInputLibrary::ControllerEvent_GetEffectingButton(const FControllerEvent& Input) { return Input.GetEffectingButton(); }