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;