Download LyraStarterGame/Source/LyraGame/UI/Subsystem/LyraUIManagerSubsystem.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/UI/Subsystem/LyraUIManagerSubsystem.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/UI/Subsystem/LyraUIManagerSubsystem.cpp
-
curl -L -o LyraUIManagerSubsystem.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/UI/Subsystem/LyraUIManagerSubsystem.cpp
1.78 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class FSubsystemCollectionBase; | |
| ULyraUIManagerSubsystem::ULyraUIManagerSubsystem() | |
| { | |
| } | |
| void ULyraUIManagerSubsystem::Initialize(FSubsystemCollectionBase& Collection) | |
| { | |
| Super::Initialize(Collection); | |
| TickHandle = FTSTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateUObject(this, &ULyraUIManagerSubsystem::Tick), 0.0f); | |
| } | |
| void ULyraUIManagerSubsystem::Deinitialize() | |
| { | |
| Super::Deinitialize(); | |
| FTSTicker::GetCoreTicker().RemoveTicker(TickHandle); | |
| } | |
| bool ULyraUIManagerSubsystem::Tick(float DeltaTime) | |
| { | |
| SyncRootLayoutVisibilityToShowHUD(); | |
| return true; | |
| } | |
| void ULyraUIManagerSubsystem::SyncRootLayoutVisibilityToShowHUD() | |
| { | |
| if (const UGameUIPolicy* Policy = GetCurrentUIPolicy()) | |
| { | |
| for (const ULocalPlayer* LocalPlayer : GetGameInstance()->GetLocalPlayers()) | |
| { | |
| bool bShouldShowUI = true; | |
| if (const APlayerController* PC = LocalPlayer->GetPlayerController(GetWorld())) | |
| { | |
| const AHUD* HUD = PC->GetHUD(); | |
| if (HUD && !HUD->bShowHUD) | |
| { | |
| bShouldShowUI = false; | |
| } | |
| } | |
| if (UPrimaryGameLayout* RootLayout = Policy->GetRootLayout(CastChecked<UCommonLocalPlayer>(LocalPlayer))) | |
| { | |
| const ESlateVisibility DesiredVisibility = bShouldShowUI ? ESlateVisibility::SelfHitTestInvisible : ESlateVisibility::Collapsed; | |
| if (DesiredVisibility != RootLayout->GetVisibility()) | |
| { | |
| RootLayout->SetVisibility(DesiredVisibility); | |
| } | |
| } | |
| } | |
| } | |
| } | |