コード例 #1
0
 private void FilterInventory(MyGuiControlListbox listbox, List<int> itemsIDs, List<ItemCategory> filter, List<int> hideList,
     MyGuiControlCheckbox checkboxAll, MyGuiControlCheckbox checkboxWeapons, MyGuiControlCheckbox checkboxOres,
     MyGuiControlCheckbox checkboxConsumables, MyGuiControlCheckbox checkboxEquipment, MyGuiControlCheckbox checkboxGods)
 {
     if (listbox != null)
     {                
         listbox.RemoveAllItems();
         listbox.ResetScrollbarPosition();
         filter.Clear();
         if (!checkboxAll.Checked) 
         {
             if (checkboxWeapons.Checked) filter.AddRange(MyItemFilterConstants.CategoryAmmo);
             if (checkboxOres.Checked) filter.AddRange(MyItemFilterConstants.Ores);
             if (checkboxConsumables.Checked) filter.AddRange(MyItemFilterConstants.ConsumAndMedical);
             if (checkboxEquipment.Checked) filter.AddRange(MyItemFilterConstants.Devices);
             if (checkboxGods.Checked) filter.AddRange(MyItemFilterConstants.GoodsAndIllegal);
         }
         FillListBoxFromIDs(listbox, itemsIDs, filter, ref hideList);
         AddFreeRowsIfCan(listbox, 1);
     }
 }
コード例 #2
0
 private void RemoveItemsFromListbox(MyGuiControlListbox listbox, bool removeItems = false) 
 {
     foreach (int key in listbox.GetItemsKeys())
     {
         m_removedInventoryItemIDs.Add(key);
     }
     listbox.RemoveAllItems(removeItems);
     if (removeItems)
     {                
         AddFreeRowsIfCan(listbox, 1);
     }            
 }