2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#include "LyraUICameraManagerComponent.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Delegates/Delegate.h"
|
|
|
|
#include "GameFramework/HUD.h"
|
|
|
|
#include "GameFramework/PlayerController.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "LyraPlayerCameraManager.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Misc/CoreMisc.h"
|
|
|
|
#include "Templates/Casts.h"
|
|
|
|
#include "Templates/UnrealTemplate.h"
|
|
|
|
|
|
|
|
class AActor;
|
|
|
|
class FDebugDisplayInfo;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
ULyraUICameraManagerComponent* ULyraUICameraManagerComponent::GetComponent(APlayerController* PC)
|
|
|
|
{
|
|
|
|
if (PC != nullptr)
|
|
|
|
{
|
|
|
|
if (ALyraPlayerCameraManager* PCCamera = Cast<ALyraPlayerCameraManager>(PC->PlayerCameraManager))
|
|
|
|
{
|
|
|
|
return PCCamera->GetUICameraComponent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULyraUICameraManagerComponent::ULyraUICameraManagerComponent()
|
|
|
|
{
|
|
|
|
bWantsInitializeComponent = true;
|
|
|
|
|
|
|
|
if (!HasAnyFlags(RF_ClassDefaultObject))
|
|
|
|
{
|
|
|
|
// Register "showdebug" hook.
|
|
|
|
if (!IsRunningDedicatedServer())
|
|
|
|
{
|
|
|
|
AHUD::OnShowDebugInfo.AddUObject(this, &ThisClass::OnShowDebugInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ULyraUICameraManagerComponent::InitializeComponent()
|
|
|
|
{
|
|
|
|
Super::InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ULyraUICameraManagerComponent::SetViewTarget(AActor* InViewTarget, FViewTargetTransitionParams TransitionParams)
|
|
|
|
{
|
|
|
|
TGuardValue<bool> UpdatingViewTargetGuard(bUpdatingViewTarget, true);
|
|
|
|
|
|
|
|
ViewTarget = InViewTarget;
|
|
|
|
CastChecked<ALyraPlayerCameraManager>(GetOwner())->SetViewTarget(ViewTarget, TransitionParams);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ULyraUICameraManagerComponent::NeedsToUpdateViewTarget() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ULyraUICameraManagerComponent::UpdateViewTarget(struct FTViewTarget& OutVT, float DeltaTime)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void ULyraUICameraManagerComponent::OnShowDebugInfo(AHUD* HUD, UCanvas* Canvas, const FDebugDisplayInfo& DisplayInfo, float& YL, float& YPos)
|
|
|
|
{
|
|
|
|
}
|