private void OtherThingDefs(EntityCategoryDef preDef) { IEnumerable <ThingDef> otherThingDefs = DefDatabase <ThingDef> .AllDefs.Where(thing => thing.category == ThingCategory.Pawn); foreach (var a in otherThingDefs.Except(preDef.DescendantThingDefs)) { preDef.childThingDefs.Add(a); } #if DEBUG if (otherThingDefs != null) { Log.Message(DebugLog.GetMethodName() + "Number of undefined objects=" + otherThingDefs.Count()); } #endif }
public EntityCategory(EntityCategoryDef def) { catDef = def; foreach (var a in def.GetChildCategoryDef()) { this.childCategories.Add(new EntityCategory(a)); } if (this.catDef.label.NullOrEmpty() && this.catDef.childThingDefs != null) { ThingDef tmpDef = this.catDef.childThingDefs.First(); if (tmpDef != null) { this.catDef.label = tmpDef.label; } } }
private void CreateRootCategoryDef() { EntityCategoryDef result = new EntityCategoryDef(nodeDef); if (this.categoryPriset != null && !this.categoryPriset.categories.NullOrEmpty()) { foreach (var a in this.categoryPriset.categories) { result.AddChildCategoryDef(a); } } else if (!this.canDisplayCategorys.NullOrEmpty()) { foreach (var a in this.canDisplayCategorys) { result.AddChildCategoryDef(a); } } OtherThingDefs(result); this.categoryRootDefInt = result; }
public void RemoveChildCategoryDef(EntityCategoryDef other) { childCategoryDefs.Remove(other); }
public void AddChildCategoryDef(EntityCategoryDef other) { childCategoryDefs.Add(other); }