Download LyraStarterGame/Plugins/CommonGame/Source/Public/GameUIPolicy.h from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 3.46 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Plugins/CommonGame/Source/Public/GameUIPolicy.h
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Plugins/CommonGame/Source/Public/GameUIPolicy.h
-
curl -L -o GameUIPolicy.h https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Plugins/CommonGame/Source/Public/GameUIPolicy.h
3.46 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class UCommonLocalPlayer; | |
| class UGameUIManagerSubsystem; | |
| class ULocalPlayer; | |
| class UPrimaryGameLayout; | |
| /** | |
| * | |
| */ | |
| UENUM() | |
| enum class ELocalMultiplayerInteractionMode : uint8 | |
| { | |
| // Fullscreen viewport for the primary player only, regardless of the other player's existence | |
| PrimaryOnly, | |
| // Fullscreen viewport for one player, but players can swap control over who's is displayed and who's is dormant | |
| SingleToggle, | |
| // Viewports displayed simultaneously for both players | |
| Simultaneous | |
| }; | |
| USTRUCT() | |
| struct FRootViewportLayoutInfo | |
| { | |
| GENERATED_BODY() | |
| public: | |
| UPROPERTY(Transient) | |
| TObjectPtr<ULocalPlayer> LocalPlayer = nullptr; | |
| UPROPERTY(Transient) | |
| TObjectPtr<UPrimaryGameLayout> RootLayout = nullptr; | |
| UPROPERTY(Transient) | |
| bool bAddedToViewport = false; | |
| FRootViewportLayoutInfo() {} | |
| FRootViewportLayoutInfo(ULocalPlayer* InLocalPlayer, UPrimaryGameLayout* InRootLayout, bool bIsInViewport) | |
| : LocalPlayer(InLocalPlayer) | |
| , RootLayout(InRootLayout) | |
| , bAddedToViewport(bIsInViewport) | |
| {} | |
| bool operator==(const ULocalPlayer* OtherLocalPlayer) const { return LocalPlayer == OtherLocalPlayer; } | |
| }; | |
| UCLASS(MinimalAPI, Abstract, Blueprintable, Within = GameUIManagerSubsystem) | |
| class UGameUIPolicy : public UObject | |
| { | |
| GENERATED_BODY() | |
| public: | |
| template <typename GameUIPolicyClass = UGameUIPolicy> | |
| static GameUIPolicyClass* GetGameUIPolicyAs(const UObject* WorldContextObject) | |
| { | |
| return Cast<GameUIPolicyClass>(GetGameUIPolicy(WorldContextObject)); | |
| } | |
| static UE_API UGameUIPolicy* GetGameUIPolicy(const UObject* WorldContextObject); | |
| public: | |
| UE_API virtual UWorld* GetWorld() const override; | |
| UE_API UGameUIManagerSubsystem* GetOwningUIManager() const; | |
| UE_API UPrimaryGameLayout* GetRootLayout(const UCommonLocalPlayer* LocalPlayer) const; | |
| ELocalMultiplayerInteractionMode GetLocalMultiplayerInteractionMode() const { return LocalMultiplayerInteractionMode; } | |
| UE_API void RequestPrimaryControl(UPrimaryGameLayout* Layout); | |
| protected: | |
| UE_API void AddLayoutToViewport(UCommonLocalPlayer* LocalPlayer, UPrimaryGameLayout* Layout); | |
| UE_API void RemoveLayoutFromViewport(UCommonLocalPlayer* LocalPlayer, UPrimaryGameLayout* Layout); | |
| UE_API virtual void OnRootLayoutAddedToViewport(UCommonLocalPlayer* LocalPlayer, UPrimaryGameLayout* Layout); | |
| UE_API virtual void OnRootLayoutRemovedFromViewport(UCommonLocalPlayer* LocalPlayer, UPrimaryGameLayout* Layout); | |
| UE_API virtual void OnRootLayoutReleased(UCommonLocalPlayer* LocalPlayer, UPrimaryGameLayout* Layout); | |
| UE_API void CreateLayoutWidget(UCommonLocalPlayer* LocalPlayer); | |
| UE_API TSubclassOf<UPrimaryGameLayout> GetLayoutWidgetClass(UCommonLocalPlayer* LocalPlayer); | |
| private: | |
| ELocalMultiplayerInteractionMode LocalMultiplayerInteractionMode = ELocalMultiplayerInteractionMode::PrimaryOnly; | |
| UPROPERTY(EditAnywhere) | |
| TSoftClassPtr<UPrimaryGameLayout> LayoutClass; | |
| UPROPERTY(Transient) | |
| TArray<FRootViewportLayoutInfo> RootViewportLayouts; | |
| private: | |
| UE_API void NotifyPlayerAdded(UCommonLocalPlayer* LocalPlayer); | |
| UE_API void NotifyPlayerRemoved(UCommonLocalPlayer* LocalPlayer); | |
| UE_API void NotifyPlayerDestroyed(UCommonLocalPlayer* LocalPlayer); | |
| friend class UGameUIManagerSubsystem; | |
| }; | |