61 lines
2.0 KiB
C++
61 lines
2.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/HUD.h"
|
|
#include "UI/GUIS_GameUIStructLibrary.h"
|
|
#include "PHYHUD.generated.h"
|
|
|
|
class UCommonActivatableWidget;
|
|
class UPHYPlayerUIContext;
|
|
|
|
/**
|
|
* @brief PHY HUD 根入口。
|
|
*
|
|
* 首期只提供 C++ HUD 生命周期入口。真正 UI 由后续 GenericUISystem/CommonUI
|
|
* 专家接入,避免在 GameMode 或 PlayerController 中直接堆 UMG 装配逻辑。
|
|
*/
|
|
UCLASS(BlueprintType, Blueprintable)
|
|
class PHY_API APHYHUD : public AHUD
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/** @brief 构造 HUD 根入口。 */
|
|
APHYHUD(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
|
/** @brief HUD 开始运行时初始化玩家 UI 入口。 */
|
|
virtual void BeginPlay() override;
|
|
|
|
/** @brief 初始化当前玩家的 HUD 逻辑。 */
|
|
UFUNCTION(BlueprintCallable, Category="PHY|UI")
|
|
virtual void InitializeHUDForPlayer(APlayerController* OwningPlayerController);
|
|
|
|
/** @brief 查询 HUD 是否已经完成初始化。 */
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category="PHY|UI")
|
|
bool IsHUDInitialized() const { return bHUDInitialized; }
|
|
|
|
protected:
|
|
/** @brief 注册 GenericUISystem 本地玩家根布局和项目 UI 上下文。 */
|
|
virtual bool InitializeGenericUIForPlayer(APlayerController* OwningPlayerController);
|
|
|
|
/** @brief 推入默认 HUD 控件。 */
|
|
virtual UCommonActivatableWidget* PushDefaultHUDWidget(APlayerController* OwningPlayerController);
|
|
|
|
/** @brief 当前本地玩家 UI 上下文。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UPHYPlayerUIContext> PlayerUIContext;
|
|
|
|
/** @brief 当前本地玩家 UI 上下文注册句柄。 */
|
|
UPROPERTY(Transient)
|
|
FGUIS_UIContextBindingHandle PlayerUIContextBindingHandle;
|
|
|
|
/** @brief 默认 HUD 控件实例。 */
|
|
UPROPERTY(Transient, BlueprintReadOnly, Category="PHY|UI")
|
|
TObjectPtr<UCommonActivatableWidget> DefaultHUDWidget;
|
|
/** @brief HUD 是否已经完成基础初始化。 */
|
|
UPROPERTY(Transient, BlueprintReadOnly, Category="PHY|UI")
|
|
bool bHUDInitialized = false;
|
|
};
|