Esempio n. 1
0
        private static List <MyInventory> Inventories(MyGuiControlList inventoriesControl)
        {
            var dstControlEnumerator = inventoriesControl.Controls.GetEnumerator();
            List <MyInventory> availableInventories = new List <MyInventory>();

            MyGuiControlInventoryOwner dstControl = null;

            while (dstControlEnumerator.MoveNext())
            {
                if (dstControlEnumerator.Current.Visible)
                {
                    dstControl = dstControlEnumerator.Current as MyGuiControlInventoryOwner;

                    if (dstControl == null || !dstControl.Enabled)
                    {
                        continue;
                    }

                    var dstOwner = dstControl.InventoryOwner;

                    for (int i = 0; i < dstOwner.InventoryCount; ++i)
                    {
                        var tmp = dstOwner.GetInventory(i);

                        if (tmp != null)
                        {
                            availableInventories.Add(tmp);
                        }
                    }
                }
            }

            return(availableInventories);
        }
Esempio n. 2
0
        private void RefreshInventory()
        {
            m_inventoryGrid.Clear();
            foreach (var item in m_selectedAssembler.OutputInventory.GetItems())
            {
                m_inventoryGrid.Add(MyGuiControlInventoryOwner.CreateInventoryGridItem(item));
            }
            int itemCount = m_selectedAssembler.OutputInventory.GetItems().Count;

            m_inventoryGrid.RowsCount = Math.Max(1 + (itemCount / m_inventoryGrid.ColumnsCount), INVENTORY_GRID_ROWS);
        }
Esempio n. 3
0
        private void FormatDisplayName(StringBuilder outputBuffer, MyPhysicalInventoryItem item)
        {
            var definition = MyDefinitionManager.Static.GetPhysicalItemDefinition(item.Content);

            outputBuffer.Clear().Append(definition.DisplayNameText);
            if (Item.Amount != 1)
            {
                outputBuffer.Append(" (");
                MyGuiControlInventoryOwner.FormatItemAmount(item, outputBuffer);
                outputBuffer.Append(")");
            }
        }