diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index ead7abb..5cb2b8a 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -31,9 +31,16 @@ void AInteraction::Tick(float DeltaTime) void AInteraction::OnInteract() { - CurrentWidget = CreateWidget(GetWorld(), Widget); - CurrentWidget->AddToViewport(0); - //handles the widget dissapearing from the viewport + ShopDialogWidget = CreateWidget(GetWorld(), ShopDialog); + if (ShopDialogWidget == nullptr) + { + return; + } + else + { + ShopDialogWidget->AddToViewport(0); + } + //handles the widget disappearing from the viewport FTimerHandle WidgetTimer; GetWorldTimerManager().SetTimer(WidgetTimer, this, &AInteraction::RemoveWidget, WaitTimer, false); @@ -42,7 +49,15 @@ void AInteraction::OnInteract() void AInteraction::RemoveWidget() { bisDisabled = true; - CurrentWidget->RemoveFromViewport(); + ShopDialogWidget->RemoveFromViewport(); UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true")); - + ItemSelectorWidget = CreateWidget(GetWorld(), ItemSelector); + if (ItemSelectorWidget == nullptr) + { + return; + } + else + { + ItemSelectorWidget->AddToViewport(0); + } } \ No newline at end of file diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h index 2a6104a..fbeb15d 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h @@ -24,13 +24,20 @@ public: virtual void Tick(float DeltaTime) override; UPROPERTY(EditAnywhere) - TSubclassOf Widget; + TSubclassOf ShopDialog; + + UPROPERTY(EditAnywhere) + TSubclassOf ItemSelector; virtual void OnInteract(); virtual void RemoveWidget(); + UPROPERTY() - UUserWidget* CurrentWidget; + UUserWidget* ShopDialogWidget; + + UPROPERTY() + UUserWidget* ItemSelectorWidget; UPROPERTY(EditAnywhere) float WaitTimer = 8.0f;