From c794a905da45ffde2274adbf3a84bf2ca9ddd9e3 Mon Sep 17 00:00:00 2001 From: PHILIP WHITE Date: Thu, 26 Oct 2023 11:59:50 +0100 Subject: [PATCH] Updated Inventory Component for Resising Functionality --- .../FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset | 4 ++-- EndlessVendetta/Content/Inventory/UI/UI_Inventory.uasset | 4 ++-- .../EndlessVendetta/Inventory/InventoryComponent.cpp | 7 +++++++ .../Source/EndlessVendetta/Inventory/InventoryComponent.h | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index bd336f47..2e7c893c 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e682a957f3ebb1f435625e280cf61ebd7af0d8fb7d052e424d8c629c6b55c0f6 -size 44055 +oid sha256:21f83334caec77bd5102f683752229d6f53c6e3f6b0b362f4a00171573bd502b +size 50118 diff --git a/EndlessVendetta/Content/Inventory/UI/UI_Inventory.uasset b/EndlessVendetta/Content/Inventory/UI/UI_Inventory.uasset index e0960292..3b397eac 100644 --- a/EndlessVendetta/Content/Inventory/UI/UI_Inventory.uasset +++ b/EndlessVendetta/Content/Inventory/UI/UI_Inventory.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc2d597e4dd0c95915c34a213b9a299bef8d337b839b2a8b9618a9a63d26732c -size 84945 +oid sha256:02676d43ab06d6fe84a89f2c8c147415615e84ab3474cb59e75888dae53f5711 +size 96823 diff --git a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp index df0b4bc6..2d09885f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp @@ -181,6 +181,13 @@ void UInventoryComponent::SpawnItem(UBaseItem* Item, FVector Location) { } +void UInventoryComponent::UpdateInventorySize_Implementation(const int _Columns, const int _Rows) +{ + Columns = _Columns; + Rows = _Rows; + InventoryItems.SetNum(Columns * Rows); +} + bool UInventoryComponent::IsTileValid(const FInventoryTile InventoryTile) const { if (InventoryTile.X >= 0 && InventoryTile.Y >= 0 && InventoryTile.X < Columns && InventoryTile.Y < Columns && InventoryTile.Y <= Rows) diff --git a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h index f8a4a44f..813a181b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h +++ b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h @@ -49,7 +49,6 @@ public: bool IsRoomAvailable(class UBaseItem* Item, const int TopLeftIndex); UFUNCTION(BlueprintCallable, Category="Inventory") FInventoryTile IndexToTile(const int Index) const; - //UFUNCTION(BlueprintCallable, Category="Inventory") TTuple GetItemAtIndex(const int Index); UFUNCTION(BlueprintCallable, Category="Inventory") int TileToIndex(const FInventoryTile InventoryTile) const; @@ -61,6 +60,9 @@ public: void RemoveItem(class UBaseItem* Item); UFUNCTION(BlueprintCallable, Category="Inventory") void SpawnItem(class UBaseItem* Item, FVector Location); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Exec, Category = "Inventory") + void UpdateInventorySize(const int _Columns, const int _Rows); + virtual void UpdateInventorySize_Implementation(const int _Columns, const int _Rows); private: bool IsTileValid(const FInventoryTile InventoryTile) const;