miepzerino
2025-04-01 6db269b9430900667b240bada58f8436ef3442af
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));