当前位置: 首页>>代码示例>>C++>>正文


C++ APlayerController::ClientTravel方法代码示例

本文整理汇总了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());
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:33,代码来源:OnlineSessionClient.cpp

示例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;
			}
		}
	}
	

	
}
开发者ID:xzessmedia,项目名称:SteamFriendsUE4,代码行数:32,代码来源:NetGameInstance.cpp

示例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;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:21,代码来源:GameSession.cpp

示例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;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:22,代码来源:GameModeBase.cpp


注:本文中的APlayerController::ClientTravel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。