From ca117a559ea6f722aad275cc9dfc201fc7213bf3 Mon Sep 17 00:00:00 2001 From: Mateus Rodrigues Date: Tue, 19 May 2026 00:52:10 -0300 Subject: [PATCH] feat(ui): painel texturizado (padrao Hyper) coexistindo com modo cor EUIPanelTexture (None, Rectangle_Horizontal_01/02/03, Vertical_01..04, Square_01, Vertical_Footer_01) - espelha o enum Panel do Hyper. FUIStylePanel ganha TMap PanelBackground + PanelOutline (modelo Struct_UI_Style_Panels), mantendo os tokens de cor. UUIPanel_Base: prop PanelTexture + border Outline; RefreshUIStyle tenta modo TEXTURA (Find brush nos mapas -> SetBrush em Background/Outline) e cai no modo COR (RoundedBox) se nao houver brush. Compila OK. Texturas Aurora Arcana proprias serao geradas (nao importadas do Hyper). Co-Authored-By: Claude Opus 4.7 (1M context) --- Source/ZMMO/Data/UI/UIStyleTokens.h | 12 +++++++ Source/ZMMO/Data/UI/UIStyleTypes.h | 19 ++++++++++ Source/ZMMO/Game/UI/Widgets/UIPanel_Base.cpp | 37 +++++++++++++++++--- Source/ZMMO/Game/UI/Widgets/UIPanel_Base.h | 12 +++++++ 4 files changed, 76 insertions(+), 4 deletions(-) diff --git a/Source/ZMMO/Data/UI/UIStyleTokens.h b/Source/ZMMO/Data/UI/UIStyleTokens.h index 2bb2070..6889486 100644 --- a/Source/ZMMO/Data/UI/UIStyleTokens.h +++ b/Source/ZMMO/Data/UI/UIStyleTokens.h @@ -2,6 +2,7 @@ #include "CoreMinimal.h" #include "Fonts/SlateFontInfo.h" +#include "Styling/SlateBrush.h" #include "Layout/Margin.h" #include "Templates/SubclassOf.h" #include "UIStyleTypes.h" @@ -331,6 +332,17 @@ struct ZMMO_API FUIStylePanel UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel") FLinearColor CardSelectedBg = FLinearColor(FColor(24, 32, 58)); + + /** + * Modo texturizado (espelha Struct_UI_Style_Panels do Hyper): brush por + * EUIPanelTexture. PanelBackground = fundo; PanelOutline = contorno. + * Se vazio p/ a chave, o painel usa o modo cor (RoundedBox) acima. + */ + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel|Texture") + TMap PanelBackground; + + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel|Texture") + TMap PanelOutline; }; USTRUCT(BlueprintType) diff --git a/Source/ZMMO/Data/UI/UIStyleTypes.h b/Source/ZMMO/Data/UI/UIStyleTypes.h index 9dd844f..ff641cb 100644 --- a/Source/ZMMO/Data/UI/UIStyleTypes.h +++ b/Source/ZMMO/Data/UI/UIStyleTypes.h @@ -52,6 +52,25 @@ enum class EUIPanelType : uint8 Card UMETA(DisplayName = "Card") }; +/** + * Conjunto de textura/silhueta do painel (espelha o enum "Panel" do Hyper). + * Indexa os mapas de FSlateBrush em FUIStylePanel (bg + outline). + */ +UENUM(BlueprintType) +enum class EUIPanelTexture : uint8 +{ + None UMETA(DisplayName = "None"), + Rectangle_Horizontal_01 UMETA(DisplayName = "Rectangle Horizontal 01"), + Rectangle_Horizontal_02 UMETA(DisplayName = "Rectangle Horizontal 02"), + Rectangle_Horizontal_03 UMETA(DisplayName = "Rectangle Horizontal 03"), + Rectangle_Vertical_01 UMETA(DisplayName = "Rectangle Vertical 01"), + Rectangle_Vertical_02 UMETA(DisplayName = "Rectangle Vertical 02"), + Rectangle_Vertical_03 UMETA(DisplayName = "Rectangle Vertical 03"), + Rectangle_Vertical_04 UMETA(DisplayName = "Rectangle Vertical 04"), + Rectangle_Square_01 UMETA(DisplayName = "Rectangle Square 01"), + Vertical_Footer_01 UMETA(DisplayName = "Vertical Footer 01") +}; + UENUM(BlueprintType) enum class EUIProgressBarType : uint8 { diff --git a/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.cpp b/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.cpp index 33897e0..ab9fe10 100644 --- a/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.cpp +++ b/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.cpp @@ -34,13 +34,42 @@ void UUIPanel_Base::RefreshUIStyle() const FUIStyle& AS = ResolvePanelStyle(this, Fallback); const FUIStylePanel& P = AS.Panel; + // ---- Modo TEXTURA (padrão Hyper): brush por EUIPanelTexture ---- + const FSlateBrush* BgTex = (PanelTexture != EUIPanelTexture::None) + ? P.PanelBackground.Find(PanelTexture) : nullptr; + if (BgTex) + { + Background->SetBrush(*BgTex); + Background->SetPadding(bUseSmallPadding ? P.PaddingSmall : P.Padding); + if (Outline) + { + if (const FSlateBrush* OlTex = P.PanelOutline.Find(PanelTexture)) + { + Outline->SetBrush(*OlTex); + Outline->SetVisibility(ESlateVisibility::HitTestInvisible); + } + else + { + Outline->SetVisibility(ESlateVisibility::Collapsed); + } + } + BP_ApplyPanelStyle(P); + return; + } + + // ---- Modo COR (RoundedBox) ---- + if (Outline) + { + Outline->SetVisibility(ESlateVisibility::Collapsed); + } + FLinearColor Fill; - FLinearColor Outline = P.BorderColor; + FLinearColor OutlineColor = P.BorderColor; switch (PanelType) { case EUIPanelType::Secondary: Fill = P.BgRaised; break; case EUIPanelType::Tertiary: Fill = P.BgSunken; break; - case EUIPanelType::Card: Fill = P.CardSelectedBg; Outline = P.CardSelectedBorder; break; + case EUIPanelType::Card: Fill = P.CardSelectedBg; OutlineColor = P.CardSelectedBorder; break; case EUIPanelType::Primary: case EUIPanelType::None: default: Fill = P.Bg; break; @@ -53,14 +82,14 @@ void UUIPanel_Base::RefreshUIStyle() const float R = bUseSmallPadding ? P.CornerRadiusSmall : P.CornerRadius; Brush.DrawAs = ESlateBrushDrawType::RoundedBox; Brush.OutlineSettings = FSlateBrushOutlineSettings( - FVector4(R, R, R, R), FSlateColor(Outline), P.BorderWidth); + FVector4(R, R, R, R), FSlateColor(OutlineColor), P.BorderWidth); Brush.OutlineSettings.RoundingType = ESlateBrushRoundingType::FixedRadius; } else { Brush.DrawAs = ESlateBrushDrawType::Box; Brush.OutlineSettings = FSlateBrushOutlineSettings( - FVector4(0, 0, 0, 0), FSlateColor(Outline), P.BorderWidth); + FVector4(0, 0, 0, 0), FSlateColor(OutlineColor), P.BorderWidth); } Background->SetBrush(Brush); Background->SetPadding(bUseSmallPadding ? P.PaddingSmall : P.Padding); diff --git a/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.h b/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.h index 8acab60..6ecc615 100644 --- a/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.h +++ b/Source/ZMMO/Game/UI/Widgets/UIPanel_Base.h @@ -36,6 +36,14 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel") bool bUseSmallPadding = false; + /** + * Conjunto de textura (modo Hyper). Se != None E houver brush no mapa + * FUIStylePanel.PanelBackground p/ esta chave, usa o painel TEXTURIZADO + * (brush bg + outline). Senão, cai no modo COR (RoundedBox acima). + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel") + EUIPanelTexture PanelTexture = EUIPanelTexture::None; + /** Re-resolve os tokens do tema ativo e reaplica no Background. */ UFUNCTION(BlueprintCallable, Category = "UI Style") void RefreshUIStyle(); @@ -54,6 +62,10 @@ protected: UPROPERTY(meta = (BindWidgetOptional)) TObjectPtr Background; + /** Contorno texturizado por cima do fundo (modo textura, padrão Hyper). */ + UPROPERTY(meta = (BindWidgetOptional)) + TObjectPtr Outline; + UPROPERTY(meta = (BindWidgetOptional)) TObjectPtr Content;