feat/frontend-mainmenu-skeleton #1

Merged
Mateuus merged 25 commits from feat/frontend-mainmenu-skeleton into main 2026-05-19 02:06:48 -03:00
3 changed files with 60 additions and 2 deletions
Showing only changes of commit 2064c37bc3 - Show all commits

View File

@@ -3,9 +3,12 @@
#include "CoreMinimal.h"
#include "Fonts/SlateFontInfo.h"
#include "Layout/Margin.h"
#include "Templates/SubclassOf.h"
#include "UIStyleTypes.h"
#include "UIStyleTokens.generated.h"
class UCommonTextStyle;
/**
* Tokens de estilo da UI organizados em 3 camadas (design tokens):
*
@@ -193,6 +196,15 @@ struct ZMMO_API FUIStyleButtonVariant
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
FLinearColor TextColor = FLinearColor::White;
/**
* Estilo de texto desta variante (padrão Hyper/CommonUI: CommonTextStyle).
* Define fonte/tamanho/peso. A COR é sobreposta pelo TextColor acima
* (FUIStyle manda na cor por tema). Permite Primary/Secondary/Danger/Ghost
* com tipografias diferentes. Preenchido em DT_UI_Styles por tema.
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
TSubclassOf<UCommonTextStyle> TextStyle;
};
USTRUCT(BlueprintType)

View File

@@ -8,7 +8,9 @@
#include "Components/TextBlock.h"
#include "Components/Image.h"
#include "Components/SizeBox.h"
#include "Components/ScaleBox.h"
#include "Components/OverlaySlot.h"
#include "CommonTextBlock.h"
#include "CommonActionWidget.h"
namespace
@@ -169,7 +171,36 @@ void UUIButton_Base::RefreshUIStyle()
}
if (ButtonText)
{
// Tipografia: CommonTextStyle da variante (padrão Hyper/CommonUI).
if (VariantStyle.TextStyle)
{
ButtonText->SetStyle(VariantStyle.TextStyle);
}
// Cor: FUIStyle manda na cor por tema (sobrepõe o CommonTextStyle).
ButtonText->SetColorAndOpacity(FSlateColor(VariantStyle.TextColor));
// Alinhamento L/C/R dentro da largura do botão.
ButtonText->SetJustification(TextAlign);
}
// Texto adapta ao tamanho do botão (ScaleToFit) ou usa tamanho fixo.
if (TextScaleBox)
{
TextScaleBox->SetStretch(bAutoSizeText ? EStretch::ScaleToFit : EStretch::None);
// Posiciona o bloco de texto L/C/R dentro do botão (slot do Overlay).
if (UOverlaySlot* OS = Cast<UOverlaySlot>(TextScaleBox->Slot))
{
EHorizontalAlignment H = HAlign_Center;
switch (TextAlign)
{
case ETextJustify::Left: H = HAlign_Left; break;
case ETextJustify::Right: H = HAlign_Right; break;
default: H = HAlign_Center; break;
}
OS->SetHorizontalAlignment(H);
OS->SetVerticalAlignment(VAlign_Center);
}
}
BP_ApplyUIStyle(ActiveStyle.Button, VariantStyle);

View File

@@ -12,6 +12,8 @@ class UBorder;
class UTextBlock;
class UImage;
class USizeBox;
class UScaleBox;
class UCommonTextBlock;
class UCommonActionWidget;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnUIButtonActivatedByTimeout);
@@ -49,7 +51,16 @@ public:
// ---- Text Style ----
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Text Style")
FText ButtonTextValue;
FText ButtonTextValue = FText::FromString(TEXT("Button Text"));
/** Alinhamento do texto dentro do botão (esquerda/centro/direita). */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Text Style")
TEnumAsByte<ETextJustify::Type> TextAlign = ETextJustify::Center;
/** true = texto escala p/ caber no tamanho do botão (ScaleBox ScaleToFit);
* false = usa o tamanho fixo da fonte da variante. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Text Style")
bool bAutoSizeText = true;
// ---- Number Text ----
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Number Text")
@@ -151,7 +162,11 @@ protected:
TObjectPtr<USizeBox> SizeBox_Master;
UPROPERTY(meta = (BindWidgetOptional))
TObjectPtr<UTextBlock> ButtonText;
TObjectPtr<UCommonTextBlock> ButtonText;
/** Envolve o ButtonText: escala o texto p/ caber no botão (bAutoSizeText). */
UPROPERTY(meta = (BindWidgetOptional))
TObjectPtr<UScaleBox> TextScaleBox;
UPROPERTY(meta = (BindWidgetOptional))
TObjectPtr<UTextBlock> Number_Text;