Пример #1
0
        private void LoadAvailableParts()
        {
            WorkshopUtils.LogVerbose(PartLoader.LoadedPartsList.Count + " loaded parts");
            WorkshopUtils.LogVerbose(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.StartsWith("kerbalEVA")))
            {
                try
                {
                    if (IsValid(loadedPart))
                    {
                        items.Add(new WorkshopItem(loadedPart));
                    }
                }
                catch (Exception ex)
                {
                    WorkshopUtils.LogError("Part " + loadedPart.name + " could not be added to available parts list", ex);
                }
            }
            _availableItems = items.OrderBy(i => i.Part.title).ToArray();
            if (string.IsNullOrEmpty(_searchFilter.FilterText))
            {
                _filteredItems = _filters[_activeFilterId].Filter(_availableItems, 0);
            }
            else
            {
                _filteredItems = _searchFilter.Filter(_availableItems, 0);
            }
        }
Пример #2
0
 public void DisableIcon()
 {
     WorkshopUtils.LogVerbose("DisableIcon for " + Part.name);
     if (Icon != null)
     {
         Icon.Dispose();
         Icon = null;
     }
 }
        private IEnumerator LoadCustomItems()
        {
            var nodes = GameDatabase.Instance.GetConfigNodes("OSE_Blacklist");

            foreach (var configNode in nodes)
            {
                var items = configNode.GetValue("parts").Split(';');
                WorkshopUtils.LogVerbose("found blacklist items: " + String.Join(" - ", items));
                WorkshopBlacklistItemsDatabase.Blacklist.AddRange(items.Select(i => i.Replace('_', '.')));
                yield return(null);
            }
            Done = true;
        }
Пример #4
0
        private void LoadFilters()
        {
            var filters        = new List <FilterBase>();
            var filterTextures = new List <Texture>();

            var categoryFilterAddOns = vessel.FindPartModulesImplementing <OseModuleCategoryAddon>();

            if (categoryFilterAddOns != null)
            {
                foreach (var addon in categoryFilterAddOns.Distinct(new OseModuleCategoryAddonEqualityComparer()).ToArray())
                {
                    WorkshopUtils.LogVerbose($"Found addon for category: {addon.Category}");
                    filters.Add(new FilterCategory(addon.Category));
                    filterTextures.Add(WorkshopUtils.LoadTexture(addon.IconPath));
                }
            }

            _filters        = filters.ToArray();
            _filterTextures = filterTextures.ToArray();
            _searchFilter   = new FilterSearch();
        }
Пример #5
0
 public void EnableIcon(int resultion)
 {
     WorkshopUtils.LogVerbose("EnableIcon for " + Part.name);
     DisableIcon();
     Icon = new KIS_IconViewer(Part.partPrefab, resultion);
 }