Readouts e LvlText do PlayerVitals viram RichTextBlock com markup inline, estilizados pelo DT_UI_VitalsReadout (fonte JetBrains Mono Bold): - HP/SP: atual (branco) + "/" (sep, #3a3830) + max (#6c6860) - LVL: "LVL " (#b8b3a8) + numero (num, gold-bright #ffd888, maior) Cores espelham hud_layout_modal_New.html (text-1/2/3/4 + gold-bright). UZMMOHudPlayerVitalsWidget: HpReadout/SpReadout/ExpReadout/JobReadout/LvlText agora URichTextBlock; ApplyHpSp/ApplySnapshot montam o markup. EXP/JOB readout segue exp absoluto (sem %) ate o server enviar exp-to-next. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
94 lines
3.7 KiB
C++
94 lines
3.7 KiB
C++
#pragma once
|
|
|
|
#include "CommonUserWidget.h"
|
|
#include "CoreMinimal.h"
|
|
#include "ZMMOAttributeTypes.h"
|
|
#include "ZMMOHudPlayerVitalsWidget.generated.h"
|
|
|
|
class UUIProgressBar_Base;
|
|
class UTextBlock;
|
|
class URichTextBlock;
|
|
|
|
/**
|
|
* Sub-widget do HUD: painel de vitais do player (portrait + nome/job/level +
|
|
* barras HP/SP/BASE EXP/JOB EXP). Sem auto-bind no AttributeComponent — o
|
|
* parent (UZMMOHudWidget) propaga snapshots via ApplySnapshot/ApplyHpSp.
|
|
*
|
|
* Barras são UUIProgressBar_Base (material custom Primary/Secondary). HP/SP
|
|
* têm pool efetivo no snapshot → % real. BASE/JOB EXP só têm exp acumulado
|
|
* (sem "exp-to-next") — barras de EXP ficam pra quando a curva existir;
|
|
* por ora o readout mostra o valor absoluto.
|
|
*
|
|
* WBP filho (WBP_PlayerVitalsPanel) deve ter widgets com EXATAMENTE estes
|
|
* nomes: HpBar, SpBar (obrigatórios); ExpBar, JobBar, NameText, ClassText,
|
|
* LvlText, HpReadout, SpReadout, ExpReadout, JobReadout (opcionais).
|
|
*/
|
|
UCLASS(Abstract, Blueprintable, BlueprintType)
|
|
class ZMMO_API UZMMOHudPlayerVitalsWidget : public UCommonUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/** Atualiza todos os campos a partir do snapshot. Chamado pelo UZMMOHudWidget. */
|
|
UFUNCTION(BlueprintCallable, Category = "Zeus|HUD")
|
|
void ApplySnapshot(const FZMMOAttributesSnapshot& Snapshot);
|
|
|
|
/** Atualiza apenas HP/SP (otimização do tick — sem mexer em level/exp). */
|
|
UFUNCTION(BlueprintCallable, Category = "Zeus|HUD")
|
|
void ApplyHpSp(int32 Hp, int32 MaxHp, int32 Sp, int32 MaxSp);
|
|
|
|
/** Nome do char — vem do PlayerState (não está no snapshot). */
|
|
UFUNCTION(BlueprintCallable, Category = "Zeus|HUD")
|
|
void SetCharName(const FString& InName);
|
|
|
|
/** Nome do job/classe — vem do JobsDatabase via ClassId (não é string no snapshot). */
|
|
UFUNCTION(BlueprintCallable, Category = "Zeus|HUD")
|
|
void SetClassName(const FString& InClassName);
|
|
|
|
protected:
|
|
/** Hook BP pra skin reagir (cores low-HP, animações, etc.). */
|
|
UFUNCTION(BlueprintNativeEvent, Category = "Zeus|HUD")
|
|
void OnSnapshotApplied(const FZMMOAttributesSnapshot& Snapshot);
|
|
virtual void OnSnapshotApplied_Implementation(const FZMMOAttributesSnapshot& Snapshot);
|
|
|
|
// === BindWidget — barras (HP/SP obrigatórias) ===
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidget), Category = "Zeus|HUD")
|
|
TObjectPtr<UUIProgressBar_Base> HpBar;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidget), Category = "Zeus|HUD")
|
|
TObjectPtr<UUIProgressBar_Base> SpBar;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<UUIProgressBar_Base> ExpBar;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<UUIProgressBar_Base> JobBar;
|
|
|
|
// === BindWidget — textos (todos opcionais) ===
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<UTextBlock> NameText;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<UTextBlock> ClassText;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<URichTextBlock> LvlText;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<URichTextBlock> HpReadout;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<URichTextBlock> SpReadout;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<URichTextBlock> ExpReadout;
|
|
|
|
UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional), Category = "Zeus|HUD")
|
|
TObjectPtr<URichTextBlock> JobReadout;
|
|
|
|
private:
|
|
/** Último snapshot recebido (cache pra ApplyHpSp manter MaxHp/MaxSp). */
|
|
UPROPERTY(Transient)
|
|
FZMMOAttributesSnapshot LastSnapshot;
|
|
};
|