本文整理汇总了C++中APlayerController::ClientTravel方法的典型用法代码示例。如果您正苦于以下问题:C++ APlayerController::ClientTravel方法的具体用法?C++ APlayerController::ClientTravel怎么用?C++ APlayerController::ClientTravel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APlayerController
的用法示例。
在下文中一共展示了APlayerController::ClientTravel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnJoinSessionComplete
/**
* Delegate fired when the joining process for an online session has completed
*
* @param SessionName the name of the session this callback is for
* @param bWasSuccessful true if the async action completed without error, false if there was an error
*/
void UOnlineSessionClient::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
{
UE_LOG(LogOnline, Verbose, TEXT("OnJoinSessionComplete %s bSuccess: %d"), *SessionName.ToString(), static_cast<int32>(Result));
SessionInt->ClearOnJoinSessionCompleteDelegate(OnJoinSessionCompleteDelegate);
if (Result == EOnJoinSessionCompleteResult::Success)
{
FString URL;
if (SessionInt->GetResolvedConnectString(SessionName, URL))
{
APlayerController* PC = GetPlayerController();
if (PC)
{
if (bIsFromInvite)
{
URL += TEXT("?bIsFromInvite");
bIsFromInvite = false;
}
PC->ClientTravel(URL, TRAVEL_Absolute);
}
}
else
{
UE_LOG(LogOnline, Warning, TEXT("Failed to join session %s"), *SessionName.ToString());
}
}
}
示例2: OnCompleted
void UNetGameInstance::OnCompleted(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
{
APlayerController* PC = GetWorld()->GetFirstPlayerController();
FFrame::KismetExecutionMessage(TEXT("Yeeee Join succesful"), ELogVerbosity::Warning);
auto Sessions = Online::GetSessionInterface();
if (Sessions.IsValid())
{
Sessions->ClearOnJoinSessionCompleteDelegate(Delegate);
if (Result == EOnJoinSessionCompleteResult::Success)
{
// Client travel to the server
FString ConnectString;
if (Sessions->GetResolvedConnectString(GameSessionName, ConnectString) && PC->IsValidLowLevel())
{
//UE_LOG(Network, Log, TEXT("Join session: traveling to %s"), *ConnectString);
PC->ClientTravel(ConnectString, TRAVEL_Absolute);
return;
}
}
}
}
示例3: TravelToSession
bool AGameSession::TravelToSession(int32 ControllerId, FName InSessionName)
{
UWorld* World = GetWorld();
FString URL;
if (UOnlineEngineInterface::Get()->GetResolvedConnectString(World, InSessionName, URL))
{
APlayerController* PC = UGameplayStatics::GetPlayerController(World, ControllerId);
if (PC)
{
PC->ClientTravel(URL, TRAVEL_Absolute);
return true;
}
}
else
{
UE_LOG(LogGameSession, Warning, TEXT("Failed to resolve session connect string for %s"), *InSessionName.ToString());
}
return false;
}
示例4: ProcessClientTravel
APlayerController* AGameModeBase::ProcessClientTravel(FString& FURL, FGuid NextMapGuid, bool bSeamless, bool bAbsolute)
{
// We call PreClientTravel directly on any local PlayerPawns (ie listen server)
APlayerController* LocalPlayerController = nullptr;
for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator)
{
APlayerController* PlayerController = *Iterator;
if (Cast<UNetConnection>(PlayerController->Player) != nullptr)
{
// Remote player
PlayerController->ClientTravel(FURL, TRAVEL_Relative, bSeamless, NextMapGuid);
}
else
{
// Local player
LocalPlayerController = PlayerController;
PlayerController->PreClientTravel(FURL, bAbsolute ? TRAVEL_Absolute : TRAVEL_Relative, bSeamless);
}
}
return LocalPlayerController;
}