本文整理汇总了C++中ULocalPlayer::GetGameLoginOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ ULocalPlayer::GetGameLoginOptions方法的具体用法?C++ ULocalPlayer::GetGameLoginOptions怎么用?C++ ULocalPlayer::GetGameLoginOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ULocalPlayer
的用法示例。
在下文中一共展示了ULocalPlayer::GetGameLoginOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NotifyControlMessage
void UPendingNetGame::NotifyControlMessage(UNetConnection* Connection, uint8 MessageType, class FInBunch& Bunch)
{
check(Connection==NetDriver->ServerConnection);
#if !UE_BUILD_SHIPPING
UE_LOG(LogNet, Verbose, TEXT("PendingLevel received: %s"), FNetControlMessageInfo::GetName(MessageType));
#endif
// This client got a response from the server.
switch (MessageType)
{
case NMT_Upgrade:
// Report mismatch.
uint32 RemoteNetworkVersion;
FNetControlMessage<NMT_Upgrade>::Receive(Bunch, RemoteNetworkVersion);
// Upgrade
ConnectionError = NSLOCTEXT("Engine", "ClientOutdated", "The match you are trying to join is running an incompatible version of the game. Please try upgrading your game version.").ToString();
GEngine->BroadcastNetworkFailure(NULL, NetDriver, ENetworkFailure::OutdatedClient, ConnectionError);
break;
case NMT_Failure:
{
// our connection attempt failed for some reason, for example a synchronization mismatch (bad GUID, etc) or because the server rejected our join attempt (too many players, etc)
// here we can further parse the string to determine the reason that the server closed our connection and present it to the user
FString ErrorMsg;
FNetControlMessage<NMT_Failure>::Receive(Bunch, ErrorMsg);
if (ErrorMsg.IsEmpty())
{
ErrorMsg = NSLOCTEXT("NetworkErrors", "GenericPendingConnectionFailed", "Pending Connection Failed.").ToString();
}
// This error will be resolved in TickWorldTravel()
ConnectionError = ErrorMsg;
// Force close the session
UE_LOG(LogNet, Log, TEXT("NetConnection::Close() [%s] [%s] [%s] from NMT_Failure %s"),
Connection->Driver ? *Connection->Driver->NetDriverName.ToString() : TEXT("NULL"),
Connection->PlayerController ? *Connection->PlayerController->GetName() : TEXT("NoPC"),
Connection->OwningActor ? *Connection->OwningActor->GetName() : TEXT("No Owner"),
*ConnectionError);
Connection->Close();
break;
}
case NMT_Challenge:
{
// Challenged by server.
FNetControlMessage<NMT_Challenge>::Receive(Bunch, Connection->Challenge);
FURL PartialURL(URL);
PartialURL.Host = TEXT("");
PartialURL.Port = PartialURL.UrlConfig.DefaultPort; // HACK: Need to fix URL parsing
for (int32 i = URL.Op.Num() - 1; i >= 0; i--)
{
if (URL.Op[i].Left(5) == TEXT("game="))
{
URL.Op.RemoveAt(i);
}
}
FUniqueNetIdRepl UniqueIdRepl;
ULocalPlayer* LocalPlayer = GEngine->GetFirstGamePlayer(this);
if (LocalPlayer)
{
// Send the player nickname if available
FString OverrideName = LocalPlayer->GetNickname();
if (OverrideName.Len() > 0)
{
PartialURL.AddOption(*FString::Printf(TEXT("Name=%s"), *OverrideName));
}
// Send any game-specific url options for this player
FString GameUrlOptions = LocalPlayer->GetGameLoginOptions();
if (GameUrlOptions.Len() > 0)
{
PartialURL.AddOption(*FString::Printf(TEXT("%s"), *GameUrlOptions));
}
// Send the player unique Id at login
UniqueIdRepl = LocalPlayer->GetPreferredUniqueNetId();
}
Connection->ClientResponse = TEXT("0");
FString URLString(PartialURL.ToString());
FNetControlMessage<NMT_Login>::Send(Connection, Connection->ClientResponse, URLString, UniqueIdRepl);
NetDriver->ServerConnection->FlushNet();
break;
}
case NMT_Welcome:
{
// Server accepted connection.
FString GameName;
FString RedirectURL;
FNetControlMessage<NMT_Welcome>::Receive(Bunch, URL.Map, GameName, RedirectURL);
//GEngine->NetworkRemapPath(this, URL.Map);
//.........这里部分代码省略.........