(Feat) Add Craft Systeme
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "CraftingIngredientRowWidget.h"
|
||||
|
||||
#include "Components/Image.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "ItemDataAsset.h"
|
||||
|
||||
void UCraftingIngredientRowWidget::SetIngredient(const FCraftIngredientStatus& Status)
|
||||
{
|
||||
if (IngredientIcon)
|
||||
{
|
||||
UTexture2D* Icon = Status.Item ? Status.Item->Icon : nullptr;
|
||||
if (Icon)
|
||||
{
|
||||
IngredientIcon->SetBrushFromTexture(Icon);
|
||||
IngredientIcon->SetVisibility(ESlateVisibility::HitTestInvisible);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sans ca, un objet sans icone afficherait le carre blanc du brush
|
||||
// par defaut au milieu de la liste.
|
||||
IngredientIcon->SetVisibility(ESlateVisibility::Hidden);
|
||||
}
|
||||
}
|
||||
|
||||
if (IngredientNameText)
|
||||
{
|
||||
IngredientNameText->SetText(Status.Item ? Status.Item->DisplayName : FText::GetEmpty());
|
||||
}
|
||||
|
||||
if (IngredientCountText)
|
||||
{
|
||||
IngredientCountText->SetText(FText::Format(CountFormat,
|
||||
FText::AsNumber(Status.OwnedQuantity),
|
||||
FText::AsNumber(Status.RequiredQuantity)));
|
||||
|
||||
IngredientCountText->SetColorAndOpacity(FSlateColor(Status.IsSatisfied() ? EnoughColor : MissingColor));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user