(Feat) Add Cooking and Workbench

This commit is contained in:
2026-08-01 00:03:53 +02:00
parent 3f3ae1f5fa
commit d50ef564ba
360 changed files with 5316 additions and 67 deletions
@@ -40,16 +40,16 @@ void UInteractionPromptWidget::BindToOwningPawn()
if (BoundComponent.IsValid())
{
BoundComponent->OnFocusChanged.RemoveDynamic(this, &UInteractionPromptWidget::HandleFocusChanged);
BoundComponent->OnPromptChanged.RemoveDynamic(this, &UInteractionPromptWidget::HandlePromptChanged);
}
BoundComponent = NewComponent;
if (BoundComponent.IsValid())
{
// Abonnement au delegue : le widget ne se reveille que quand la cible
// Abonnement au delegue : le widget ne se reveille que quand le texte
// change vraiment. Pas de Tick, pas de polling.
BoundComponent->OnFocusChanged.AddDynamic(this, &UInteractionPromptWidget::HandleFocusChanged);
BoundComponent->OnPromptChanged.AddDynamic(this, &UInteractionPromptWidget::HandlePromptChanged);
}
else
{
@@ -65,14 +65,14 @@ void UInteractionPromptWidget::NativeDestruct()
// vers un widget detruit -- typiquement au changement de niveau.
if (BoundComponent.IsValid())
{
BoundComponent->OnFocusChanged.RemoveDynamic(this, &UInteractionPromptWidget::HandleFocusChanged);
BoundComponent->OnPromptChanged.RemoveDynamic(this, &UInteractionPromptWidget::HandlePromptChanged);
}
BoundComponent.Reset();
Super::NativeDestruct();
}
void UInteractionPromptWidget::HandleFocusChanged(AActor* NewFocus, AActor* OldFocus)
void UInteractionPromptWidget::HandlePromptChanged(const FText& NewPrompt)
{
Refresh();
}
@@ -91,6 +91,9 @@ void UInteractionPromptWidget::Refresh()
if (PromptText)
{
// Un prompt non vide est toujours une action realisable : les cibles ne
// renvoient jamais de texte purement informatif, donc la touche a
// toujours sa place devant.
PromptText->SetText(FText::Format(PromptFormat, GetInteractKeyDisplayName(), Prompt));
}