107 lines
3.0 KiB
C++
107 lines
3.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "PHYAttributeSummaryWidget.generated.h"
|
|
|
|
class UPHYAttributeResourceBarWidget;
|
|
class UTextBlock;
|
|
class UVerticalBox;
|
|
|
|
/**
|
|
* @brief 属性界面左侧概览子控件。
|
|
*
|
|
* 展示角色名称、等级、战力、经验条和三项主要战斗资源。
|
|
*/
|
|
UCLASS(BlueprintType, Blueprintable)
|
|
class PHY_API UPHYAttributeSummaryWidget : public UUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/** @brief 构造属性概览控件。 */
|
|
UPHYAttributeSummaryWidget(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
|
/** @brief 构建原生概览 WidgetTree。 */
|
|
virtual TSharedRef<SWidget> RebuildWidget() override;
|
|
|
|
/** @brief 同步概览显示。 */
|
|
virtual void SynchronizeProperties() override;
|
|
|
|
/** @brief 设置角色概览信息。 */
|
|
UFUNCTION(BlueprintCallable, Category="PHY|UI|Attributes")
|
|
void SetSummary(FText InPlayerName, int32 InLevel, int32 InExperience, int32 InExperienceForNextLevel, int32 InCombatPower);
|
|
|
|
/** @brief 设置三项主要资源。 */
|
|
UFUNCTION(BlueprintCallable, Category="PHY|UI|Attributes")
|
|
void SetResources(float InHealth, float InMaxHealth, float InMana, float InMaxMana, float InStamina, float InMaxStamina);
|
|
|
|
protected:
|
|
/** @brief 构造原生概览树。 */
|
|
void BuildNativeWidgetTree();
|
|
|
|
/** @brief 刷新概览显示。 */
|
|
void UpdateSummaryWidgets();
|
|
|
|
/** @brief 角色名称。 */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="PHY|UI|Attributes")
|
|
FText PlayerName;
|
|
|
|
/** @brief 当前等级。 */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="PHY|UI|Attributes")
|
|
int32 Level = 1;
|
|
|
|
/** @brief 当前经验。 */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="PHY|UI|Attributes")
|
|
int32 Experience = 0;
|
|
|
|
/** @brief 下一级所需经验。 */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="PHY|UI|Attributes")
|
|
int32 ExperienceForNextLevel = 100;
|
|
|
|
/** @brief 概览战力评分。 */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="PHY|UI|Attributes")
|
|
int32 CombatPower = 0;
|
|
|
|
float Health = 0.0f;
|
|
float MaxHealth = 1.0f;
|
|
float Mana = 0.0f;
|
|
float MaxMana = 1.0f;
|
|
float Stamina = 0.0f;
|
|
float MaxStamina = 1.0f;
|
|
|
|
/** @brief 角色名文本。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UTextBlock> PlayerNameText;
|
|
|
|
/** @brief 等级文本。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UTextBlock> LevelText;
|
|
|
|
/** @brief 战力文本。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UTextBlock> CombatPowerText;
|
|
|
|
/** @brief 资源条容器。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UVerticalBox> ResourceBox;
|
|
|
|
/** @brief 经验条。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UPHYAttributeResourceBarWidget> ExperienceBar;
|
|
|
|
/** @brief 生命条。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UPHYAttributeResourceBarWidget> HealthBar;
|
|
|
|
/** @brief 法力条。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UPHYAttributeResourceBarWidget> ManaBar;
|
|
|
|
/** @brief 耐力条。 */
|
|
UPROPERTY(Transient)
|
|
TObjectPtr<UPHYAttributeResourceBarWidget> StaminaBar;
|
|
};
|