ELoginStatus::Type FOnlineIdentityAmazon::GetLoginStatus(int32 LocalUserNum) const { TSharedPtr<const FUniqueNetId> UserId = GetUniquePlayerId(LocalUserNum); if (UserId.IsValid()) { return GetLoginStatus(*UserId); } return ELoginStatus::NotLoggedIn; }
virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override { const FKey Key = InKeyEvent.GetKey(); if (Key == EKeys::Enter) { MenuOwner->HandleLoginUIClosed(TSharedPtr<const FUniqueNetId>(), 0); } else if (!MenuOwner->GetControlsLocked() && Key == EKeys::Gamepad_FaceButton_Bottom) { bool bSkipToMainMenu = true; { const auto OnlineSub = IOnlineSubsystem::Get(); if (OnlineSub) { const auto IdentityInterface = OnlineSub->GetIdentityInterface(); if (IdentityInterface.IsValid()) { TSharedPtr<GenericApplication> GenericApplication = FSlateApplication::Get().GetPlatformApplication(); const bool bIsLicensed = GenericApplication->ApplicationLicenseValid(); const auto LoginStatus = IdentityInterface->GetLoginStatus(InKeyEvent.GetUserIndex()); if (LoginStatus == ELoginStatus::NotLoggedIn || !bIsLicensed) { // Show the account picker. const auto ExternalUI = OnlineSub->GetExternalUIInterface(); if (ExternalUI.IsValid()) { ExternalUI->ShowLoginUI(InKeyEvent.GetUserIndex(), false, IOnlineExternalUI::FOnLoginUIClosedDelegate::CreateSP(MenuOwner, &FShooterWelcomeMenu::HandleLoginUIClosed)); bSkipToMainMenu = false; } } } } } if (bSkipToMainMenu) { const auto OnlineSub = IOnlineSubsystem::Get(); if (OnlineSub) { const auto IdentityInterface = OnlineSub->GetIdentityInterface(); if (IdentityInterface.IsValid()) { TSharedPtr<const FUniqueNetId> UserId = IdentityInterface->GetUniquePlayerId(InKeyEvent.GetUserIndex()); // 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->HandleLoginUIClosed(UserId, InKeyEvent.GetUserIndex()); } } } return FReply::Handled(); } return FReply::Unhandled(); }
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(); }
ELoginStatus::Type FOnlineIdentitySteam::GetLoginStatus(const FUniqueNetId& UserId) const { return GetLoginStatus(0); }