本文整理汇总了C++中ULocalPlayer类的典型用法代码示例。如果您正苦于以下问题:C++ ULocalPlayer类的具体用法?C++ ULocalPlayer怎么用?C++ ULocalPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ULocalPlayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FVector2D
/* After release of left mouse button, check if this unit is within selection box. */
void ARTSUnit::CheckForSelection()
{
/* Find screen coordinates of the unit. */
FVector2D MyResult = FVector2D(0, 0);
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PC->Player);
if (LocalPlayer != NULL && LocalPlayer->ViewportClient != NULL && LocalPlayer->ViewportClient->Viewport != NULL)
{
FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues(
LocalPlayer->ViewportClient->Viewport,
GetWorld()->Scene,
LocalPlayer->ViewportClient->EngineShowFlags)
.SetRealtimeUpdate(true));
FVector ViewLocation;
FRotator ViewRotation;
FSceneView* SceneView = LocalPlayer->CalcSceneView(&ViewFamily, /*out*/ ViewLocation, /*out*/ ViewRotation, LocalPlayer->ViewportClient->Viewport);
if (SceneView)
{
auto MyWorldPosition = GetActorLocation();
MyResult;
SceneView->WorldToPixel(MyWorldPosition, MyResult);
}
}
/* If the selection box contains the screen postion: */
if (ARTSHUD::SelectionContainsPoint(MyResult)){
// Select this unit, and leave possibility to select others.
Select();
}
}
开发者ID:OpenMachines,项目名称:machines,代码行数:36,代码来源:RTSUnit.cpp
示例2: OnShowLoginUICompleted
void UShowLoginUICallbackProxy::OnShowLoginUICompleted(TSharedPtr<const FUniqueNetId> UniqueId, int LocalPlayerNum)
{
// Update the cached unique ID for the local player and the player state.
APlayerController* PlayerController = PlayerControllerWeakPtr.Get();
if (PlayerController != nullptr)
{
ULocalPlayer* LocalPlayer = PlayerController->GetLocalPlayer();
if (LocalPlayer != nullptr)
{
LocalPlayer->SetCachedUniqueNetId(UniqueId);
}
if (PlayerController->PlayerState != nullptr)
{
PlayerController->PlayerState->SetUniqueId(UniqueId);
}
}
if (UniqueId.IsValid())
{
OnSuccess.Broadcast(PlayerControllerWeakPtr.Get());
}
else
{
OnFailure.Broadcast(PlayerControllerWeakPtr.Get());
}
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:28,代码来源:ShowLoginUICallbackProxy.cpp
示例3: Offset
FVector2D AHUD::GetCoordinateOffset() const
{
FVector2D Offset(0.f, 0.f);
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(GetOwningPlayerController()->Player);
if (LocalPlayer)
{
// Create a view family for the game viewport
FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues(
LocalPlayer->ViewportClient->Viewport,
GetWorld()->Scene,
LocalPlayer->ViewportClient->EngineShowFlags)
.SetRealtimeUpdate(true));
// Calculate a view where the player is to update the streaming from the players start location
FVector ViewLocation;
FRotator ViewRotation;
FSceneView* SceneView = LocalPlayer->CalcSceneView(&ViewFamily, /*out*/ ViewLocation, /*out*/ ViewRotation, LocalPlayer->ViewportClient->Viewport);
if (SceneView)
{
Offset.X = (SceneView->ViewRect.Min.X - SceneView->UnscaledViewRect.Min.X) // This accounts for the borders when the aspect ratio is locked
- SceneView->UnscaledViewRect.Min.X; // And this will deal with the viewport offset if its a split screen
Offset.Y = (SceneView->ViewRect.Min.Y - SceneView->UnscaledViewRect.Min.Y)
- SceneView->UnscaledViewRect.Min.Y;
}
}
return Offset;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:32,代码来源:HUD.cpp
示例4: UE_LOG
void UAdvancedFriendsLibrary::IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend)
{
if (!PlayerController)
{
UE_LOG(AdvancedFriendsLog, Warning, TEXT("IsAFriend Had a bad Player Controller!"));
return;
}
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
return;
}
IOnlineFriendsPtr FriendsInterface = Online::GetFriendsInterface();
if (!FriendsInterface.IsValid())
{
UE_LOG(AdvancedFriendsLog, Warning, TEXT("IsAFriend Failed to get friends interface!"));
return;
}
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerController->Player);
if (!Player)
{
UE_LOG(AdvancedFriendsLog, Warning, TEXT("IsAFriend Failed to get LocalPlayer!"));
return;
}
IsFriend = FriendsInterface->IsFriend(Player->GetControllerId(), *UniqueNetId.GetUniqueNetId(), EFriendsLists::ToString(EFriendsLists::Type::Default));
}
开发者ID:ivukotic,项目名称:ATLASrift,代码行数:32,代码来源:AdvancedFriendsLibrary.cpp
示例5: IsInvertedYAxisDirty
bool UAmethystPersistentUser::IsInvertedYAxisDirty() const
{
bool bIsInvertedYAxisDirty = false;
if (GEngine)
{
TArray<APlayerController*> PlayerList;
GEngine->GetAllLocalPlayerControllers(PlayerList);
for (auto It = PlayerList.CreateIterator(); It; ++It)
{
APlayerController* PC = *It;
if (!PC || !PC->Player || !PC->PlayerInput)
{
continue;
}
// Update key bindings for the current user only
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PC->Player);
if(!LocalPlayer || LocalPlayer->GetControllerId() != UserIndex)
{
continue;
}
bIsInvertedYAxisDirty |= PC->PlayerInput->GetInvertAxis("Lookup") != GetInvertedYAxis();
bIsInvertedYAxisDirty |= PC->PlayerInput->GetInvertAxis("LookupRate") != GetInvertedYAxis();
}
}
return bIsInvertedYAxisDirty;
}
开发者ID:1337programming,项目名称:amethystforest,代码行数:30,代码来源:AmethystPersistentUser.cpp
示例6: SetUpdateState
void UUpdateManager::StartPlatformEnvironmentCheck()
{
IOnlineSubsystem* OnlineSubConsole = IOnlineSubsystem::GetByPlatform();
if (!bPlatformEnvironmentDetected &&
OnlineSubConsole != nullptr &&
OnlineSubConsole->GetIdentityInterface().IsValid())
{
SetUpdateState(EUpdateState::DetectingPlatformEnvironment);
ULocalPlayer* LP = GetGameInstance()->GetFirstGamePlayer();
if (LP != nullptr)
{
const int32 ControllerId = LP->GetControllerId();
OnLoginConsoleCompleteHandle = OnlineSubConsole->GetIdentityInterface()->AddOnLoginCompleteDelegate_Handle(
ControllerId,
FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::PlatformEnvironmentCheck_OnLoginConsoleComplete)
);
OnlineSubConsole->GetIdentityInterface()->Login(ControllerId, FOnlineAccountCredentials());
}
}
else
{
StartHotfixCheck();
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:26,代码来源:UpdateManager.cpp
示例7: UE_LOG
void UGetFriendsCallbackProxy::Activate()
{
if (!PlayerControllerWeakPtr.IsValid())
{
// Fail immediately
UE_LOG(AdvancedGetFriendsLog, Warning, TEXT("GetFriends Failed received a bad player controller!"));
TArray<FBPFriendInfo> EmptyArray;
OnFailure.Broadcast(EmptyArray);
return;
}
IOnlineFriendsPtr Friends = Online::GetFriendsInterface();
if (Friends.IsValid())
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
Friends->ReadFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Type::Default)), FriendListReadCompleteDelegate);
return;
}
// Fail immediately
TArray<FBPFriendInfo> EmptyArray;
OnFailure.Broadcast(EmptyArray);
}
开发者ID:eternalst0rm,项目名称:ClashOfBalls,代码行数:25,代码来源:GetFriendsCallbackProxy.cpp
示例8: GetLocalPlayer
void APuzzlePresetPlayerController::OnEndTurn()
{
/*UPuzzlePresetGameInstance* ppgi = Cast<UPuzzlePresetGameInstance>(GetGameInstance());
ULocalPlayer* LocalPlayer = GetLocalPlayer();
ppgi->HostSession(MakeShareable(LocalPlayer->GetControllerId()),)
return;*/
IOnlineSubsystem* ion = IOnlineSubsystem::Get(FName("Steam"));
if (ion != nullptr)
{
ULocalPlayer* LocalPlayer = GetLocalPlayer();
if (LocalPlayer && LocalPlayer->GetControllerId() != -1)
{
UE_LOG(LogTemp, Warning, TEXT("steam user name: %s"), *PlayerState->PlayerName);
uint8 status = ion->GetIdentityInterface()->GetLoginStatus(LocalPlayer->GetControllerId());
UE_LOG(LogTemp, Warning, TEXT("steam user status: %d"), status);
}
/*if (ion->InitSteamworksClient(false, 480))
{
UE_LOG(LogTemp, Warning, TEXT("Steam API initialized succesfully!"));
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Failed to initialize Steam API :("));
}*/
}
}
开发者ID:alkboda,项目名称:PuzzlePreset,代码行数:29,代码来源:PuzzlePresetPlayerController.cpp
示例9: 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
示例10: GetActorBounds
void AEyeXSimpleInteractorPawn::UpdateRegion()
{
FVector Origin;
FVector Extents;
GetActorBounds(false, Origin, Extents);
auto playerController = Cast<APlayerController>(Controller);
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(playerController->Player);
auto ViewFamilyArguments = FSceneViewFamily::ConstructionValues(LocalPlayer->ViewportClient->Viewport, GetWorld()->Scene, LocalPlayer->ViewportClient->EngineShowFlags);
ViewFamilyArguments.SetRealtimeUpdate(true);
FSceneViewFamilyContext ViewFamily(ViewFamilyArguments);
// Calculate a view where the player is to update the streaming from the players start location
FVector ViewLocation;
FRotator ViewRotation;
FSceneView* SceneView = LocalPlayer->CalcSceneView(&ViewFamily, /*out*/ ViewLocation, /*out*/ ViewRotation, LocalPlayer->ViewportClient->Viewport);
FVector2D ExtentPoints[8];
SceneView->WorldToPixel(Origin + FVector(Extents.X, Extents.Y, Extents.Z), ExtentPoints[0]); //Right Top Front
SceneView->WorldToPixel(Origin + FVector(Extents.X, Extents.Y, -Extents.Z), ExtentPoints[1]); //Right Top Back
SceneView->WorldToPixel(Origin + FVector(Extents.X, -Extents.Y, Extents.Z), ExtentPoints[2]); //Right Bottom Front
SceneView->WorldToPixel(Origin + FVector(Extents.X, -Extents.Y, -Extents.Z), ExtentPoints[3]); //Right Bottom Back
SceneView->WorldToPixel(Origin + FVector(-Extents.X, Extents.Y, Extents.Z), ExtentPoints[4]); //Left Top Front
SceneView->WorldToPixel(Origin + FVector(-Extents.X, Extents.Y, -Extents.Z), ExtentPoints[5]); //Left Top Back
SceneView->WorldToPixel(Origin + FVector(-Extents.X, -Extents.Y, Extents.Z), ExtentPoints[6]); //Left Bottom Front
SceneView->WorldToPixel(Origin + FVector(-Extents.X, -Extents.Y, -Extents.Z), ExtentPoints[7]); //Left Bottom Back
FVector2D TopLeft = FVector2D(std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
FVector2D BottomRight = FVector2D(std::numeric_limits<float>::min(), std::numeric_limits<float>::min());
for (auto Point : ExtentPoints)
{
if (Point.X < TopLeft.X)
TopLeft.X = Point.X;
else if (Point.X > BottomRight.X)
BottomRight.X = Point.X;
if (Point.Y < TopLeft.Y)
TopLeft.Y = Point.Y;
else if (Point.Y > BottomRight.Y)
BottomRight.Y = Point.Y;
}
MyRegion->bounds.left = TopLeft.X;
MyRegion->bounds.top = TopLeft.Y;
MyRegion->bounds.right = BottomRight.X;
MyRegion->bounds.bottom = BottomRight.Y;
}
开发者ID:Temaran,项目名称:EyeXUnreal,代码行数:49,代码来源:EyeXSimpleInteractorPawn.cpp
示例11: GetShooterHUD
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
示例12: SetMouseLockedToViewport
void ULucyFunctions::SetMouseLockedToViewport(const bool Locked)
{
if (GEngine == nullptr)
{
return;
}
UGameViewportClient* ViewportClient = GEngine->GameViewport;
if (ViewportClient == nullptr)
{
return;
}
TSharedPtr<SViewport> ViewportWidget = ViewportClient->GetGameViewportWidget();
if (!ViewportWidget.IsValid())
{
return;
}
TArray<APlayerController*> LocalPlayerControllers;
GEngine->GetAllLocalPlayerControllers(LocalPlayerControllers);
for (APlayerController* LocalPlayerController : LocalPlayerControllers)
{
if (LocalPlayerController == nullptr)
{
continue;
}
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(LocalPlayerController->Player);
if (LocalPlayer == nullptr)
{
continue;
}
if (Locked)
{
LocalPlayer->GetSlateOperations().LockMouseToWidget(ViewportWidget.ToSharedRef());
}
else
{
LocalPlayer->GetSlateOperations().ReleaseMouseLock();
}
}
}
开发者ID:kjustynski,项目名称:Lucy,代码行数:45,代码来源:LucyFunctions.cpp
示例13: FindFocusedActor
AEyeXActorBase* AEyeXPlayerController::FindFocusedActor(FHitResult& OutHit, const FVector2D& GazePoint)
{
// Get the scene view to deproject the gazepoint to world space
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
if (!LocalPlayer)
return nullptr;
FSceneViewFamily ViewFamily(FSceneViewFamily::ConstructionValues(
LocalPlayer->ViewportClient->Viewport,
GetWorld()->Scene,
LocalPlayer->ViewportClient->EngineShowFlags)
.SetRealtimeUpdate(true));
FVector ViewLocation;
FRotator ViewRotation;
FSceneView* View = LocalPlayer->CalcSceneView(&ViewFamily, /*out*/ ViewLocation, /*out*/ ViewRotation, LocalPlayer->ViewportClient->Viewport);
// Initiate sweep/trace variables
const FCollisionObjectQueryParams ObjectParams(FEyeXUtils::ECCArrayToBitField(CollisionChannels));
const FCollisionQueryParams TraceParams(FName(TEXT("GazeTrace")), true, GetPawn());
FHitResult HitResult;
AEyeXActorBase* EyeXActor = nullptr;
switch (DetectionMode)
{
case EEyeXDetectionMode::LineTrace:
EyeXActor = FindByLineTrace(HitResult, View, GazePoint, ObjectParams, TraceParams);
break;
case EEyeXDetectionMode::BoxedLineTrace:
EyeXActor = FindByBoxedLineTrace(HitResult, View, GazePoint, ObjectParams, TraceParams);
break;
case EEyeXDetectionMode::Sweep:
EyeXActor = FindBySweep(HitResult, View, GazePoint, ObjectParams, TraceParams);
break;
case EEyeXDetectionMode::FrustrumIntersection:
EyeXActor = FindByFrustumIntersection(HitResult, View, GazePoint, ObjectParams, TraceParams);
break;
default:
break;
}
OutHit = HitResult;
return EyeXActor; // use out param for actor as well, alternatively use hit actor in hit result (with cast). make the method const too.
}
开发者ID:AnyKey-,项目名称:EyeXforUE4,代码行数:45,代码来源:EyeXPlayerController.cpp
示例14: FindLocalPlayerFromControllerId
void UAmethystGameInstance::HandleControllerConnectionChange(bool bIsConnection, int32 Unused, int32 GameUserIndex)
{
if (!bIsConnection)
{
// Controller was disconnected
// Find the local player associated with this user index
ULocalPlayer * LocalPlayer = FindLocalPlayerFromControllerId(GameUserIndex);
if (LocalPlayer == NULL)
{
return; // We don't care about players we aren't tracking
}
// Invalidate this local player's controller id.
LocalPlayer->SetControllerId(-1);
}
}
开发者ID:1337programming,项目名称:amethystforest,代码行数:18,代码来源:AmethystGameInstance.cpp
示例15: IsAimSensitivityDirty
bool UAmethystPersistentUser::IsAimSensitivityDirty() const
{
bool bIsAimSensitivityDirty = false;
// Fixme: UAmethystPersistentUser is not setup to work with multiple worlds.
// For now, user settings are global to all world instances.
if (GEngine)
{
TArray<APlayerController*> PlayerList;
GEngine->GetAllLocalPlayerControllers(PlayerList);
for (auto It = PlayerList.CreateIterator(); It; ++It)
{
APlayerController* PC = *It;
if (!PC || !PC->Player || !PC->PlayerInput)
{
continue;
}
// Update key bindings for the current user only
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PC->Player);
if(!LocalPlayer || LocalPlayer->GetControllerId() != UserIndex)
{
continue;
}
// check if the aim sensitivity is off anywhere
for (int32 Idx = 0; Idx < PC->PlayerInput->AxisMappings.Num(); Idx++)
{
FInputAxisKeyMapping &AxisMapping = PC->PlayerInput->AxisMappings[Idx];
if (AxisMapping.AxisName == "Lookup" || AxisMapping.AxisName == "LookupRate" || AxisMapping.AxisName == "Turn" || AxisMapping.AxisName == "TurnRate")
{
if (FMath::Abs(AxisMapping.Scale) != GetAimSensitivity())
{
bIsAimSensitivityDirty = true;
break;
}
}
}
}
}
return bIsAimSensitivityDirty;
}
开发者ID:1337programming,项目名称:amethystforest,代码行数:44,代码来源:AmethystPersistentUser.cpp
示例16: TellInputAboutKeybindings
void UAmethystPersistentUser::TellInputAboutKeybindings()
{
TArray<APlayerController*> PlayerList;
GEngine->GetAllLocalPlayerControllers(PlayerList);
for (auto It = PlayerList.CreateIterator(); It; ++It)
{
APlayerController* PC = *It;
if (!PC || !PC->Player || !PC->PlayerInput)
{
continue;
}
// Update key bindings for the current user only
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PC->Player);
if(!LocalPlayer || LocalPlayer->GetControllerId() != UserIndex)
{
continue;
}
//set the aim sensitivity
for (int32 Idx = 0; Idx < PC->PlayerInput->AxisMappings.Num(); Idx++)
{
FInputAxisKeyMapping &AxisMapping = PC->PlayerInput->AxisMappings[Idx];
if (AxisMapping.AxisName == "Lookup" || AxisMapping.AxisName == "LookupRate" || AxisMapping.AxisName == "Turn" || AxisMapping.AxisName == "TurnRate")
{
AxisMapping.Scale = (AxisMapping.Scale < 0.0f) ? -GetAimSensitivity() : +GetAimSensitivity();
}
}
PC->PlayerInput->ForceRebuildingKeyMaps();
//invert it, and if does not equal our bool, invert it again
if (PC->PlayerInput->GetInvertAxis("LookupRate") != GetInvertedYAxis())
{
PC->PlayerInput->InvertAxis("LookupRate");
}
if (PC->PlayerInput->GetInvertAxis("Lookup") != GetInvertedYAxis())
{
PC->PlayerInput->InvertAxis("Lookup");
}
}
}
开发者ID:1337programming,项目名称:amethystforest,代码行数:43,代码来源:AmethystPersistentUser.cpp
示例17: AddIdToMuteList
void FPlayerMuteList::ClientMutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& MuteId)
{
const TSharedPtr<const FUniqueNetId>& PlayerIdToMute = MuteId.GetUniqueNetId();
// Add to the filter list on clients (used for peer to peer voice)
AddIdToMuteList(VoicePacketFilter, PlayerIdToMute);
// Use the local player to determine the controller id
ULocalPlayer* LP = Cast<ULocalPlayer>(OwningPC->Player);
if (LP != NULL)
{
UWorld* World = OwningPC->GetWorld();
IOnlineVoicePtr VoiceInt = Online::GetVoiceInterface(World);
if (VoiceInt.IsValid())
{
// Have the voice subsystem mute this player
VoiceInt->MuteRemoteTalker(LP->GetControllerId(), *PlayerIdToMute, false);
}
}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:20,代码来源:PlayerMuteList.cpp
示例18: GetCameraRay
void AMouseController::GetCameraRay(FVector& WorldOrigin, FVector& WorldDirection)
{
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
FVector2D MousePosition;
if (LocalPlayer)
{
if (!LocalPlayer->ViewportClient->GetMousePosition(MousePosition))
{
return;
}
}
// Early out if we clicked on a HUD hitbox
if (GetHUD() != NULL && GetHUD()->GetHitBoxAtCoordinates(MousePosition, true))
{
return;
}
if (LocalPlayer != NULL && LocalPlayer->ViewportClient != NULL && LocalPlayer->ViewportClient->Viewport != NULL)
{
// Create a view family for the game viewport
FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues(
LocalPlayer->ViewportClient->Viewport,
GetWorld()->Scene,
LocalPlayer->ViewportClient->EngineShowFlags)
.SetRealtimeUpdate(true));
// Calculate a view where the player is to update the streaming from the players start location
FVector ViewLocation;
FRotator ViewRotation;
FSceneView* SceneView = LocalPlayer->CalcSceneView(&ViewFamily, /*out*/ ViewLocation, /*out*/ ViewRotation, LocalPlayer->ViewportClient->Viewport);
if (SceneView)
{
SceneView->DeprojectFVector2D(MousePosition, WorldOrigin, WorldDirection);
}
}
}
开发者ID:pokelege,项目名称:ProjectTap_Code,代码行数:40,代码来源:MouseController.cpp
示例19: 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
示例20: check
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);
//.........这里部分代码省略.........
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:101,代码来源:PendingNetGame.cpp
注:本文中的ULocalPlayer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论