Example #1
0
 public void Initialise()
 {
     if (Type == CategoryNode.CategoryType.NEW)
     {
         RUI.Icons.Selectable.Icon icon     = IconLib.GetIcon(this);
         PartCategorizer.Category  category = PartCategorizer.AddCustomFilter(Name, Localizer.Format(Name), icon, Colour);
         category.displayType     = EditorPartList.State.PartsList;
         category.exclusionFilter = PartCategorizer.Instance.filterGenericNothing;
         InstanceSubcategories(category);
     }
     else
     {
         if (!PartCategorizer.Instance.filters.TryGetValue(c => string.Equals(Localizer.Format(c.button.categoryName), Name, StringComparison.OrdinalIgnoreCase),
                                                           out PartCategorizer.Category category))
         {
             Logger.Log($"No category of this name was found to manipulate: {Name}", Logger.LogLevel.Warn);
             return;
         }
         else if (Behaviour == CategoryNode.CategoryBehaviour.Replace)
         {
             if (category.button.activeButton.CurrentState == KSP.UI.UIRadioButton.State.True)
             {
                 PartCategorizer.Category subcat = category.subcategories.Find(c => c.button.activeButton.CurrentState == KSP.UI.UIRadioButton.State.True);
                 if (subcat != null)
                 {
                     subcat.OnFalseSUB(subcat);
                 }
                 PartCategorizer.Instance.scrollListSub.Clear(false);
             }
             category.subcategories.Clear();
         }
         InstanceSubcategories(category);
     }
 }
Example #2
0
        private IEnumerator Start()
        {
            Logger.Log(string.Empty, Logger.LogLevel.Warn); // print version
            yield return(null);

            yield return(null);

            GetConfigs();
            GetPartData();
            ProcessFilterDefinitions();
            IconLib.Load();
            CheckAndMarkConflicts();

            CompileCategories();

            partPathDict      = null;
            subCategoriesDict = null;
            loaded_modules    = null;
        }