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


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

本文整理汇总了C++中ULocalPlayer::GetCachedUniqueNetId方法的典型用法代码示例。如果您正苦于以下问题:C++ ULocalPlayer::GetCachedUniqueNetId方法的具体用法?C++ ULocalPlayer::GetCachedUniqueNetId怎么用?C++ ULocalPlayer::GetCachedUniqueNetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ULocalPlayer的用法示例。


在下文中一共展示了ULocalPlayer::GetCachedUniqueNetId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InformAboutKill_Implementation

void ALPlayerState::InformAboutKill_Implementation(class ALPlayerState* KillerPlayerState, const UDamageType* KillerDamageType, class ALPlayerState* KilledPlayerState)
{
	// id can be null for bots
	if (KillerPlayerState->UniqueId.IsValid())
	{
		// Search for actual killer before calling OnKill()
		for (FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; It++)
		{
			ALPlayerController* TestPC = Cast<ALPlayerController>(*It);
			if (TestPC && TestPC->IsLocalController())
			{
				// a local player may not have an ID if it was create with CreateDebugPlayer
				ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(TestPC->Player);
				TSharedPtr<FUniqueNetId> LocalID = LocalPlayer->GetCachedUniqueNetId();
				if (LocalID.IsValid() && *LocalPlayer->GetCachedUniqueNetId() == *KillerPlayerState->UniqueId)
				{
					//TestPC->OnKill();
				}
			}
		}
	}
}
开发者ID:mukund-dh,项目名称:Labyrinth,代码行数:22,代码来源:LPlayerState.cpp

示例2: HandleControllerPairingChanged

void UAmethystGameInstance::HandleControllerPairingChanged(int GameUserIndex, const FUniqueNetId& PreviousUser, const FUniqueNetId& NewUser)
{
	if (CurrentState == AmethystGameInstanceState::WelcomeScreen)
	{
		// Don't care about pairing changes at welcome screen
		return;
	}

#if Amethyst_CONSOLE_UI && PLATFORM_XBOXONE
	if (IgnorePairingChangeForControllerId != -1 && GameUserIndex == IgnorePairingChangeForControllerId)
	{
		// We were told to ignores
		IgnorePairingChangeForControllerId = -1;	// Reset now so there there is no chance this remains in a bad state
		return;
	}

	if (PreviousUser.IsValid() && !NewUser.IsValid())
	{
		// Treat this as a disconnect or signout, which is handled somewhere else
		return;
	}

	if (!PreviousUser.IsValid() && NewUser.IsValid())
	{
		// Treat this as a signin
		ULocalPlayer * ControlledLocalPlayer = FindLocalPlayerFromControllerId(GameUserIndex);

		if (ControlledLocalPlayer != NULL && !ControlledLocalPlayer->GetCachedUniqueNetId().IsValid())
		{
			// If a player that previously selected "continue without saving" signs into this controller, move them back to welcome screen
			HandleSignInChangeMessaging();
		}

		return;
	}

	// Find the local player currently being controlled by this controller
	ULocalPlayer * ControlledLocalPlayer = FindLocalPlayerFromControllerId(GameUserIndex);

	// See if the newly assigned profile is in our local player list
	ULocalPlayer * NewLocalPlayer = FindLocalPlayerFromUniqueNetId(NewUser);

	// If the local player being controlled is not the target of the pairing change, then give them a chance 
	// to continue controlling the old player with this controller
	if (ControlledLocalPlayer != nullptr && ControlledLocalPlayer != NewLocalPlayer)
	{
		UAmethystGameViewportClient * AmethystViewport = Cast<UAmethystGameViewportClient>(GetGameViewportClient());

		if (AmethystViewport != nullptr)
		{
			AmethystViewport->ShowDialog(
				nullptr,
				EAmethystDialogType::Generic,
				NSLOCTEXT("ProfileMessages", "PairingChanged", "Your controller has been paired to another profile, would you like to switch to this new profile now? Selecting YES will sign out of the previous profile."),
				NSLOCTEXT("DialogButtons", "YES", "A - YES"),
				NSLOCTEXT("DialogButtons", "NO", "B - NO"),
				FOnClicked::CreateUObject(this, &UAmethystGameInstance::OnPairingUseNewProfile),
				FOnClicked::CreateUObject(this, &UAmethystGameInstance::OnPairingUsePreviousProfile)
				);
		}
	}
#endif
}
开发者ID:1337programming,项目名称:amethystforest,代码行数:63,代码来源:AmethystGameInstance.cpp


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