(Feat) Add Cooking and Workbench
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user