Esempio n. 1
0
    // Supprime et réinstancie les visuels de l'inventaire
    public void RefreshInventoryView()
    {
        int numItems = 0;

        foreach (InventoryItem item in inventoryItems)
        {
            if (PersistentDataSystem.Instance.GetSavedData <StoryTellingSavedData>().EventIsRealized(item.obtainObjectEvent))
            {
                numItems++;
            }
        }
        if (numItems == inventoryItemGUIs.Count)
        {
            return;
        }

        foreach (InventoryItemGUI gui in inventoryItemGUIs)
        {
            Destroy(gui.gameObject);
        }
        inventoryItemGUIs.Clear();
        foreach (InventoryItem item in inventoryItems)
        {
            if (!PersistentDataSystem.Instance.GetSavedData <StoryTellingSavedData>().EventIsRealized(item.obtainObjectEvent))
            {
                continue;
            }
            GameObject       itemGuiGO = Instantiate(inventoryItemGUI_Prefab);
            InventoryItemGUI itemGui   = itemGuiGO.GetComponent <InventoryItemGUI>();
            itemGui.FromInventoryItem(item);
            itemGuiGO.transform.SetParent(inventoryPanel, false);
            inventoryItemGUIs.Add(itemGui);
        }
    }
 // Token: 0x06000E3B RID: 3643 RVA: 0x000616C4 File Offset: 0x0005F8C4
 public override int Compare(IShopItemGUI a, IShopItemGUI b)
 {
     if (a.Item.View.ItemClass == b.Item.View.ItemClass)
     {
         InventoryItemGUI inventoryItemGUI  = a as InventoryItemGUI;
         InventoryItemGUI inventoryItemGUI2 = b as InventoryItemGUI;
         return(ShopSorting.CompareDuration(inventoryItemGUI.InventoryItem, inventoryItemGUI2.InventoryItem, base.Ascending));
     }
     return((!base.Ascending) ? b.Item.View.ItemClass.CompareTo(a.Item.View.ItemClass) : a.Item.View.ItemClass.CompareTo(b.Item.View.ItemClass));
 }