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


C++ ULocalPlayer::GetUniqueNetId方法代码示例

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

示例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);
				}
			}
		}
	}	
}
开发者ID:rob422lou,项目名称:Perdix,代码行数:47,代码来源:ShooterPlayerController.cpp


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