| | |
| | | using Assets.Scripts.Enums; |
| | | using Assets.Scripts.Helpers; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | public GameObject itemNameDescription; |
| | | public GameObject itemDescription; |
| | | public GameObject itemDeleteButton; |
| | | public GameObject inventoryMaxAmount; |
| | | |
| | | public List<GameObject> itemUIs = new List<GameObject>(); |
| | | |
| | |
| | | //} |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | |
| | | var scrollrect = itemDescription.transform.parent.parent.GetComponent<ScrollRect>(); |
| | | if (scrollrect != null) |
| | | { |
| | | Debug.Log("Resetting scroll position"); |
| | | //Debug.Log("Resetting scroll position"); |
| | | scrollrect.verticalNormalizedPosition = 1; // 0 = top, 1 = bottom |
| | | } |
| | | // Reset the content's position |
| | |
| | | |
| | | private void UpdateItemContentList() |
| | | { |
| | | UIHelper.UpdateItemMaxCountText(inventoryMaxAmount.GetComponent<TextMeshProUGUI>(), inventory.items.Count, inventory.maxInventorySize); |
| | | |
| | | // First, deactivate all existing itemUIs |
| | | itemUIs.ForEach(itemUI => itemUI.SetActive(false)); |
| | | |