From 6db269b9430900667b240bada58f8436ef3442af Mon Sep 17 00:00:00 2001 From: miepzerino <o.skotnik@gmail.com> Date: Tue, 01 Apr 2025 14:44:13 +0000 Subject: [PATCH] #32 inventory improvements --- Assets/Scripts/Inventory/InventoryDisplay.cs | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Inventory/InventoryDisplay.cs b/Assets/Scripts/Inventory/InventoryDisplay.cs index 9624550..8036296 100644 --- a/Assets/Scripts/Inventory/InventoryDisplay.cs +++ b/Assets/Scripts/Inventory/InventoryDisplay.cs @@ -1,4 +1,5 @@ using Assets.Scripts.Enums; +using Assets.Scripts.Helpers; using System; using System.Collections; using System.Collections.Generic; @@ -17,6 +18,7 @@ public GameObject itemNameDescription; public GameObject itemDescription; public GameObject itemDeleteButton; + public GameObject inventoryMaxAmount; public List<GameObject> itemUIs = new List<GameObject>(); @@ -58,15 +60,20 @@ //} if (context.started) { - inventoryPanel.SetActive(!inventoryPanel.activeSelf); - if (inventoryPanel.activeSelf) - { - UpdateItemContentList(); - } - else - { - //ClearItemContentList(); - } + ToggleInventoryPanel(); + } + } + + public void ToggleInventoryPanel() + { + inventoryPanel.SetActive(!inventoryPanel.activeSelf); + if (inventoryPanel.activeSelf) + { + UpdateItemContentList(); + } + else + { + //ClearItemContentList(); } } @@ -223,6 +230,8 @@ private void UpdateItemContentList() { + TextMeshProHelper.UpdateItemMaxCountText(inventoryMaxAmount.GetComponent<TextMeshProUGUI>(), inventory.items.Count, inventory.maxInventorySize); + // First, deactivate all existing itemUIs itemUIs.ForEach(itemUI => itemUI.SetActive(false)); -- Gitblit v1.9.3