void UOnlineSessionClient::OnDestroyForJoinSessionComplete(FName SessionName, bool bWasSuccessful) { UE_LOG(LogOnline, Verbose, TEXT("OnDestroyForJoinSessionComplete %s bSuccess: %d"), *SessionName.ToString(), bWasSuccessful); IOnlineSessionPtr SessionInt = GetSessionInt(); if (SessionInt.IsValid()) { SessionInt->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroyForJoinSessionCompleteDelegateHandle); } if (bWasSuccessful) { JoinSession(SessionName, CachedSessionResult); } bHandlingDisconnect = false; }
void UOnlineSessionClient::OnDestroyForMainMenuComplete(FName SessionName, bool bWasSuccessful) { UE_LOG(LogOnline, Verbose, TEXT("OnDestroyForMainMenuComplete %s bSuccess: %d"), *SessionName.ToString(), bWasSuccessful); IOnlineSessionPtr SessionInt = GetSessionInt(); if (SessionInt.IsValid()) { SessionInt->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroyForMainMenuCompleteDelegateHandle); } UWorld* World = GetWorld(); UNetDriver* NetDriver = World ? World->GetNetDriver() : nullptr; // Call disconnect to force us back to the menu level GEngine->HandleDisconnect(World, NetDriver); bHandlingDisconnect = false; }
void UtrnetDemoGameInstance::OnDestroySessionComplete(FName SessionName, bool bWasSuccessful) { GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString::Printf(TEXT("OnDestroySessionComplete %s, %d"), *SessionName.ToString(), bWasSuccessful)); // Get the SessionInterface from the OnlineSubsystem IOnlineSessionPtr Sessions = GetSession(); if (!Sessions.IsValid()) { return; } // Clear the Delegate Sessions->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroySessionCompleteDelegateHandle); // If it was successful, we just load another level (could be a MainMenu!) if (bWasSuccessful) { UGameplayStatics::OpenLevel(GetWorld(), "Startup", true); } }
// Destroy Session And return to Start Map void URadeGameInstance::OnDestroySessionComplete(FName SessionName, bool bWasSuccessful) { // Get the OnlineSubsystem we want to work with IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get(); if (OnlineSub) { // Get the SessionInterface from the OnlineSubsystem IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface(); if (Sessions.IsValid()) { // Clear the Delegate Sessions->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroySessionCompleteDelegateHandle); // If it was successful, we just load another level (could be a MainMenu!) if (bWasSuccessful) { UGameplayStatics::OpenLevel(GetWorld(), "SelectMap", true); } } } }