Example #1
0
        private void LoadAvailableParts()
        {
            Debug.Log("[OSE] - " + PartLoader.LoadedPartsList.Count + " loaded parts");
            Debug.Log("[OSE] - " + PartLoader.LoadedPartsList.Count(WorkshopUtils.PartResearched) + " unlocked parts");

            var items = new List <WorkshopItem>();

            foreach (var loadedPart in PartLoader.LoadedPartsList.Where(p => p.name != "flag" && p.name != "kerbalEVA" && p.name != "kerbalEVAfemale"))
            {
                try
                {
                    if (IsValid(loadedPart))
                    {
                        items.Add(new WorkshopItem(loadedPart));
                    }
                }
                catch (Exception)
                {
                    Debug.Log("[OSE] - Part " + loadedPart.name + " could not be added to available parts list");
                }
            }
            _availableItems = items.OrderBy(i => i.Part.title).ToArray();
            _filteredItems  = _filters[_activeFilterId].Filter(_availableItems, 0);
        }
        private void LoadAvailableParts()
        {
            Debug.Log("[OSE] - " + PartLoader.LoadedPartsList.Count + " loaded parts");
            Debug.Log("[OSE] - " + PartLoader.LoadedPartsList.Count(WorkshopUtils.PartResearched) + " unlocked parts");

            var items = new List<WorkshopItem>();
            foreach (var loadedPart in PartLoader.LoadedPartsList.Where(p => p.name != "flag" && p.name != "kerbalEVA" && p.name != "kerbalEVAfemale"))
            {
                try
                {
                    if (IsValid(loadedPart))
                    {
                        items.Add(new WorkshopItem(loadedPart));
                    }
                }
                catch (Exception)
                {
                    Debug.Log("[OSE] - Part " + loadedPart.name + " could not be added to available parts list");
                }
            }
            _availableItems = items.OrderBy(i => i.Part.title).ToArray();
            _filteredItems = _filters[_activeFilterId].Filter(_availableItems, 0);
        }
        private void ApplyPaging()
        {
            if (_activePage != _selectedPage)
            {
                foreach (var item in _filteredItems.Items)
                {
                    item.DisableIcon();
                }

                var selectedFilter = _filters[_activeFilterId];
                _filteredItems = selectedFilter.Filter(_availableItems, _selectedPage * 30);
                _activePage = _selectedPage;
            }
        }