Updated TempCharacter to fix merchant exit bug and cached escapemenu

This commit is contained in:
MarcelHara 2023-05-13 17:58:13 +01:00
parent b446ba7691
commit 7c7fb0db01
2 changed files with 12 additions and 4 deletions

View File

@ -50,13 +50,13 @@ void ATempCharacter::BeginPlay()
CrossHairWidget->SetVisibility(ESlateVisibility::Visible); CrossHairWidget->SetVisibility(ESlateVisibility::Visible);
CrossHairWidget->AddToViewport(); CrossHairWidget->AddToViewport();
// ImportantStatsWidget = CreateWidget<UUserWidget>(GetWorld(), ImportantStatsSub);
// ImportantStatsWidget->SetVisibility(ESlateVisibility::Visible);
// ImportantStatsWidget->AddToViewport();
InventoryWidget = CreateWidget<UUserWidget>(GetWorld(), InventoryMenuSub); InventoryWidget = CreateWidget<UUserWidget>(GetWorld(), InventoryMenuSub);
InventoryWidget->SetVisibility(ESlateVisibility::Hidden); InventoryWidget->SetVisibility(ESlateVisibility::Hidden);
InventoryWidget->AddToViewport(); InventoryWidget->AddToViewport();
EscapeMenuWidget = CreateWidget<UUserWidget>(GetWorld(), EscapeMenuSub);
EscapeMenuWidget->SetVisibility(ESlateVisibility::Hidden);
EscapeMenuWidget->AddToViewport();
} }
//Binds the input we made in the setup player component to the forward vector //Binds the input we made in the setup player component to the forward vector
@ -278,6 +278,8 @@ void ATempCharacter::InputEnabler()
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeGameOnly()); PlayerController->SetInputMode(FInputModeGameOnly());
PlayerController->bShowMouseCursor = false; PlayerController->bShowMouseCursor = false;
PlayerController->SetIgnoreMoveInput(false);
PlayerController->SetIgnoreLookInput(false);
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
disableTab = true; disableTab = true;

View File

@ -120,6 +120,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets")
UUserWidget* InventoryWidget; UUserWidget* InventoryWidget;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets")
UUserWidget* EscapeMenuWidget;
UPROPERTY(EditAnywhere, Category= "Widgets") UPROPERTY(EditAnywhere, Category= "Widgets")
TSubclassOf<UUserWidget> ImportantStatsSub; TSubclassOf<UUserWidget> ImportantStatsSub;
@ -127,6 +130,9 @@ public:
UPROPERTY(EditAnywhere, Category= "Widgets") UPROPERTY(EditAnywhere, Category= "Widgets")
TSubclassOf<UUserWidget> InventoryMenuSub; TSubclassOf<UUserWidget> InventoryMenuSub;
UPROPERTY(EditAnywhere, Category= "Widgets")
TSubclassOf<UUserWidget> EscapeMenuSub;
UPROPERTY(EditAnywhere, Category= "Widgets") UPROPERTY(EditAnywhere, Category= "Widgets")
TSubclassOf<UUserWidget> CrossHairSub; TSubclassOf<UUserWidget> CrossHairSub;