60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "CraftingComponent.h"
|
|
#include "CraftingIngredientRowWidget.generated.h"
|
|
|
|
class UImage;
|
|
class UTextBlock;
|
|
|
|
/**
|
|
* Une ligne de cout dans le panneau de detail : l'icone d'un ingredient, son
|
|
* nom, et "2/3" colore selon qu'on l'a ou non.
|
|
*
|
|
* Elle ne consulte jamais l'inventaire : UCraftingComponent lui remet un
|
|
* FCraftIngredientStatus deja calcule. Une ligne qui irait compter elle-meme
|
|
* referait le travail autant de fois qu'il y a d'ingredients, et pourrait
|
|
* afficher autre chose que ce sur quoi le bouton Fabriquer s'appuie.
|
|
*/
|
|
UCLASS(Abstract)
|
|
class EMBERWILD_API UCraftingIngredientRowWidget : public UUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/** Affiche un ingredient et applique la couleur qui va avec. */
|
|
UFUNCTION(BlueprintCallable, Category = "Crafting")
|
|
void SetIngredient(const FCraftIngredientStatus& Status);
|
|
|
|
protected:
|
|
/** Facultatif : l'icone de la ressource demandee. */
|
|
UPROPERTY(meta = (BindWidgetOptional))
|
|
TObjectPtr<UImage> IngredientIcon;
|
|
|
|
/** Facultatif : le nom de la ressource. */
|
|
UPROPERTY(meta = (BindWidgetOptional))
|
|
TObjectPtr<UTextBlock> IngredientNameText;
|
|
|
|
/** Obligatoire : c'est lui qui porte le "2/3". A nommer "IngredientCountText". */
|
|
UPROPERTY(meta = (BindWidget))
|
|
TObjectPtr<UTextBlock> IngredientCountText;
|
|
|
|
/** Couleur du compteur quand la ressource est en quantite suffisante. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Crafting")
|
|
FLinearColor EnoughColor = FLinearColor(0.35f, 0.85f, 0.35f, 1.f);
|
|
|
|
/** Couleur du compteur quand il en manque. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Crafting")
|
|
FLinearColor MissingColor = FLinearColor(0.9f, 0.3f, 0.3f, 1.f);
|
|
|
|
/**
|
|
* Mise en forme du compteur. {0} = possede, {1} = requis.
|
|
* Exposee pour pouvoir passer a "2 / 3" ou "2 sur 3" sans recompiler.
|
|
*/
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Crafting")
|
|
FText CountFormat = NSLOCTEXT("Crafting", "IngredientCountFormat", "{0}/{1}");
|
|
};
|