本文整理汇总了C++中FUniqueNetIdRepl::ToDebugString方法的典型用法代码示例。如果您正苦于以下问题:C++ FUniqueNetIdRepl::ToDebugString方法的具体用法?C++ FUniqueNetIdRepl::ToDebugString怎么用?C++ FUniqueNetIdRepl::ToDebugString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FUniqueNetIdRepl
的用法示例。
在下文中一共展示了FUniqueNetIdRepl::ToDebugString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandlePlayerLogout
void APartyBeaconHost::HandlePlayerLogout(const FUniqueNetIdRepl& PlayerId)
{
if (PlayerId.IsValid())
{
UE_LOG(LogBeacon, Verbose, TEXT("HandlePlayerLogout %s"), *PlayerId->ToDebugString());
if (State)
{
if (State->RemovePlayer(PlayerId))
{
ReservationChanged.ExecuteIfBound();
}
}
}
}
示例2: HandlePlayerLogout
void APartyBeaconHost::HandlePlayerLogout(const FUniqueNetIdRepl& PlayerId)
{
if (PlayerId.IsValid())
{
UE_LOG(LogBeacon, Verbose, TEXT("HandlePlayerLogout %s"), *PlayerId->ToDebugString());
if (State)
{
if (State->RemovePlayer(PlayerId))
{
SendReservationUpdates();
NotifyReservationEventNextFrame(ReservationChanged);
}
}
}
}
示例3: HandlePlayerLogout
void APartyBeaconHost::HandlePlayerLogout(const FUniqueNetIdRepl& PlayerId)
{
if (PlayerId.IsValid())
{
bool bWasRemoved = false;
UE_LOG(LogBeacon, Verbose, TEXT("HandlePlayerLogout %s"), *PlayerId->ToDebugString());
for (int32 ResIdx=0; ResIdx < Reservations.Num(); ResIdx++)
{
FPartyReservation& Reservation = Reservations[ResIdx];
// find the player in an existing reservation slot
for (int32 PlayerIdx=0; PlayerIdx < Reservation.PartyMembers.Num(); PlayerIdx++)
{
FPlayerReservation& PlayerEntry = Reservation.PartyMembers[PlayerIdx];
if (PlayerEntry.UniqueId == PlayerId)
{
// player removed
Reservation.PartyMembers.RemoveAtSwap(PlayerIdx--);
bWasRemoved = true;
// free up a consumed entry
NumConsumedReservations--;
}
}
// remove the entire party reservation slot if no more party members
if (Reservation.PartyMembers.Num() == 0)
{
Reservations.RemoveAtSwap(ResIdx--);
}
if (bWasRemoved)
{
ReservationChanged.ExecuteIfBound();
break;
}
}
}
}
示例4: NotifyControlMessage
void AOnlineBeaconHost::NotifyControlMessage(UNetConnection* Connection, uint8 MessageType, class FInBunch& Bunch)
{
if(NetDriver->ServerConnection == nullptr)
{
bool bCloseConnection = false;
// We are the server.
#if !(UE_BUILD_SHIPPING && WITH_EDITOR)
UE_LOG(LogBeacon, Verbose, TEXT("%s[%s] Host received: %s"), *GetName(), Connection ? *Connection->GetName() : TEXT("Invalid"), FNetControlMessageInfo::GetName(MessageType));
#endif
switch (MessageType)
{
case NMT_Hello:
{
UE_LOG(LogBeacon, Log, TEXT("Beacon Hello"));
uint8 IsLittleEndian;
uint32 RemoteNetworkVersion = 0;
uint32 LocalNetworkVersion = FNetworkVersion::GetLocalNetworkVersion();
FNetControlMessage<NMT_Hello>::Receive(Bunch, IsLittleEndian, RemoteNetworkVersion);
if (!FNetworkVersion::IsNetworkCompatible(LocalNetworkVersion, RemoteNetworkVersion))
{
UE_LOG(LogBeacon, Log, TEXT("Client not network compatible %s"), *Connection->GetName());
FNetControlMessage<NMT_Upgrade>::Send(Connection, LocalNetworkVersion);
bCloseConnection = true;
}
else
{
Connection->Challenge = FString::Printf(TEXT("%08X"), FPlatformTime::Cycles());
FNetControlMessage<NMT_BeaconWelcome>::Send(Connection);
Connection->FlushNet();
}
break;
}
case NMT_Netspeed:
{
int32 Rate;
FNetControlMessage<NMT_Netspeed>::Receive(Bunch, Rate);
Connection->CurrentNetSpeed = FMath::Clamp(Rate, 1800, NetDriver->MaxClientRate);
UE_LOG(LogBeacon, Log, TEXT("Client netspeed is %i"), Connection->CurrentNetSpeed);
break;
}
case NMT_BeaconJoin:
{
FString ErrorMsg;
FString BeaconType;
FUniqueNetIdRepl UniqueId;
FNetControlMessage<NMT_BeaconJoin>::Receive(Bunch, BeaconType, UniqueId);
UE_LOG(LogBeacon, Log, TEXT("Beacon Join %s %s"), *BeaconType, *UniqueId.ToDebugString());
if (Connection->ClientWorldPackageName == NAME_None)
{
AOnlineBeaconClient* ClientActor = GetClientActor(Connection);
if (ClientActor == nullptr)
{
UWorld* World = GetWorld();
Connection->ClientWorldPackageName = World->GetOutermost()->GetFName();
AOnlineBeaconClient* NewClientActor = nullptr;
FOnBeaconSpawned* OnBeaconSpawnedDelegate = OnBeaconSpawnedMapping.Find(BeaconType);
if (OnBeaconSpawnedDelegate && OnBeaconSpawnedDelegate->IsBound())
{
NewClientActor = OnBeaconSpawnedDelegate->Execute(Connection);
}
if (NewClientActor && BeaconType == NewClientActor->GetBeaconType())
{
NewClientActor->SetConnectionState(EBeaconConnectionState::Pending);
FNetworkGUID NetGUID = Connection->Driver->GuidCache->AssignNewNetGUID_Server(NewClientActor);
NewClientActor->SetNetConnection(Connection);
Connection->PlayerId = UniqueId;
Connection->OwningActor = NewClientActor;
NewClientActor->Role = ROLE_Authority;
NewClientActor->SetReplicates(false);
check(NetDriverName == NetDriver->NetDriverName);
NewClientActor->SetNetDriverName(NetDriverName);
ClientActors.Add(NewClientActor);
FNetControlMessage<NMT_BeaconAssignGUID>::Send(Connection, NetGUID);
}
else
{
ErrorMsg = NSLOCTEXT("NetworkErrors", "BeaconSpawnFailureError", "Join failure, Couldn't spawn beacon.").ToString();
}
}
else
{
ErrorMsg = NSLOCTEXT("NetworkErrors", "BeaconSpawnExistingActorError", "Join failure, existing beacon actor.").ToString();
}
}
else
{
ErrorMsg = NSLOCTEXT("NetworkErrors", "BeaconSpawnClientWorldPackageNameError", "Join failure, existing ClientWorldPackageName.").ToString();
}
if (!ErrorMsg.IsEmpty())
{
UE_LOG(LogBeacon, Log, TEXT("%s: %s"), *Connection->GetName(), *ErrorMsg);
//.........这里部分代码省略.........