From d8a4603651d66b76a3025e748065d3d3ef24337d Mon Sep 17 00:00:00 2001 From: MarcelHara Date: Mon, 8 May 2023 20:03:54 +0100 Subject: [PATCH 1/6] Updated Merchant to fix buttons not working --- .../the_twilight_abyss/BaseItems/Items/BaseItem.h | 2 +- .../MerchantInteraction/Interaction.cpp | 13 ++++++++++--- .../the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h index de0964b..2cdcf5c 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h @@ -76,7 +76,7 @@ public: class UInventoryComponent* StoredItems; //The buy class to purchase the item - virtual void Buy(class ATempCharacter* PurchaseItem) PURE_VIRTUAL(UBaseItem); // WILL SET THIS UP LATER + virtual void Buy(class ATempCharacter* BuyItem) PURE_VIRTUAL(UBaseItem); // WILL SET THIS UP LATER //The use Item class to use the item in the player Inventory virtual void Use(class ATempCharacter* Character); diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index a3ee695..e9dbe65 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -25,8 +25,8 @@ void AInteraction::BeginPlay() Super::BeginPlay(); //Character & Camera refs - if (TempCharacterRef != nullptr) TempCharacterRef = Cast(GetWorld()->GetFirstPlayerController()->GetCharacter()); - if (MainCamera != nullptr) MainCamera = Cast(TempCharacterRef->FindComponentByClass()); + TempCharacterRef = Cast(GetWorld()->GetFirstPlayerController()->GetCharacter()); + MainCamera = Cast(TempCharacterRef->FindComponentByClass()); //Item refs TargetHealingLocation = HealingItem->GetActorLocation(); @@ -130,7 +130,14 @@ void AInteraction::CameraLeftMover() UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed")); if (TempCharacterRef == nullptr || BuyHealingProperty == nullptr) { - UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); + if (TempCharacterRef == nullptr) + { + UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); + } + else if (BuyHealingProperty == nullptr) + { + UE_LOG(LogTemp, Display, TEXT("HealingItem Not Found")); + } return; } else diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 77c5aa7..c3f4d17 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -272,7 +272,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item) void ATempCharacter::BuyItem(AActor* Item) { UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); - auto ItemArray = Item->FindComponentByClass()->GetItem(0); + UBaseItem* ItemArray = Item->FindComponentByClass()->GetItem(0); if (GoldBalance <= 0) { UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); From 06f424883b087df9444abe25cb2a5d7734425310 Mon Sep 17 00:00:00 2001 From: MarcelHara Date: Tue, 9 May 2023 00:00:30 +0100 Subject: [PATCH 2/6] Created and Imported new UI assets for merchant --- Content/Images/MerchantUI/BLCK_ArrowLeftFilled.uasset | 3 +++ Content/Images/MerchantUI/BLCK_ArrowLeftHollow.uasset | 3 +++ Content/Images/MerchantUI/BLCK_ArrowLeftShadowFilled.uasset | 3 +++ Content/Images/MerchantUI/BLCK_ArrowRightFilled.uasset | 3 +++ Content/Images/MerchantUI/BLCK_ArrowRightFilledShadow.uasset | 3 +++ Content/Images/MerchantUI/BLCK_ArrowRightHollowi.uasset | 3 +++ Content/Images/MerchantUI/BuyShadow.uasset | 3 +++ Content/Images/MerchantUI/BuyUI.uasset | 3 +++ Content/Images/MerchantUI/CancelShadow.uasset | 3 +++ Content/Images/MerchantUI/CancelUi.uasset | 3 +++ Content/Images/MerchantUI/ExitButtonBlack.uasset | 3 +++ Content/Images/MerchantUI/ExitShadow.uasset | 3 +++ 12 files changed, 36 insertions(+) create mode 100644 Content/Images/MerchantUI/BLCK_ArrowLeftFilled.uasset create mode 100644 Content/Images/MerchantUI/BLCK_ArrowLeftHollow.uasset create mode 100644 Content/Images/MerchantUI/BLCK_ArrowLeftShadowFilled.uasset create mode 100644 Content/Images/MerchantUI/BLCK_ArrowRightFilled.uasset create mode 100644 Content/Images/MerchantUI/BLCK_ArrowRightFilledShadow.uasset create mode 100644 Content/Images/MerchantUI/BLCK_ArrowRightHollowi.uasset create mode 100644 Content/Images/MerchantUI/BuyShadow.uasset create mode 100644 Content/Images/MerchantUI/BuyUI.uasset create mode 100644 Content/Images/MerchantUI/CancelShadow.uasset create mode 100644 Content/Images/MerchantUI/CancelUi.uasset create mode 100644 Content/Images/MerchantUI/ExitButtonBlack.uasset create mode 100644 Content/Images/MerchantUI/ExitShadow.uasset diff --git a/Content/Images/MerchantUI/BLCK_ArrowLeftFilled.uasset b/Content/Images/MerchantUI/BLCK_ArrowLeftFilled.uasset new file mode 100644 index 0000000..edb8fa3 --- /dev/null +++ b/Content/Images/MerchantUI/BLCK_ArrowLeftFilled.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94df9caa7916cb5e2f57f3f3ed597f4b8a2d77acfd2d1d695295fe9ddf09dcde +size 21284 diff --git a/Content/Images/MerchantUI/BLCK_ArrowLeftHollow.uasset b/Content/Images/MerchantUI/BLCK_ArrowLeftHollow.uasset new file mode 100644 index 0000000..4a29314 --- /dev/null +++ b/Content/Images/MerchantUI/BLCK_ArrowLeftHollow.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9cd6abe6bd1809efec8fbd89358c41e45b70dc685b76f01c44fa4e5d90186fd +size 44177 diff --git a/Content/Images/MerchantUI/BLCK_ArrowLeftShadowFilled.uasset b/Content/Images/MerchantUI/BLCK_ArrowLeftShadowFilled.uasset new file mode 100644 index 0000000..42dc7c2 --- /dev/null +++ b/Content/Images/MerchantUI/BLCK_ArrowLeftShadowFilled.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:304bda79b7076bc1e1d996ac51f8df1435ca4abbc2036c1c6e153a43c7468ff8 +size 47254 diff --git a/Content/Images/MerchantUI/BLCK_ArrowRightFilled.uasset b/Content/Images/MerchantUI/BLCK_ArrowRightFilled.uasset new file mode 100644 index 0000000..eae34c7 --- /dev/null +++ b/Content/Images/MerchantUI/BLCK_ArrowRightFilled.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:516dd005d4b3c1b1b8f3adfc8778c5da60d2535e1d4d054c159fd448d65d4d9b +size 21196 diff --git a/Content/Images/MerchantUI/BLCK_ArrowRightFilledShadow.uasset b/Content/Images/MerchantUI/BLCK_ArrowRightFilledShadow.uasset new file mode 100644 index 0000000..09de161 --- /dev/null +++ b/Content/Images/MerchantUI/BLCK_ArrowRightFilledShadow.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cac5340e1a58d5f49a290d63e2a0a892e8d43ab0b05171f30fe4c36054129c2c +size 46502 diff --git a/Content/Images/MerchantUI/BLCK_ArrowRightHollowi.uasset b/Content/Images/MerchantUI/BLCK_ArrowRightHollowi.uasset new file mode 100644 index 0000000..efb3922 --- /dev/null +++ b/Content/Images/MerchantUI/BLCK_ArrowRightHollowi.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de3e6f519363db918568ea4c3595a235b86d3b16a12011fe45de667f2045dc03 +size 44261 diff --git a/Content/Images/MerchantUI/BuyShadow.uasset b/Content/Images/MerchantUI/BuyShadow.uasset new file mode 100644 index 0000000..31bd8ea --- /dev/null +++ b/Content/Images/MerchantUI/BuyShadow.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56c38ad0e18cf413b73482acadaeb7ca996a1e2fc4961405c23779a19b1ae6f1 +size 120727 diff --git a/Content/Images/MerchantUI/BuyUI.uasset b/Content/Images/MerchantUI/BuyUI.uasset new file mode 100644 index 0000000..5d95f45 --- /dev/null +++ b/Content/Images/MerchantUI/BuyUI.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b978eddef5bbef43186879df7f382388714d9b905a3e2d104eedb3b16dd9a8ce +size 67890 diff --git a/Content/Images/MerchantUI/CancelShadow.uasset b/Content/Images/MerchantUI/CancelShadow.uasset new file mode 100644 index 0000000..38beebb --- /dev/null +++ b/Content/Images/MerchantUI/CancelShadow.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fee0b73cd4e77f48e1eef49859d02a28f36487ef98c0257016eddb648ecf1607 +size 115863 diff --git a/Content/Images/MerchantUI/CancelUi.uasset b/Content/Images/MerchantUI/CancelUi.uasset new file mode 100644 index 0000000..87efbca --- /dev/null +++ b/Content/Images/MerchantUI/CancelUi.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dedb8be65656f3a98d3457e8938407248c1cfa637e2fe5c7d691eaaf42efa1da +size 67578 diff --git a/Content/Images/MerchantUI/ExitButtonBlack.uasset b/Content/Images/MerchantUI/ExitButtonBlack.uasset new file mode 100644 index 0000000..914d1c7 --- /dev/null +++ b/Content/Images/MerchantUI/ExitButtonBlack.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:204eaf20a858df1c5ea83ad3ecd93b61236dd63a402aea1301305bd78f198980 +size 56945 diff --git a/Content/Images/MerchantUI/ExitShadow.uasset b/Content/Images/MerchantUI/ExitShadow.uasset new file mode 100644 index 0000000..db02e5a --- /dev/null +++ b/Content/Images/MerchantUI/ExitShadow.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40eccaa4951e21dcbda542830d1040a5abab8d7821929b6264b1e36103abc265 +size 96251 From d538543fbc16fd0410f58f37961c41d3306da6a7 Mon Sep 17 00:00:00 2001 From: MarcelHara Date: Tue, 9 May 2023 00:00:47 +0100 Subject: [PATCH 3/6] Updated Selection,confirmation UI for merchant --- .../Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset | 4 ++-- Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset | 4 ++-- Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset | 4 ++-- Content/Levels/Build.umap | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index 737ca7e..555d903 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61982627878a3fa5f5f433ddc2b2d1d781e18c0008d224fabb54388476f50915 -size 52764 +oid sha256:bb8747465ea11ce180bdba25539e7625e09e20685688b6302fe79bdd522d8fc6 +size 56996 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset index a711020..3c69cec 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f02d6f1b555bbb983a74a2a4534e22e262373f525b0f96234c48aa8a77c11f68 -size 64594 +oid sha256:e18a13d310c74987b3b93511726c4962839666148da1164256ba47fa9a9f56bc +size 65828 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset index c2a8aca..d4c8675 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09dda50c557dcf82fb79de0a80551d3d6d838074015a7437f0c50e6a74e24ed6 -size 68084 +oid sha256:a3ddc4f48b21c41e3fcb3ec49dee465cf148f62f852e4df4398ae15e75e518c9 +size 68745 diff --git a/Content/Levels/Build.umap b/Content/Levels/Build.umap index b8e098f..e39ead6 100644 --- a/Content/Levels/Build.umap +++ b/Content/Levels/Build.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:19bf2aa33e6f21589ff61f413acddfc65dc257f7add19727134083ccaf30b1fd -size 3654662 +oid sha256:3f3ad658a110136de560f9961c6d7c2af1335ef98784a425a6297c917c8ea192 +size 3655823 From 0632a1770b43721a1715c7fc0b7281725efd9ffc Mon Sep 17 00:00:00 2001 From: MarcelHara Date: Tue, 9 May 2023 00:04:33 +0100 Subject: [PATCH 4/6] Updated DialougeBox for merchant to finish UI overhall --- Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset | 4 ++-- Content/Images/MerchantUI/DialiougeBox.uasset | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 Content/Images/MerchantUI/DialiougeBox.uasset diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset index def3d97..3466999 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea25a76832a591caa677a97dfac6c30e410974dd3c705d8923f3eea49dd79699 -size 74712 +oid sha256:b1fac66db3777a1f9169f558728f9968954f5f121ef112eb15fddf6f4e15975c +size 75696 diff --git a/Content/Images/MerchantUI/DialiougeBox.uasset b/Content/Images/MerchantUI/DialiougeBox.uasset new file mode 100644 index 0000000..7883bfe --- /dev/null +++ b/Content/Images/MerchantUI/DialiougeBox.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41870ae0bdeb52a9478a5c278d6d021c1bf2d596b55043e086b8087ffd861aa3 +size 34467 From b3c83f161f62ef1137674861f6f4d9b136ec8be1 Mon Sep 17 00:00:00 2001 From: MarcelHara Date: Tue, 9 May 2023 12:50:34 +0100 Subject: [PATCH 5/6] Updated TempCharacter to stop crashes --- Content/Levels/Build.umap | 2 +- .../PlayerTemp/TempCharacter.cpp | 30 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Content/Levels/Build.umap b/Content/Levels/Build.umap index e39ead6..a73fc54 100644 --- a/Content/Levels/Build.umap +++ b/Content/Levels/Build.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f3ad658a110136de560f9961c6d7c2af1335ef98784a425a6297c917c8ea192 +oid sha256:31ca0ab77e13884d871763a5bd4d60f44f94f078470cb5d68eff284fce510ae3 size 3655823 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index c3f4d17..644df2d 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -271,19 +271,27 @@ void ATempCharacter::UseItem(class UBaseItem* Item) void ATempCharacter::BuyItem(AActor* Item) { - UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); - UBaseItem* ItemArray = Item->FindComponentByClass()->GetItem(0); - if (GoldBalance <= 0) + if (Item == nullptr) { - UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); + UE_LOG(LogTemp, Display, TEXT("Item is null")); + return; } - else if (GoldBalance >= ItemArray->ItemCostPrice) + else { - GoldBalance -= ItemArray->ItemCostPrice; - Inventory->AddItem(ItemArray); - UE_LOG(LogTemp, Display, TEXT("Item Purchased")); + UBaseItem* ItemArray = Item->FindComponentByClass()->GetItem(0); + if (GoldBalance <= 0) + { + UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); + } + else if (GoldBalance >= ItemArray->ItemCostPrice) + { + GoldBalance -= ItemArray->ItemCostPrice; + Inventory->AddItem(ItemArray); + UE_LOG(LogTemp, Display, TEXT("Item Purchased")); + } + UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING")); + TraceDistance = 1000; + LineTraceLogic(); } - // UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING")); - // TraceDistance = 1000; - // LineTraceLogic(); + } From 3887290df84544cd97dab779a5834519b5d8a088 Mon Sep 17 00:00:00 2001 From: MarcelHara Date: Tue, 9 May 2023 13:07:30 +0100 Subject: [PATCH 6/6] Fixed merchant crash issue --- Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset | 4 ++-- Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset index 3c69cec..3ab4f71 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e18a13d310c74987b3b93511726c4962839666148da1164256ba47fa9a9f56bc -size 65828 +oid sha256:dce75c5956fa2330472c7c6130d3aa37c8caad8c0bbfb75aab34e3313d3d2a5c +size 68696 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset index d4c8675..c521a6f 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a3ddc4f48b21c41e3fcb3ec49dee465cf148f62f852e4df4398ae15e75e518c9 -size 68745 +oid sha256:56186ac7df1d92f8e57d4ccc87f80187e3e4fd090de6a261a15f193b7dd54939 +size 69067