private void SetArea(Designator_AreaAllowedExpand des, Area_Allowed a) { if (a == null) { return; } Type desType = typeof(Designator_AreaAllowed); FieldInfo areaToSet = desType.GetField("selectedArea", BindingFlags.NonPublic | BindingFlags.Static); if (areaToSet != null) { areaToSet.SetValue(null, a); } }
} //end CompGetGizmosExtra private void DesignateArea() { List <FloatMenuOption> dropdown = new List <FloatMenuOption>(); Designator_AreaAllowedExpand des = DesignatorUtility.FindAllowedDesignator <Designator_AreaAllowedExpand>() as Designator_AreaAllowedExpand; foreach (Area_Allowed a in base.parent.Map.areaManager.AllAreas.OfType <Area_Allowed>()) { dropdown.Add(new FloatMenuOption(a.Label, delegate { SetArea(des, a); des.DesignateMultiCell(CellsInRectangularRadius()); })); } Find.WindowStack.Add(new FloatMenu(dropdown)); }//end MakeArea