From 32e65e3f47faa1af0b9630510df7c542d2ff01bf Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 25 Apr 2023 03:46:52 +0100 Subject: [PATCH] Updated BookUI for Cast & Clear Buttons --- Config/DefaultInput.ini | 2 +- .../Blueprints/Combat_UI/BookCombat_UI.uasset | 4 +- .../Combat_UI/CombatCharacter.uasset | 4 +- .../__RealTime/CombatCharacterRT.uasset | 3 - .../Combat_UI/__RealTime/Combat_UI_RT.uasset | 3 - .../__RealTime/RealTimeCombatTest.uasset | 3 - .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 91 +++++++++++-------- 7 files changed, 60 insertions(+), 50 deletions(-) delete mode 100644 Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset delete mode 100644 Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset delete mode 100644 Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index 8698439..73b2f08 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -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) diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index 008b2d8..8e99704 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af6df165486accabe06ae7afae04790ba557aa04842343a9b6791952b08bd747 -size 105696 +oid sha256:ecfd07e9b330ccfe419588e7b9709078aef64367f41368bea4f52c5d310bb5fb +size 117245 diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index da92e03..bdcc2d3 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2324577c80acdf9a2bad2b0923dabf42f580b80b6e391aa2f44aeaf528b57fe5 -size 131883 +oid sha256:2288fc028031dde43dddc963534df07aabf9d878a4c0f0ae4c7bd2bc88b9be16 +size 142363 diff --git a/Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset b/Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset deleted file mode 100644 index d1d4ede..0000000 --- a/Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fc9eb13d6d72b8b0ed0e1ffa48c052e1a6d579087fd566fd400dbe2b4d9636f8 -size 79436 diff --git a/Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset b/Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset deleted file mode 100644 index 4e9640d..0000000 --- a/Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8dfba51c1e874efc1e3d3d04fb94601fde10f98bde12c05080fd5461107d74f3 -size 46237 diff --git a/Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset b/Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset deleted file mode 100644 index d573236..0000000 --- a/Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8eea345343389a3c9c52ae3ff4f51e0b8c0d2083650e05e1596db4d065ec42ae -size 29452 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 1b7fd56..58cd163 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -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(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(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(BookHUD->GetWidgetFromName("EisResourceBar")); AzosResourceBar = Cast(BookHUD->GetWidgetFromName("AzosResourceBar")); IroquoidResourceBar = Cast(BookHUD->GetWidgetFromName("IroquoidResourceBar")); - CastButton = Cast(HUD->GetWidgetFromName("CastButton")); - PButton = Cast(HUD->GetWidgetFromName("PButton")); - EButton = Cast(HUD->GetWidgetFromName("EButton")); - AButton = Cast(HUD->GetWidgetFromName("AButton")); - IButton = Cast(HUD->GetWidgetFromName("IButton")); - BackspaceButton = Cast(HUD->GetWidgetFromName("BackspaceButton")); - RunButton = Cast(HUD->GetWidgetFromName("RunButton")); + CastButton = Cast(BookHUD->GetWidgetFromName("Cast_Button")); + PButton = Cast(BookHUD->GetWidgetFromName("Probertium_Button")); + EButton = Cast(BookHUD->GetWidgetFromName("Eis_Button")); + AButton = Cast(BookHUD->GetWidgetFromName("Azos_Button")); + IButton = Cast(BookHUD->GetWidgetFromName("Iroquoid_Button")); + BackspaceButton = Cast(BookHUD->GetWidgetFromName("Clear_Button")); + RunButton = Cast(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(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()