78 lines
2.4 KiB
C++
78 lines
2.4 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "CustomizationCategoryWidget.generated.h"
|
|
|
|
class UBorder;
|
|
class UButton;
|
|
class UTextBlock;
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCustomizationCategoryClicked, int32, CategoryIndex);
|
|
|
|
/**
|
|
* Une ligne de la colonne de gauche : « Corps », « Cheveux », « Peau »...
|
|
*
|
|
* Elle ne sait pas ce qu'elle designe -- juste un libelle et un index, comme
|
|
* USettingRowWidget ignore ce qu'il regle. C'est l'ecran qui traduit l'index en
|
|
* categorie, et c'est ce qui permet de n'avoir qu'UN widget a dessiner pour les
|
|
* onze entrees.
|
|
*/
|
|
UCLASS(Abstract)
|
|
class SURVIVAL_PROJET_API UCustomizationCategoryWidget : public UUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual void NativeOnInitialized() override;
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Customization")
|
|
FOnCustomizationCategoryClicked OnCategoryClicked;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Customization")
|
|
void Setup(int32 InIndex, const FText& InLabel);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Customization")
|
|
void SetSelected(bool bInSelected);
|
|
|
|
/**
|
|
* L'index de la categorie que porte cette rangee.
|
|
*
|
|
* Indispensable a l'ecran : les categories vides etant sautees, le rang de
|
|
* la rangee dans la colonne ne vaut PAS son index de categorie.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category = "Customization")
|
|
int32 GetCategoryIndex() const { return CategoryIndex; }
|
|
|
|
protected:
|
|
UPROPERTY(meta = (BindWidget))
|
|
TObjectPtr<UButton> CategoryButton;
|
|
|
|
UPROPERTY(meta = (BindWidget))
|
|
TObjectPtr<UTextBlock> CategoryLabel;
|
|
|
|
/** Optionnel : on peut aussi marquer la selection par la couleur du texte. */
|
|
UPROPERTY(meta = (BindWidgetOptional))
|
|
TObjectPtr<UBorder> SelectionBorder;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Customization")
|
|
FLinearColor SelectedLabelColor = FLinearColor(1.f, 0.78f, 0.35f, 1.f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Customization")
|
|
FLinearColor UnselectedLabelColor = FLinearColor(0.8f, 0.8f, 0.8f, 1.f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Customization")
|
|
FLinearColor SelectedBorderColor = FLinearColor(1.f, 1.f, 1.f, 0.12f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Customization")
|
|
FLinearColor UnselectedBorderColor = FLinearColor(1.f, 1.f, 1.f, 0.f);
|
|
|
|
private:
|
|
UFUNCTION()
|
|
void HandleButtonClicked();
|
|
|
|
int32 CategoryIndex = 0;
|
|
};
|