Esempio n. 1
0
    /// <summary>
    /// hides all borders
    /// </summary>
    private void HideAllBorders()
    {
        for (int row = 0; row < itemRows.Length; row++)
        {
            for (int col = 0; col < itemRows[0].items.Length; col++)
            {
                ItemSlot slot = new ItemSlot(row, col);

                ItemGridItemUI igiu = GetGridSlot(slot);

                igiu.SetBorderEquip(false);
                igiu.SetBorderVisiblity(false);
                igiu.SetBorderFlash(false);
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    public void Start()
    {
        if (_inventory == null)
        {
            _inventory = PlayerManager.instance.GetComponent <CharacterInventory>();
        }

        _items = new ItemUI[itemRows.Length, itemRows[0].items.Length];

        _inventory.OnItemAdded += UpdateItemSlot;

        // assign slot references
        for (int row = 0; row < itemRows.Length; row++)
        {
            for (int col = 0; col < itemRows[0].items.Length; col++)
            {
                ItemSlot slot = new ItemSlot(row, col);

                ItemGridItemUI igiu = GetGridSlot(slot);

                // assign slot
                igiu.slot = slot;

                // setup event listeners
                igiu.OnLeftClick += SelectSlot;

                igiu.OnRightClick += UseSlot;

                igiu.OnHoverOver += ShowItemDetails;

                igiu.OnHoverOff += ResetItemDetails;
            }
        }

        UpdateAllItemSlots();

        UpdateGoldText();

        ResetItemDetails(null);

        _currentSelectSlot = new ItemSlot(0, 0);

        if (itemWorthText == null)
        {
            Debug.Log("itemWorthText is missing/null! Updates will ignore itemWorthText.");
        }
    }