Bugfix Focus Issues in Inventory & Able to Open Inventory in Shop
Able to consistently open & close the inventory without losing focus on root widget
This commit is contained in:
parent
89282de97c
commit
14f4ff4d35
BIN
Content/Blueprints/Game_UI/WBP_ItemDisplay.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Game_UI/WBP_ItemDisplay.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Game_UI/WBP_PlayerInventory.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Game_UI/WBP_PlayerInventory.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Game_UI/WBP_Settings.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Game_UI/WBP_Settings.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Player/BP_MyTempCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Player/BP_MyTempCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Quest_UI/Quest_UI.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Quest_UI/Quest_UI.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
Binary file not shown.
@ -24,11 +24,13 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
{
|
||||
Character->Health = FMath::Clamp(Character->Health + 20, 0, 100);
|
||||
Character->Inventory->RemoveItem(this);
|
||||
return;
|
||||
}
|
||||
else if (Character->Health >= 100)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Health is full"));
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Health is full"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +40,7 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
StatusSystem->AddStatusEffect(NewObject<UStatusEffect>(Character, StrengthBuffStatusEffect));
|
||||
UE_LOG(LogTemp, Display, TEXT("Damage Buffed"));
|
||||
Character->Inventory->RemoveItem(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isProbertiumType)
|
||||
@ -49,6 +52,7 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
TurnBaseCombat->ProbertiumResource = FMath::Clamp(TurnBaseCombat->ProbertiumResource + 2, 0, 20);
|
||||
Character->Inventory->RemoveItem(this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEisType)
|
||||
@ -60,6 +64,7 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
TurnBaseCombat->EisResource = FMath::Clamp(TurnBaseCombat->EisResource + 2, 0, 20);
|
||||
Character->Inventory->RemoveItem(this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAzosType)
|
||||
@ -71,6 +76,7 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
TurnBaseCombat->AzosResource = FMath::Clamp(TurnBaseCombat->AzosResource + 2, 0, 20);
|
||||
Character->Inventory->RemoveItem(this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isIroquoidType)
|
||||
|
@ -90,18 +90,9 @@ void AInteraction::RemoveWidget()
|
||||
//Character & Camera refs
|
||||
TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter());
|
||||
MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>());
|
||||
TempCharacterRef->bShopKeeperText = true;
|
||||
bDisableShopDialMove = true;
|
||||
bisDisabled = true;
|
||||
//Setting ShopWidgetText back to hidden
|
||||
// ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden);
|
||||
// if (ShopDialogWidget->IsVisible())
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UE_LOG(LogTemp, Display, TEXT("You cant open this widget when this widget is open"));
|
||||
// }
|
||||
UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true"));
|
||||
Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
|
||||
if (Property == nullptr)
|
||||
@ -208,9 +199,10 @@ void AInteraction::ExitScreen()
|
||||
}
|
||||
else
|
||||
{
|
||||
TempCharacterRef->InputEnabler();
|
||||
ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden);
|
||||
Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::HitTestInvisible);
|
||||
TempCharacterRef->bShopKeeperText = false;
|
||||
TempCharacterRef->InputEnabler();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
UPROPERTY()
|
||||
UUserWidget* ShopDialogWidget;
|
||||
|
||||
UPROPERTY()
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
UUserWidget* ItemSelectorWidget;
|
||||
|
||||
UPROPERTY()
|
||||
|
@ -147,12 +147,12 @@ void ATempCharacter::LineTraceLogic()
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(OutHit.GetActor()->ActorHasTag(TEXT("Probertium")))
|
||||
if (OutHit.GetActor()->ActorHasTag(TEXT("Probertium")))
|
||||
{
|
||||
AddToInventory();
|
||||
return;
|
||||
}
|
||||
if(OutHit.GetActor()->ActorHasTag(TEXT("Iroquid")))
|
||||
if (OutHit.GetActor()->ActorHasTag(TEXT("Iroquid")))
|
||||
{
|
||||
AddToInventory();
|
||||
return;
|
||||
@ -184,38 +184,12 @@ void ATempCharacter::LineTraceLogic()
|
||||
}
|
||||
// if the actor hit has the interaction component/script then it will activate the code
|
||||
|
||||
if (AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
|
||||
if (const AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
|
||||
{
|
||||
if (MyInteractable->ShopDialogWidget->IsVisible())
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("ShopKeeper text is visible"));
|
||||
bShopKeeperText = true;
|
||||
return;
|
||||
}
|
||||
//if there is no text on screen this triggers
|
||||
else
|
||||
{
|
||||
if (MyInteractable->ItemSelectorWidget->IsVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f);
|
||||
// MyInteractable->OnInteract();
|
||||
// UE_LOG(LogTemp, Display, TEXT("OnInteract activated"));
|
||||
// UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName());
|
||||
//
|
||||
// // While loop to check bisDisabled var until it changes to true
|
||||
// while (MyInteractable->bisDisabled == false || MyInteractable->bDisableShopDialMove == false)
|
||||
// {
|
||||
// if (MyInteractable->bisDisabled == true || MyInteractable->bDisableShopDialMove == true)
|
||||
// {
|
||||
// InputDisabler();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,19 +217,16 @@ void ATempCharacter::AddToInventory()
|
||||
|
||||
void ATempCharacter::InputDisabler()
|
||||
{
|
||||
//Disable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
//TURNING OFF CROSSHAIR
|
||||
|
||||
CrossHairWidget->SetVisibility(ESlateVisibility::Hidden);
|
||||
|
||||
|
||||
//Set to UI Mode Only
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeUIOnly());
|
||||
PlayerController->SetInputMode(FInputModeGameAndUI());
|
||||
PlayerController->bShowMouseCursor = true;
|
||||
PlayerController->SetIgnoreMoveInput(true);
|
||||
PlayerController->SetIgnoreLookInput(true);
|
||||
|
||||
disableTab = true;
|
||||
if (ThisCamera != nullptr)
|
||||
@ -269,18 +240,20 @@ void ATempCharacter::InputDisabler()
|
||||
|
||||
void ATempCharacter::InputEnabler()
|
||||
{
|
||||
//Enable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
//Reset UI Mode
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeGameOnly());
|
||||
PlayerController->bShowMouseCursor = false;
|
||||
PlayerController->SetIgnoreMoveInput(false);
|
||||
PlayerController->SetIgnoreLookInput(false);
|
||||
CrossHairWidget->SetVisibility(ESlateVisibility::HitTestInvisible);
|
||||
|
||||
//Enable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
|
||||
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
|
||||
disableTab = true;
|
||||
TraceDistance = 300;
|
||||
@ -326,5 +299,4 @@ void ATempCharacter::BuyItem(AActor* Item)
|
||||
TraceDistance = 1000;
|
||||
LineTraceLogic();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category= "Items")
|
||||
void BuyItem(AActor* Item);
|
||||
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
bool bShopKeeperText = false;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
|
Loading…
Reference in New Issue
Block a user