Download LyraStarterGame/Plugins/CommonGame/Source/Private/GameUIManagerSubsystem.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Plugins/CommonGame/Source/Private/GameUIManagerSubsystem.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Plugins/CommonGame/Source/Private/GameUIManagerSubsystem.cpp
-
curl -L -o GameUIManagerSubsystem.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Plugins/CommonGame/Source/Private/GameUIManagerSubsystem.cpp
1.83 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class FSubsystemCollectionBase; | |
| class UClass; | |
| void UGameUIManagerSubsystem::Initialize(FSubsystemCollectionBase& Collection) | |
| { | |
| Super::Initialize(Collection); | |
| if (!CurrentPolicy && !DefaultUIPolicyClass.IsNull()) | |
| { | |
| TSubclassOf<UGameUIPolicy> PolicyClass = DefaultUIPolicyClass.LoadSynchronous(); | |
| SwitchToPolicy(NewObject<UGameUIPolicy>(this, PolicyClass)); | |
| } | |
| } | |
| void UGameUIManagerSubsystem::Deinitialize() | |
| { | |
| Super::Deinitialize(); | |
| SwitchToPolicy(nullptr); | |
| } | |
| bool UGameUIManagerSubsystem::ShouldCreateSubsystem(UObject* Outer) const | |
| { | |
| if (!CastChecked<UGameInstance>(Outer)->IsDedicatedServerInstance()) | |
| { | |
| TArray<UClass*> ChildClasses; | |
| GetDerivedClasses(GetClass(), ChildClasses, false); | |
| // Only create an instance if there is no override implementation defined elsewhere | |
| return ChildClasses.Num() == 0; | |
| } | |
| return false; | |
| } | |
| void UGameUIManagerSubsystem::NotifyPlayerAdded(UCommonLocalPlayer* LocalPlayer) | |
| { | |
| if (ensure(LocalPlayer) && CurrentPolicy) | |
| { | |
| CurrentPolicy->NotifyPlayerAdded(LocalPlayer); | |
| } | |
| } | |
| void UGameUIManagerSubsystem::NotifyPlayerRemoved(UCommonLocalPlayer* LocalPlayer) | |
| { | |
| if (LocalPlayer && CurrentPolicy) | |
| { | |
| CurrentPolicy->NotifyPlayerRemoved(LocalPlayer); | |
| } | |
| } | |
| void UGameUIManagerSubsystem::NotifyPlayerDestroyed(UCommonLocalPlayer* LocalPlayer) | |
| { | |
| if (LocalPlayer && CurrentPolicy) | |
| { | |
| CurrentPolicy->NotifyPlayerDestroyed(LocalPlayer); | |
| } | |
| } | |
| void UGameUIManagerSubsystem::SwitchToPolicy(UGameUIPolicy* InPolicy) | |
| { | |
| if (CurrentPolicy != InPolicy) | |
| { | |
| CurrentPolicy = InPolicy; | |
| } | |
| } | |