65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/TextBlock.h"
|
|
#include "Engine/DataTable.h"
|
|
#include "Math/Color.h"
|
|
|
|
#include "EleriTextBlock.generated.h"
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FEleriTextStyleRow : public FTableRowBase
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
|
FSlateFontInfo Font;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
|
FLinearColor Color = FLinearColor::White;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
|
FVector2D ShadowOffset = FVector2D::ZeroVector;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
|
FLinearColor ShadowColor = FLinearColor(0.f, 0.f, 0.f, 0.f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
|
float LineHeightPercentage = 1.f;
|
|
};
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class PROJECTELERI_API UEleriTextBlock : public UTextBlock
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UEleriTextBlock(const FObjectInitializer& ObjectInitializer);
|
|
virtual void SynchronizeProperties() override;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
FLinearColor ColorOverride =FLinearColor(0.f, 0.f, 0.f, 0.f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
int32 FontSizeOverride = INDEX_NONE;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style", meta = (GetOptions = "GetStyleNames"))
|
|
FName StyleName = "Normal";
|
|
|
|
protected:
|
|
|
|
UFUNCTION()
|
|
TArray<FString> GetStyleNames() const;
|
|
|
|
private:
|
|
UPROPERTY()
|
|
TObjectPtr<UDataTable> StyleTable;
|
|
|
|
void ApplyStyle();
|
|
};
|