Exemplo n.º 1
0
        /// <summary>
        /// Resizes the inventory panel, taking into account the number of rows/columns, the padding and margin
        /// </summary>
        protected void ResizeInventoryDisplay()
        {
            float newWidth  = PaddingLeft + SlotSize.x * NumberOfColumns + SlotMargin.x * (NumberOfColumns - 1) + PaddingRight;
            float newHeight = PaddingTop + SlotSize.y * NumberOfRows + SlotMargin.y * (NumberOfRows - 1) + PaddingBottom;

            TargetInventory.ResizeArray(NumberOfRows * NumberOfColumns);

            Vector2 newSize = new Vector2(newWidth, newHeight);

            InventoryRectTransform.sizeDelta = newSize;
            InventoryGrid.GetComponent <RectTransform>().sizeDelta = newSize;
        }