本文整理汇总了C++中ULocalPlayer::GetUniqueNetId方法的典型用法代码示例。如果您正苦于以下问题:C++ ULocalPlayer::GetUniqueNetId方法的具体用法?C++ ULocalPlayer::GetUniqueNetId怎么用?C++ ULocalPlayer::GetUniqueNetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ULocalPlayer
的用法示例。
在下文中一共展示了ULocalPlayer::GetUniqueNetId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InformAboutRing_Implementation
void ATimeIsUpPlayerState::InformAboutRing_Implementation(class ATimeIsUpPlayerState* PlayerState) {
/* Search for the player */
for (FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; ++It) {
ATimeIsUpPlayerController *TestPC = Cast<ATimeIsUpPlayerController>(*It);
if (TestPC) {
ULocalPlayer *LocalPlayer = Cast<ULocalPlayer>(TestPC->Player);
TSharedPtr<FUniqueNetId> LocalID = LocalPlayer->GetUniqueNetId();
if (LocalID.IsValid() && *LocalPlayer->GetUniqueNetId() == *PlayerState->UniqueId) {
TestPC->OnRingGet();
}
}
}
}
示例2: OnDeathMessage
void AShooterPlayerController::OnDeathMessage(class AShooterPlayerState* KillerPlayerState, class AShooterPlayerState* KilledPlayerState, const UDamageType* KillerDamageType)
{
AShooterHUD* ShooterHUD = GetShooterHUD();
if (ShooterHUD)
{
ShooterHUD->ShowDeathMessage(KillerPlayerState, KilledPlayerState, KillerDamageType);
}
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
if (LocalPlayer && LocalPlayer->GetUniqueNetId().IsValid() && KilledPlayerState->UniqueId.IsValid())
{
// if this controller is the player who died, update the hero stat.
if (*LocalPlayer->GetUniqueNetId() == *KilledPlayerState->UniqueId)
{
const auto Events = Online::GetEventsInterface();
const auto Identity = Online::GetIdentityInterface();
if (Events.IsValid() && Identity.IsValid())
{
int32 UserIndex = LocalPlayer->ControllerId;
TSharedPtr<FUniqueNetId> UniqueID = Identity->GetUniquePlayerId(UserIndex);
if (UniqueID.IsValid())
{
ACharacter* Pawn = GetCharacter();
check(Pawn);
FVector Location = Pawn->GetActorLocation();
FOnlineEventParms Params;
Params.Add( TEXT( "SectionId" ), FVariantData( (int32)1 ) );
Params.Add( TEXT( "GameplayModeId" ), FVariantData( (int32)1 ) );
Params.Add( TEXT( "DifficultyLevelId" ), FVariantData( (int32)0 ) );
Params.Add( TEXT( "PlayerRoleId" ), FVariantData( (int32)0 ) );
Params.Add( TEXT( "PlayerWeaponId" ), FVariantData( (int32)0 ) );
Params.Add( TEXT( "EnemyRoleId" ), FVariantData( (int32)0 ) );
Params.Add( TEXT( "EnemyWeaponId" ), FVariantData( (int32)0 ) );
Params.Add( TEXT( "LocationX" ), FVariantData( Location.X ) );
Params.Add( TEXT( "LocationY" ), FVariantData( Location.Y ) );
Params.Add( TEXT( "LocationZ" ), FVariantData( Location.Z ) );
Events->TriggerEvent(*UniqueID, TEXT("PlayerDeath"), Params);
}
}
}
}
}