Updated BookUI for Cast & Clear Buttons

This commit is contained in:
Philip W 2023-04-25 03:46:52 +01:00
parent d0eaf37de7
commit 32e65e3f47
7 changed files with 60 additions and 50 deletions

View File

@ -81,7 +81,7 @@ DoubleClickTime=0.200000
+ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Bottom)
+ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
+ActionMappings=(ActionName="Interact",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=E)
+ActionMappings=(ActionName="RightClick",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
+ActionMappings=(ActionName="Click",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
+ActionMappings=(ActionName="Sneak",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftControl)
+AxisMappings=(AxisName="Look Up / Down Gamepad",Scale=1.000000,Key=Gamepad_RightY)
+AxisMappings=(AxisName="Look Up / Down Mouse",Scale=-1.000000,Key=MouseY)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,6 @@
#include "BehaviorTree/BlackboardComponent.h"
#include "Components/TextBlock.h"
#include "Components/ProgressBar.h"
#include "GameFramework/Character.h"
#include "Kismet/GameplayStatics.h"
#include "the_twilight_abyss/PlayerTemp/TempCharacter.h"
@ -36,6 +35,7 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
{
if (Enemy == nullptr) return;
if (bIsInCombat) return;
const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY());
GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2);
bIsInCombat = true;
@ -74,14 +74,10 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
IroquoidResource = 10;
//Disable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
}
//Set to UI Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeUIOnly());
PlayerController->SetIgnoreMoveInput(true);
PlayerController->SetIgnoreLookInput(true);
PlayerController->SetInputMode(FInputModeGameAndUI());
PlayerController->bShowMouseCursor = true;
FVector Direction = Enemy->GetActorLocation() - PlayerActor->GetActorLocation();
@ -117,12 +113,10 @@ void ATurnBaseCombatV2::EndCombat()
PlayerPawn->bUseControllerRotationYaw = true;
PlayerPawn->bUseControllerRotationPitch = true;
//Enable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
}
//Set to Game Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetIgnoreMoveInput(false);
PlayerController->SetIgnoreLookInput(false);
PlayerController->SetInputMode(FInputModeGameOnly());
PlayerController->bShowMouseCursor = false;
}
@ -160,13 +154,13 @@ void ATurnBaseCombatV2::BeginPlay()
EisResourceBar = Cast<UProgressBar>(BookHUD->GetWidgetFromName("EisResourceBar"));
AzosResourceBar = Cast<UProgressBar>(BookHUD->GetWidgetFromName("AzosResourceBar"));
IroquoidResourceBar = Cast<UProgressBar>(BookHUD->GetWidgetFromName("IroquoidResourceBar"));
CastButton = Cast<UButton>(HUD->GetWidgetFromName("CastButton"));
PButton = Cast<UButton>(HUD->GetWidgetFromName("PButton"));
EButton = Cast<UButton>(HUD->GetWidgetFromName("EButton"));
AButton = Cast<UButton>(HUD->GetWidgetFromName("AButton"));
IButton = Cast<UButton>(HUD->GetWidgetFromName("IButton"));
BackspaceButton = Cast<UButton>(HUD->GetWidgetFromName("BackspaceButton"));
RunButton = Cast<UButton>(HUD->GetWidgetFromName("RunButton"));
CastButton = Cast<UButton>(BookHUD->GetWidgetFromName("Cast_Button"));
PButton = Cast<UButton>(BookHUD->GetWidgetFromName("Probertium_Button"));
EButton = Cast<UButton>(BookHUD->GetWidgetFromName("Eis_Button"));
AButton = Cast<UButton>(BookHUD->GetWidgetFromName("Azos_Button"));
IButton = Cast<UButton>(BookHUD->GetWidgetFromName("Iroquoid_Button"));
BackspaceButton = Cast<UButton>(BookHUD->GetWidgetFromName("Clear_Button"));
RunButton = Cast<UButton>(BookHUD->GetWidgetFromName("Escape_Button"));
CastButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::CastButtonOnClick);
PButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::PButtonOnClick);
EButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::EButtonOnClick);
@ -226,7 +220,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
}
}
if (GunEffect)
if (GunEffect && !bIsInCombat)
{
const UStaticMeshComponent* GunComponent = Cast<UStaticMeshComponent>(PlayerActor->GetComponentsByTag(UPrimitiveComponent::StaticClass(), FName("Gun"))[0]);
const FVector GunLocationOffset = GunComponent->GetSocketTransform("Muzzle").TransformPosition(FVector(-100, 0, 0));
@ -418,31 +412,56 @@ void ATurnBaseCombatV2::IButtonOnClick()
void ATurnBaseCombatV2::BackspaceButtonOnClick()
{
if (CurrentComboString.Len() <= 0)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Blank Combo"));
return;
}
ReuseActionPoint();
if (CurrentComboString.Right(1) == "P")
for (int i = 0; i < CurrentComboString.Len(); i++)
{
ProbertiumResource += 1;
if (CurrentComboString[i] == 'P')
{
ProbertiumResource += 1;
}
else if (CurrentComboString[i] == 'E')
{
EisResource += 1;
}
else if (CurrentComboString[i] == 'A')
{
AzosResource += 1;
}
else if (CurrentComboString[i] == 'I')
{
IroquoidResource += 1;
}
}
else if (CurrentComboString.Right(1) == "E")
{
EisResource += 1;
}
else if (CurrentComboString.Right(1) == "A")
{
AzosResource += 1;
}
else if (CurrentComboString.Right(1) == "I")
{
IroquoidResource += 1;
}
CurrentComboString.RemoveAt(CurrentComboString.Len() - 1);
CurrentComboString = "";
UpdateComboString(CurrentComboString);
RevertActionPoints();
UpdateActionPoints();
UpdateResourceBars();
// ReuseActionPoint();
// if (CurrentComboString.Right(1) == "P")
// {
// ProbertiumResource += 1;
// }
// else if (CurrentComboString.Right(1) == "E")
// {
// EisResource += 1;
// }
// else if (CurrentComboString.Right(1) == "A")
// {
// AzosResource += 1;
// }
// else if (CurrentComboString.Right(1) == "I")
// {
// IroquoidResource += 1;
// }
// CurrentComboString.RemoveAt(CurrentComboString.Len() - 1);
// UpdateComboString(CurrentComboString);
// UpdateResourceBars();
}
void ATurnBaseCombatV2::RunButtonOnClick()