Esempio n. 1
0
	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();
	}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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;
}
int32 UKismetInputLibrary::ControllerEvent_GetUserIndex(const FControllerEvent& Input)
{
	return Input.GetUserIndex();
}