public ActivityTask(ActivityTask task) { this.dayOfTask = task.dayOfTask; this.startHour = task.startHour; this.property = task.property; this.loadID = Find.UniqueIDsManager.GetNextBillID(); this.humanlike = task.humanlike; this.animal = task.humanlike; this.filter = task.filter; }
public ActivityTask(ScheduledDay dayOfTask, ReligionProperty property) { this.dayOfTask = dayOfTask; if (Scribe.mode == LoadSaveMode.Inactive) { this.loadID = Find.UniqueIDsManager.GetNextThingID(); startHour = 18; this.property = property; humanlike = new IngredientPawn(); animal = new IngredientPawn(); List <ThingDef> defs = new List <ThingDef>(); foreach (ThingDefsCount tcd in ActivityTaskDef.ThingDefsCount) { defs.Add(tcd.Thing); } filter = new SimpleFilter(defs); } }
private void IngredientPawnRestriction(Listing_Standard holder, IngredientPawn ingredientPawn, bool isHumanlike) { Listing_Standard listing_Standard = holder.BeginSection(100f); string label = null; string context = null; if (isHumanlike) { label = "ReligionInfo_ActivityPawnHumanlike".Translate(); context = "ReligionInfo_IsPrisonerOfColony".Translate(); } else { label = "ReligionInfo_ActivityPawnAnimal".Translate(); context = "ReligionInfo_IsTamed".Translate(); } listing_Standard.Label(label); listing_Standard.Label("ReligionInfo_PawnIngredientWarning".Translate()); //Widgets.Dropdown<IngredientPawn, bool>(listing_Standard.GetRect(30f), ingredientPawn, (IngredientPawn b) => b.PartOfColony, (IngredientPawn b) => this.GenerateBoolOptions(ingredientPawn), context + " " + ingredientPawn.PartOfColony.ToString().Translate(), null, null, null, null, false); Widgets.Dropdown <IngredientPawn, Pawn>(listing_Standard.GetRect(30f), ingredientPawn, (IngredientPawn b) => b.ConcretePawn, (IngredientPawn b) => this.GenerateIngredientPawnRestrictionOptions(ingredientPawn, isHumanlike), (ingredientPawn.ConcretePawn != null) ? ingredientPawn.ConcretePawn.LabelShortCap : "None".Translate(), null, null, null, null, false); holder.EndSection(listing_Standard); }
//private IEnumerable<Widgets.DropdownMenuElement<bool>> GenerateBoolOptions(IngredientPawn ingredientPawn) //{ // yield return new Widgets.DropdownMenuElement<bool> // { // option = new FloatMenuOption("True".Translate(), delegate // { // ingredientPawn.PartOfColony = true; // }, MenuOptionPriority.Default, null, null, 0f, null, null), // payload = true // }; // yield return new Widgets.DropdownMenuElement<bool> // { // option = new FloatMenuOption("False".Translate(), delegate // { // ingredientPawn.PartOfColony = false; // }, MenuOptionPriority.Default, null, null, 0f, null, null), // payload = false // }; //} private IEnumerable <Widgets.DropdownMenuElement <Pawn> > GenerateIngredientPawnRestrictionOptions(IngredientPawn ingredientPawn, bool isHumanlike) { yield return(new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption("None".Translate(), delegate { ingredientPawn.ConcretePawn = null; }, MenuOptionPriority.Default, null, null, 0f, null, null), payload = null }); IEnumerable <Pawn> pawns = task.ParentFacility.Map.mapPawns.AllPawnsSpawned; if (isHumanlike) { pawns = pawns.Where(x => x.RaceProps.Humanlike); } else { pawns = pawns.Where(x => x.RaceProps.Animal); } foreach (Pawn pawn in pawns) { if (task.ThingFilter.Allows(pawn.def)) { if (pawn == task.PawnRestriction) { yield return new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("{0} ({1})", pawn.LabelShortCap, "ReligionInfo_Unavaliable".Translate()), null, MenuOptionPriority.Default, null, null, 0f, null, null), payload = pawn } } ; else { yield return new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("{0}", pawn.LabelShortCap), delegate { ingredientPawn.ConcretePawn = pawn; }, MenuOptionPriority.Default, null, null, 0f, null, null), payload = pawn } }; } } }