private static float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY) { curY += 4f; Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.UpperLeft; GUI.color = new Color(0.9f, 0.9f, 0.9f); string str = string.Empty; if (pawn.gender != 0) { str = pawn.GetGenderLabel() + " "; } str = str + pawn.def.label + ", " + "AgeIndicator".Translate(pawn.ageTracker.AgeNumberString); Rect rect = new Rect(0f, curY, leftRect.width, 34f); Widgets.Label(rect, str.CapitalizeFirst()); TooltipHandler.TipRegion(rect, () => pawn.ageTracker.AgeTooltipString, 73412); if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } GUI.color = Color.white; curY += 34f; if (pawn.foodRestriction != null && pawn.foodRestriction.Configurable) { Rect rect2 = new Rect(0f, curY, leftRect.width * 0.42f, 23f); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect2, "FoodRestriction".Translate()); GenUI.ResetLabelAlign(); Rect rect3 = new Rect(rect2.width, curY, leftRect.width - rect2.width, 23f); if (Widgets.ButtonText(rect3, pawn.foodRestriction.CurrentFoodRestriction.label)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); List <FoodRestriction> allFoodRestrictions = Current.Game.foodRestrictionDatabase.AllFoodRestrictions; for (int i = 0; i < allFoodRestrictions.Count; i++) { FoodRestriction localRestriction = allFoodRestrictions[i]; list.Add(new FloatMenuOption(localRestriction.label, delegate { pawn.foodRestriction.CurrentFoodRestriction = localRestriction; })); } list.Add(new FloatMenuOption("ManageFoodRestrictions".Translate(), delegate { Find.WindowStack.Add(new Dialog_ManageFoodRestrictions(null)); })); Find.WindowStack.Add(new FloatMenu(list)); } curY += 23f; } if (pawn.IsColonist && !pawn.Dead) { bool selfTend = pawn.playerSettings.selfTend; Rect rect4 = new Rect(0f, curY, leftRect.width, 24f); Widgets.CheckboxLabeled(rect4, "SelfTend".Translate(), ref pawn.playerSettings.selfTend); if (pawn.playerSettings.selfTend && !selfTend) { if (pawn.story.WorkTypeIsDisabled(WorkTypeDefOf.Doctor)) { pawn.playerSettings.selfTend = false; Messages.Message("MessageCannotSelfTendEver".Translate(pawn.LabelShort, pawn), MessageTypeDefOf.RejectInput, historical: false); } else if (pawn.workSettings.GetPriority(WorkTypeDefOf.Doctor) == 0) { Messages.Message("MessageSelfTendUnsatisfied".Translate(pawn.LabelShort, pawn), MessageTypeDefOf.CautionInput, historical: false); } } TooltipHandler.TipRegion(rect4, "SelfTendTip".Translate(Faction.OfPlayer.def.pawnsPlural, 0.7f.ToStringPercent()).CapitalizeFirst()); curY += 28f; } if (pawn.playerSettings != null && !pawn.Dead && Current.ProgramState == ProgramState.Playing) { Rect rect5 = new Rect(0f, curY, 140f, 28f); MedicalCareUtility.MedicalCareSetter(rect5, ref pawn.playerSettings.medCare); if (Widgets.ButtonText(new Rect(leftRect.width - 70f, curY, 70f, 28f), "MedGroupDefaults".Translate())) { Find.WindowStack.Add(new Dialog_MedicalDefaults()); } curY += 32f; } Text.Font = GameFont.Small; if (pawn.def.race.IsFlesh) { Pair <string, Color> painLabel = GetPainLabel(pawn); string painTip = GetPainTip(pawn); curY = DrawLeftRow(leftRect, curY, "PainLevel".Translate(), painLabel.First, painLabel.Second, painTip); } if (!pawn.Dead) { IEnumerable <PawnCapacityDef> source = pawn.def.race.Humanlike ? (from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnHumanlikes select x) : ((!pawn.def.race.Animal) ? DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnMechanoids) : DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnAnimals)); { foreach (PawnCapacityDef item in from act in source orderby act.listOrder select act) { if (PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, item)) { PawnCapacityDef activityLocal = item; Pair <string, Color> efficiencyLabel = GetEfficiencyLabel(pawn, item); Func <string> textGetter = () => (!pawn.Dead) ? GetPawnCapacityTip(pawn, activityLocal) : string.Empty; curY = DrawLeftRow(leftRect, curY, item.GetLabelFor(pawn.RaceProps.IsFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, new TipSignal(textGetter, pawn.thingIDNumber ^ item.index)); } } return(curY); } } return(curY); }
public override void DoWindowContents(Rect inRect) { float num = 0f; Rect rect = new Rect(0f, 0f, 150f, 35f); num += 150f; if (Widgets.ButtonText(rect, "SelectFoodRestriction".Translate())) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (FoodRestriction allFoodRestriction in Current.Game.foodRestrictionDatabase.AllFoodRestrictions) { FoodRestriction localRestriction = allFoodRestriction; list.Add(new FloatMenuOption(localRestriction.label, delegate { SelectedFoodRestriction = localRestriction; })); } Find.WindowStack.Add(new FloatMenu(list)); } num += 10f; Rect rect2 = new Rect(num, 0f, 150f, 35f); num += 150f; if (Widgets.ButtonText(rect2, "NewFoodRestriction".Translate())) { SelectedFoodRestriction = Current.Game.foodRestrictionDatabase.MakeNewFoodRestriction(); } num += 10f; Rect rect3 = new Rect(num, 0f, 150f, 35f); num += 150f; if (Widgets.ButtonText(rect3, "DeleteFoodRestriction".Translate())) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); foreach (FoodRestriction allFoodRestriction2 in Current.Game.foodRestrictionDatabase.AllFoodRestrictions) { FoodRestriction localRestriction2 = allFoodRestriction2; list2.Add(new FloatMenuOption(localRestriction2.label, delegate { AcceptanceReport acceptanceReport = Current.Game.foodRestrictionDatabase.TryDelete(localRestriction2); if (!acceptanceReport.Accepted) { Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput, historical: false); } else if (localRestriction2 == SelectedFoodRestriction) { SelectedFoodRestriction = null; } })); } Find.WindowStack.Add(new FloatMenu(list2)); } Rect rect4 = new Rect(0f, 40f, inRect.width, inRect.height - 40f - CloseButSize.y).ContractedBy(10f); if (SelectedFoodRestriction == null) { GUI.color = Color.grey; Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(rect4, "NoFoodRestrictionSelected".Translate()); Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; } else { GUI.BeginGroup(rect4); DoNameInputRect(new Rect(0f, 0f, 200f, 30f), ref SelectedFoodRestriction.label); ThingFilterUI.DoThingFilterConfigWindow(new Rect(0f, 40f, 300f, rect4.height - 45f - 10f), ref scrollPosition, SelectedFoodRestriction.filter, foodGlobalFilter, 1, null, HiddenSpecialThingFilters(), forceHideHitPointsConfig: true); GUI.EndGroup(); } }