Пример #1
0
        public IDictionary <string, int> Update()
        {
            CubeCount = 0;
            Items.Clear();
            MassStorageCrate center = Crate?.mConnectedCenter;

            if (center == null)
            {
                return(Items);
            }
            foreach (MassStorageCrate crate in center.mConnectedCrates)
            {
                ItemBase pickeditem = null;
                CubeCount++;
                pickeditem = crate.mItem;
                if (pickeditem != null && Filter.Check(pickeditem))
                {
                    string itemname = ItemManager.GetItemName(pickeditem);

                    if (!Items.ContainsKey(itemname))
                    {
                        Items.Add(itemname, ItemManager.GetCurrentStackSize(pickeditem));
                    }
                    else
                    {
                        Items[itemname] = (int)Items[itemname] + ItemManager.GetCurrentStackSize(pickeditem);
                    }
                    pickeditem = null;
                }
            }
            return(Items);
        }