Пример #1
0
 public static void FinalizeInit()
 {
     ThingCategoryNodeDatabase.rootNode = ThingCategoryDefOf.Root.treeNode;
     foreach (ThingCategoryDef allDef in DefDatabase <ThingCategoryDef> .AllDefs)
     {
         if (allDef.parent != null)
         {
             allDef.parent.childCategories.Add(allDef);
         }
     }
     ThingCategoryNodeDatabase.SetNestLevelRecursive(ThingCategoryNodeDatabase.rootNode, 0);
     foreach (ThingDef allDef2 in DefDatabase <ThingDef> .AllDefs)
     {
         if (allDef2.thingCategories != null)
         {
             foreach (ThingCategoryDef thingCategory in allDef2.thingCategories)
             {
                 thingCategory.childThingDefs.Add(allDef2);
             }
         }
     }
     foreach (SpecialThingFilterDef allDef3 in DefDatabase <SpecialThingFilterDef> .AllDefs)
     {
         allDef3.parentCategory.childSpecialFilters.Add(allDef3);
     }
     ThingCategoryNodeDatabase.rootNode.catDef.childCategories[0].treeNode.SetOpen(-1, true);
     ThingCategoryNodeDatabase.initialized = true;
 }
Пример #2
0
 public static void FinalizeInit()
 {
     rootNode = ThingCategoryDefOf.Root.treeNode;
     foreach (ThingCategoryDef allDef in DefDatabase <ThingCategoryDef> .AllDefs)
     {
         if (allDef.parent != null)
         {
             allDef.parent.childCategories.Add(allDef);
         }
     }
     SetNestLevelRecursive(rootNode, 0);
     foreach (ThingDef allDef2 in DefDatabase <ThingDef> .AllDefs)
     {
         if (allDef2.thingCategories == null)
         {
             continue;
         }
         foreach (ThingCategoryDef thingCategory in allDef2.thingCategories)
         {
             thingCategory.childThingDefs.Add(allDef2);
         }
     }
     foreach (SpecialThingFilterDef allDef3 in DefDatabase <SpecialThingFilterDef> .AllDefs)
     {
         allDef3.parentCategory.childSpecialFilters.Add(allDef3);
     }
     if (rootNode.catDef.childCategories.Any())
     {
         rootNode.catDef.childCategories[0].treeNode.SetOpen(-1, val: true);
     }
     allThingCategoryNodes = rootNode.ChildCategoryNodesAndThis.ToList();
     initialized           = true;
 }
Пример #3
0
 public void SetAllowAll(ThingFilter parentFilter, bool includeNonStorable = false)
 {
     allowedDefs.Clear();
     if (parentFilter != null)
     {
         foreach (ThingDef allowedDef in parentFilter.allowedDefs)
         {
             allowedDefs.Add(allowedDef);
         }
     }
     else if (includeNonStorable)
     {
         foreach (ThingDef allDef in DefDatabase <ThingDef> .AllDefs)
         {
             allowedDefs.Add(allDef);
         }
     }
     else
     {
         foreach (ThingDef allStorableThingDef in AllStorableThingDefs)
         {
             allowedDefs.Add(allStorableThingDef);
         }
     }
     disallowedSpecialFilters.RemoveAll((SpecialThingFilterDef sf) => sf.configurable);
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
		public static void FinalizeInit()
		{
			ThingCategoryNodeDatabase.rootNode = ThingCategoryDefOf.Root.treeNode;
			foreach (ThingCategoryDef current in DefDatabase<ThingCategoryDef>.AllDefs)
			{
				if (current.parent != null)
				{
					current.parent.childCategories.Add(current);
				}
			}
			ThingCategoryNodeDatabase.SetNestLevelRecursive(ThingCategoryNodeDatabase.rootNode, 0);
			foreach (ThingDef current2 in DefDatabase<ThingDef>.AllDefs)
			{
				if (current2.thingCategories != null)
				{
					foreach (ThingCategoryDef current3 in current2.thingCategories)
					{
						current3.childThingDefs.Add(current2);
					}
				}
			}
			foreach (SpecialThingFilterDef current4 in DefDatabase<SpecialThingFilterDef>.AllDefs)
			{
				current4.parentCategory.childSpecialFilters.Add(current4);
			}
			if (ThingCategoryNodeDatabase.rootNode.catDef.childCategories.Any<ThingCategoryDef>())
			{
				ThingCategoryNodeDatabase.rootNode.catDef.childCategories[0].treeNode.SetOpen(-1, true);
			}
			ThingCategoryNodeDatabase.initialized = true;
		}
Пример #5
0
 public void SetAllow(ThingCategoryDef categoryDef, bool allow, IEnumerable <ThingDef> exceptedDefs = null, IEnumerable <SpecialThingFilterDef> exceptedFilters = null)
 {
     if (!ThingCategoryNodeDatabase.initialized)
     {
         Log.Error("SetAllow categories won't work before ThingCategoryDatabase is initialized.");
     }
     foreach (ThingDef descendantThingDef in categoryDef.DescendantThingDefs)
     {
         if (exceptedDefs == null || !exceptedDefs.Contains(descendantThingDef))
         {
             SetAllow(descendantThingDef, allow);
         }
     }
     foreach (SpecialThingFilterDef descendantSpecialThingFilterDef in categoryDef.DescendantSpecialThingFilterDefs)
     {
         if (exceptedFilters == null || !exceptedFilters.Contains(descendantSpecialThingFilterDef))
         {
             SetAllow(descendantSpecialThingFilterDef, allow);
         }
     }
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
        private void CalculateHiddenSpecialFilters(TreeNode_ThingCategory node)
        {
            hiddenSpecialFilters = new List <SpecialThingFilterDef>();
            if (tempForceHiddenSpecialFilters != null)
            {
                hiddenSpecialFilters.AddRange(tempForceHiddenSpecialFilters);
            }
            IEnumerable <SpecialThingFilterDef> enumerable = node.catDef.ParentsSpecialThingFilterDefs.Concat(node.catDef.DescendantSpecialThingFilterDefs);
            IEnumerable <ThingDef> enumerable2             = node.catDef.DescendantThingDefs;

            if (parentFilter != null)
            {
                enumerable2 = enumerable2.Where((ThingDef x) => parentFilter.Allows(x));
            }
            foreach (SpecialThingFilterDef item in enumerable)
            {
                bool flag = false;
                foreach (ThingDef item2 in enumerable2)
                {
                    if (item.Worker.CanEverMatch(item2))
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    hiddenSpecialFilters.Add(item);
                }
            }
        }
		private static void SetNestLevelRecursive(TreeNode_ThingCategory node, int nestDepth)
		{
			foreach (ThingCategoryDef current in node.catDef.childCategories)
			{
				current.treeNode.nestDepth = nestDepth;
				ThingCategoryNodeDatabase.SetNestLevelRecursive(current.treeNode, nestDepth + 1);
			}
		}
Пример #8
0
 private static void SetNestLevelRecursive(TreeNode_ThingCategory node, int nestDepth)
 {
     foreach (ThingCategoryDef childCategory in node.catDef.childCategories)
     {
         childCategory.treeNode.nestDepth = nestDepth;
         SetNestLevelRecursive(childCategory.treeNode, nestDepth + 1);
     }
 }
Пример #9
0
        public static void DoThingFilterConfigWindow(Rect rect, ref Vector2 scrollPosition, ThingFilter filter, ThingFilter parentFilter = null, int openMask = 1, IEnumerable <ThingDef> forceHiddenDefs = null, IEnumerable <SpecialThingFilterDef> forceHiddenFilters = null, List <ThingDef> suppressSmallVolumeTags = null, Map map = null)
        {
            Widgets.DrawMenuSection(rect);
            Text.Font = GameFont.Tiny;
            float num   = rect.width - 2f;
            Rect  rect2 = new Rect(rect.x + 1f, rect.y + 1f, num / 2f, 24f);

            if (Widgets.ButtonText(rect2, "ClearAll".Translate(), true, false, true))
            {
                filter.SetDisallowAll(forceHiddenDefs, forceHiddenFilters);
                SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
            }
            Rect rect3 = new Rect(rect2.xMax + 1f, rect2.y, rect.xMax - 1f - (rect2.xMax + 1f), 24f);

            if (Widgets.ButtonText(rect3, "AllowAll".Translate(), true, false, true))
            {
                filter.SetAllowAll(parentFilter);
                SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
            }
            Text.Font = GameFont.Small;
            rect.yMin = rect2.yMax;
            TreeNode_ThingCategory node = ThingCategoryNodeDatabase.RootNode;
            bool flag  = true;
            bool flag2 = true;

            if (parentFilter != null)
            {
                node  = parentFilter.DisplayRootCategory;
                flag  = parentFilter.allowedHitPointsConfigurable;
                flag2 = parentFilter.allowedQualitiesConfigurable;
            }
            Rect viewRect = new Rect(0f, 0f, rect.width - 16f, ThingFilterUI.viewHeight);

            Widgets.BeginScrollView(rect, ref scrollPosition, viewRect, true);
            float num2 = 2f;

            if (flag)
            {
                ThingFilterUI.DrawHitPointsFilterConfig(ref num2, viewRect.width, filter);
            }
            if (flag2)
            {
                ThingFilterUI.DrawQualityFilterConfig(ref num2, viewRect.width, filter);
            }
            float num3  = num2;
            Rect  rect4 = new Rect(0f, num2, viewRect.width, 9999f);
            Listing_TreeThingFilter listing_TreeThingFilter = new Listing_TreeThingFilter(filter, parentFilter, forceHiddenDefs, forceHiddenFilters, suppressSmallVolumeTags);

            listing_TreeThingFilter.Begin(rect4);
            listing_TreeThingFilter.DoCategoryChildren(node, 0, openMask, map, true);
            listing_TreeThingFilter.End();
            if (Event.current.type == EventType.Layout)
            {
                ThingFilterUI.viewHeight = num3 + listing_TreeThingFilter.CurHeight + 90f;
            }
            Widgets.EndScrollView();
        }
Пример #10
0
 public void SetDisallowAll(IEnumerable <ThingDef> exceptedDefs = null, IEnumerable <SpecialThingFilterDef> exceptedFilters = null)
 {
     allowedDefs.RemoveWhere((ThingDef d) => exceptedDefs == null || !exceptedDefs.Contains(d));
     disallowedSpecialFilters.RemoveAll((SpecialThingFilterDef sf) => sf.configurable && (exceptedFilters == null || !exceptedFilters.Contains(sf)));
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
Пример #11
0
 public override void PostLoad()
 {
     treeNode = new TreeNode_ThingCategory(this);
     if (!iconPath.NullOrEmpty())
     {
         LongEventHandler.ExecuteWhenFinished(delegate
         {
             icon = ContentFinder <Texture2D> .Get(iconPath);
         });
     }
 }
Пример #12
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = this.catDef.ThisAndChildCategoryDefs.GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        other         = enumerator.Current;
                        this.$current = other.treeNode;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                this.$PC = -1;
                return(false);
            }
Пример #13
0
 public void SetAllow(StuffCategoryDef cat, bool allow)
 {
     for (int i = 0; i < DefDatabase <ThingDef> .AllDefsListForReading.Count; i++)
     {
         ThingDef thingDef = DefDatabase <ThingDef> .AllDefsListForReading[i];
         if (thingDef.IsStuff && thingDef.stuffProps.categories.Contains(cat))
         {
             SetAllow(thingDef, allow);
         }
     }
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
Пример #14
0
 public void SetAllowAllWhoCanMake(ThingDef thing)
 {
     for (int i = 0; i < DefDatabase <ThingDef> .AllDefsListForReading.Count; i++)
     {
         ThingDef thingDef = DefDatabase <ThingDef> .AllDefsListForReading[i];
         if (thingDef.IsStuff && thingDef.stuffProps.CanMake(thing))
         {
             SetAllow(thingDef, allow: true);
         }
     }
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
        public void DoCategory(TreeNode_ThingCategory node, int indentLevel, int openMask)
        {
            base.OpenCloseWidget(node, indentLevel, openMask);
            base.LabelLeft(node.LabelCap, node.catDef.description, indentLevel);
            MultiCheckboxState multiCheckboxState = this.AllowanceStateOf(node);

            if (Widgets.CheckboxMulti(new Vector2(this.LabelWidth, this.curY), multiCheckboxState, this.lineHeight))
            {
                bool allow = multiCheckboxState == MultiCheckboxState.Off;
                this.filter.SetAllow(node.catDef, allow, this.forceHiddenDefs, this.hiddenSpecialFilters);
            }
            base.EndLine();
            if (node.IsOpen(openMask))
            {
                this.DoCategoryChildren(node, indentLevel + 1, openMask, false);
            }
        }
Пример #16
0
        public void RecalculateDisplayRootCategory()
        {
            if (ThingCategoryNodeDatabase.allThingCategoryNodes == null)
            {
                DisplayRootCategory = ThingCategoryNodeDatabase.RootNode;
                return;
            }
            int    lastFoundCategory = -1;
            object lockObject        = new object();

            GenThreading.ParallelFor(0, ThingCategoryNodeDatabase.allThingCategoryNodes.Count, delegate(int index)
            {
                TreeNode_ThingCategory treeNode_ThingCategory = ThingCategoryNodeDatabase.allThingCategoryNodes[index];
                bool flag  = false;
                bool flag2 = false;
                foreach (ThingDef allowedDef in allowedDefs)
                {
                    if (treeNode_ThingCategory.catDef.ContainedInThisOrDescendant(allowedDef))
                    {
                        flag2 = true;
                    }
                    else
                    {
                        flag = true;
                    }
                }
                if (!flag && flag2)
                {
                    lock (lockObject)
                    {
                        if (index > lastFoundCategory)
                        {
                            lastFoundCategory = index;
                        }
                    }
                }
            });
            if (lastFoundCategory == -1)
            {
                DisplayRootCategory = ThingCategoryNodeDatabase.RootNode;
            }
            else
            {
                DisplayRootCategory = ThingCategoryNodeDatabase.allThingCategoryNodes[lastFoundCategory];
            }
        }
Пример #17
0
        public void DoCategory(TreeNode_ThingCategory node, int indentLevel, int openMask, Map map)
        {
            base.OpenCloseWidget(node, indentLevel, openMask);
            base.LabelLeft(node.LabelCap, node.catDef.description, indentLevel, 0f);
            MultiCheckboxState multiCheckboxState  = this.AllowanceStateOf(node);
            MultiCheckboxState multiCheckboxState2 = Widgets.CheckboxMulti(new Rect(this.LabelWidth, this.curY, this.lineHeight, this.lineHeight), multiCheckboxState, true);

            if (multiCheckboxState != multiCheckboxState2)
            {
                this.filter.SetAllow(node.catDef, multiCheckboxState2 == MultiCheckboxState.On, this.forceHiddenDefs, this.hiddenSpecialFilters);
            }
            base.EndLine();
            if (node.IsOpen(openMask))
            {
                this.DoCategoryChildren(node, indentLevel + 1, openMask, map, false);
            }
        }
Пример #18
0
        public void DoCategory(TreeNode_ThingCategory node, int indentLevel, int openMask, Map map)
        {
            OpenCloseWidget(node, indentLevel, openMask);
            LabelLeft(node.LabelCap, node.catDef.description, indentLevel);
            MultiCheckboxState multiCheckboxState  = AllowanceStateOf(node);
            MultiCheckboxState multiCheckboxState2 = Widgets.CheckboxMulti(new Rect(LabelWidth, curY, lineHeight, lineHeight), multiCheckboxState, paintable: true);

            if (multiCheckboxState != multiCheckboxState2)
            {
                filter.SetAllow(node.catDef, multiCheckboxState2 == MultiCheckboxState.On, forceHiddenDefs, hiddenSpecialFilters);
            }
            EndLine();
            if (node.IsOpen(openMask))
            {
                DoCategoryChildren(node, indentLevel + 1, openMask, map);
            }
        }
Пример #19
0
 public void SetAllow(ThingDef thingDef, bool allow)
 {
     if (allow != Allows(thingDef))
     {
         if (allow)
         {
             allowedDefs.Add(thingDef);
         }
         else
         {
             allowedDefs.Remove(thingDef);
         }
         if (settingsChangedCallback != null)
         {
             settingsChangedCallback();
         }
         displayRootCategoryInt = null;
     }
 }
Пример #20
0
 private bool Visible_NewTemp(SpecialThingFilterDef filter, TreeNode_ThingCategory node)
 {
     if (parentFilter != null && !parentFilter.Allows(filter))
     {
         return(false);
     }
     if (hiddenSpecialFilters == null)
     {
         CalculateHiddenSpecialFilters(node);
     }
     for (int i = 0; i < hiddenSpecialFilters.Count; i++)
     {
         if (hiddenSpecialFilters[i] == filter)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #21
0
        public MultiCheckboxState AllowanceStateOf(TreeNode_ThingCategory cat)
        {
            int num  = 0;
            int num2 = 0;

            foreach (ThingDef thingDef in cat.catDef.DescendantThingDefs)
            {
                if (this.Visible(thingDef))
                {
                    num++;
                    if (this.filter.Allows(thingDef))
                    {
                        num2++;
                    }
                }
            }
            bool flag = false;

            foreach (SpecialThingFilterDef sf in cat.catDef.DescendantSpecialThingFilterDefs)
            {
                if (this.Visible(sf) && !this.filter.Allows(sf))
                {
                    flag = true;
                    break;
                }
            }
            MultiCheckboxState result;

            if (num2 == 0)
            {
                result = MultiCheckboxState.Off;
            }
            else if (num == num2 && !flag)
            {
                result = MultiCheckboxState.On;
            }
            else
            {
                result = MultiCheckboxState.Partial;
            }
            return(result);
        }
Пример #22
0
        public void DoCategoryChildren(TreeNode_ThingCategory node, int indentLevel, int openMask, Map map, bool isRoot = false)
        {
            if (isRoot)
            {
                foreach (SpecialThingFilterDef parentsSpecialThingFilterDef in node.catDef.ParentsSpecialThingFilterDefs)
                {
                    if (Visible(parentsSpecialThingFilterDef))
                    {
                        DoSpecialFilter(parentsSpecialThingFilterDef, indentLevel);
                    }
                }
            }
            List <SpecialThingFilterDef> childSpecialFilters = node.catDef.childSpecialFilters;

            for (int i = 0; i < childSpecialFilters.Count; i++)
            {
                if (Visible(childSpecialFilters[i]))
                {
                    DoSpecialFilter(childSpecialFilters[i], indentLevel);
                }
            }
            foreach (TreeNode_ThingCategory childCategoryNode in node.ChildCategoryNodes)
            {
                if (Visible(childCategoryNode))
                {
                    DoCategory(childCategoryNode, indentLevel, openMask, map);
                }
            }
            foreach (ThingDef item in from n in node.catDef.childThingDefs
                     orderby n.label
                     select n)
            {
                if (Visible(item))
                {
                    DoThingDef(item, indentLevel, map);
                }
            }
        }
        public void DoCategoryChildren(TreeNode_ThingCategory node, int indentLevel, int openMask, bool isRoot = false)
        {
            if (isRoot)
            {
                foreach (SpecialThingFilterDef current in node.catDef.ParentsSpecialThingFilterDefs)
                {
                    if (this.Visible(current))
                    {
                        this.DoSpecialFilter(current, indentLevel);
                    }
                }
            }
            List <SpecialThingFilterDef> childSpecialFilters = node.catDef.childSpecialFilters;

            for (int i = 0; i < childSpecialFilters.Count; i++)
            {
                if (this.Visible(childSpecialFilters[i]))
                {
                    this.DoSpecialFilter(childSpecialFilters[i], indentLevel);
                }
            }
            foreach (TreeNode_ThingCategory current2 in node.ChildCategoryNodes)
            {
                if (this.Visible(current2))
                {
                    this.DoCategory(current2, indentLevel, openMask);
                }
            }
            foreach (ThingDef current3 in from n in node.catDef.childThingDefs
                     orderby n.label
                     select n)
            {
                if (this.Visible(current3))
                {
                    this.DoThingDef(current3, indentLevel);
                }
            }
        }
Пример #24
0
 public void SetAllow(SpecialThingFilterDef sfDef, bool allow)
 {
     if (!sfDef.configurable || allow == Allows(sfDef))
     {
         return;
     }
     if (allow)
     {
         if (disallowedSpecialFilters.Contains(sfDef))
         {
             disallowedSpecialFilters.Remove(sfDef);
         }
     }
     else if (!disallowedSpecialFilters.Contains(sfDef))
     {
         disallowedSpecialFilters.Add(sfDef);
     }
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
        public MultiCheckboxState AllowanceStateOf(TreeNode_ThingCategory cat)
        {
            int num  = 0;
            int num2 = 0;

            foreach (ThingDef current in cat.catDef.DescendantThingDefs)
            {
                if (this.Visible(current))
                {
                    num++;
                    if (this.filter.Allows(current))
                    {
                        num2++;
                    }
                }
            }
            foreach (SpecialThingFilterDef current2 in cat.catDef.DescendantSpecialThingFilterDefs)
            {
                if (this.Visible(current2))
                {
                    num++;
                    if (this.filter.Allows(current2))
                    {
                        num2++;
                    }
                }
            }
            if (num2 == 0)
            {
                return(MultiCheckboxState.Off);
            }
            if (num == num2)
            {
                return(MultiCheckboxState.On);
            }
            return(MultiCheckboxState.Partial);
        }
Пример #26
0
        public MultiCheckboxState AllowanceStateOf(TreeNode_ThingCategory cat)
        {
            int num  = 0;
            int num2 = 0;

            foreach (ThingDef descendantThingDef in cat.catDef.DescendantThingDefs)
            {
                if (Visible(descendantThingDef))
                {
                    num++;
                    if (filter.Allows(descendantThingDef))
                    {
                        num2++;
                    }
                }
            }
            bool flag = false;

            foreach (SpecialThingFilterDef descendantSpecialThingFilterDef in cat.catDef.DescendantSpecialThingFilterDefs)
            {
                if (Visible_NewTemp(descendantSpecialThingFilterDef, cat) && !filter.Allows(descendantSpecialThingFilterDef))
                {
                    flag = true;
                    break;
                }
            }
            if (num2 == 0)
            {
                return(MultiCheckboxState.Off);
            }
            if (num == num2 && !flag)
            {
                return(MultiCheckboxState.On);
            }
            return(MultiCheckboxState.Partial);
        }
Пример #27
0
 public void SetFromPreset(StorageSettingsPreset preset)
 {
     if (preset == StorageSettingsPreset.DefaultStockpile)
     {
         SetAllow(ThingCategoryDefOf.Foods, allow: true);
         SetAllow(ThingCategoryDefOf.Manufactured, allow: true);
         SetAllow(ThingCategoryDefOf.ResourcesRaw, allow: true);
         SetAllow(ThingCategoryDefOf.Items, allow: true);
         SetAllow(ThingCategoryDefOf.Buildings, allow: true);
         SetAllow(ThingCategoryDefOf.Weapons, allow: true);
         SetAllow(ThingCategoryDefOf.Apparel, allow: true);
         SetAllow(ThingCategoryDefOf.BodyParts, allow: true);
     }
     if (preset == StorageSettingsPreset.DumpingStockpile)
     {
         SetAllow(ThingCategoryDefOf.Corpses, allow: true);
         SetAllow(ThingCategoryDefOf.Chunks, allow: true);
     }
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
     displayRootCategoryInt = null;
 }
 public void RecalculateDisplayRootCategory()
 {
     this.DisplayRootCategory = ThingCategoryNodeDatabase.RootNode;
     foreach (TreeNode_ThingCategory treeNode_ThingCategory in ThingCategoryNodeDatabase.AllThingCategoryNodes)
     {
         bool flag  = false;
         bool flag2 = false;
         foreach (ThingDef value in this.allowedDefs)
         {
             if (treeNode_ThingCategory.catDef.DescendantThingDefs.Contains(value))
             {
                 flag2 = true;
             }
             else
             {
                 flag = true;
             }
         }
         if (!flag && flag2)
         {
             this.DisplayRootCategory = treeNode_ThingCategory;
         }
     }
 }
Пример #29
0
 public void RecalculateDisplayRootCategory()
 {
     DisplayRootCategory = ThingCategoryNodeDatabase.RootNode;
     foreach (TreeNode_ThingCategory allThingCategoryNode in ThingCategoryNodeDatabase.AllThingCategoryNodes)
     {
         bool flag  = false;
         bool flag2 = false;
         foreach (ThingDef allowedDef in allowedDefs)
         {
             if (allThingCategoryNode.catDef.DescendantThingDefs.Contains(allowedDef))
             {
                 flag2 = true;
             }
             else
             {
                 flag = true;
             }
         }
         if (!flag && flag2)
         {
             DisplayRootCategory = allThingCategoryNode;
         }
     }
 }
Пример #30
0
 private bool Visible(TreeNode_ThingCategory node)
 {
     return(node.catDef.DescendantThingDefs.Any(Visible));
 }