Example #1
0
    /// <summary>
    /// Updates Item List Tab to match what the current item stack holds
    /// </summary>
    public static void UpdateItemPanelList()
    {
        Vector3           position = GetListedItemsLocation();
        List <GameObject> newList  = GetItemsAtPosition(position);
        List <GameObject> oldList  = new List <GameObject>();

        foreach (GameObject gameObject in Instance.listedObjects)
        {
            oldList.Add(gameObject.GetComponent <UITileListItem>().TileItem);
        }

        //If item stack has changed, redo the itemList tab
        if (!EnumerableExt.AreEquivalent <GameObject>(newList, oldList))
        {
            ClearItemPanel();
            foreach (GameObject gameObject in newList)
            {
                AddObjectToItemPanel(gameObject);
            }
        }
    }