public override void DoWindowContents(Rect rect) { base.DoWindowContents(rect); if (IsDirty) { BuildPawnList(); } var position = new Rect(0f, 0f, rect.width, 80f); GUI.BeginGroup(position); var x = 0f; Text.Font = GameFont.Small; // prisoner / colonist / Animal toggle var sourceButton = new Rect(0f, 0f, 200f, 35f); if (Widgets.ButtonText(sourceButton, Source.ToString().Translate())) { List <FloatMenuOption> options = new List <FloatMenuOption>(); if (Source != SourceOptions.Colonists) { options.Add(new FloatMenuOption("Colonists".Translate(), delegate { Source = SourceOptions.Colonists; IsDirty = true; })); } if (Source != SourceOptions.Prisoners) { options.Add(new FloatMenuOption("Prisoners".Translate(), delegate { Source = SourceOptions.Prisoners; IsDirty = true; })); } if (Source != SourceOptions.Animals) { options.Add(new FloatMenuOption("Animals".Translate(), delegate { Source = SourceOptions.Animals; IsDirty = true; })); } Find.WindowStack.Add(new FloatMenu(options)); } // name var nameLabel = new Rect(x, 50f, 165f, 30f); Text.Anchor = TextAnchor.LowerCenter; Widgets.Label(nameLabel, "FluffyMedical.Name".Translate()); if (Widgets.ButtonInvisible(nameLabel)) { if (OrderBy == Order.Name) { Asc = !Asc; } else { OrderBy = Order.Name; Asc = true; } IsDirty = true; } TooltipHandler.TipRegion(nameLabel, "FluffyMedical.ClickToSortBy".Translate("FluffyMedical.Name".Translate())); Widgets.DrawHighlightIfMouseover(nameLabel); x += 165f; // care var careLabel = new Rect(x, 50f, 100f, 30f); Widgets.Label(careLabel, "FluffyMedical.Care".Translate()); if (Widgets.ButtonInvisible(careLabel)) { if (Event.current.shift) { Utility_Medical.MedicalCareSetterAll(pawns); } else { if (OrderBy == Order.Care) { Asc = !Asc; } else { OrderBy = Order.Care; Asc = true; } IsDirty = true; } } TooltipHandler.TipRegion(careLabel, "FluffyMedical.ClickToSortBy".Translate("FluffyMedical.Care".Translate()) + "\n" + "FluffyMedical.ShiftClickTo".Translate("FluffyMedical.SetCare".Translate())); Widgets.DrawHighlightIfMouseover(careLabel); x += 100f; // bloodloss var bloodLabel = new Rect(x, 50f, 50f, 30f); var bloodIcon = new Rect(x + 17f, 60f, 16f, 16f); GUI.DrawTexture(bloodIcon, Utility_Medical.BloodTextureWhite); if (Widgets.ButtonInvisible(bloodLabel)) { if (OrderBy == Order.BleedRate) { Asc = !Asc; } else { OrderBy = Order.BleedRate; Asc = true; } IsDirty = true; } TooltipHandler.TipRegion(bloodLabel, "FluffyMedical.ClickToSortBy".Translate("BleedingRate".Translate())); Widgets.DrawHighlightIfMouseover(bloodLabel); x += 50f; // Operations var opLabel = new Rect(x, 50f, 50f, 30f); var opIcon = new Rect(x + 17f, 60f, 16f, 16f); GUI.DrawTexture(opIcon, Utility_Medical.OpTexture); if (Widgets.ButtonInvisible(opLabel)) { if (OrderBy == Order.Operations) { Asc = !Asc; } else { OrderBy = Order.Operations; Asc = true; } IsDirty = true; } TooltipHandler.TipRegion(opLabel, "FluffyMedical.ClickToSortBy".Translate("FluffyMedical.CurrentOperations".Translate())); Widgets.DrawHighlightIfMouseover(opLabel); x += 50f; // extra 15f offset for... what? makes labels roughly align. var colWidth = (rect.width - x - 15f) / (CapDefs.Count + 1); var offset = true; // Pain var painLabel = new Rect(x - colWidth / 2, 10f + (offset ? 10f : 40f), colWidth * 2, 30f); Widgets.DrawLine(new Vector2(x + colWidth - colWidth / 2, 40f + (offset ? 5f : 35f)), new Vector2(x + colWidth - colWidth / 2, 80f), Color.gray, 1); Widgets.Label(painLabel, "PainLevel".Translate()); if (Widgets.ButtonInvisible(painLabel)) { if (OrderBy == Order.Pain) { Asc = !Asc; } else { OrderBy = Order.Pain; Asc = true; } IsDirty = true; } TooltipHandler.TipRegion(painLabel, "FluffyMedical.ClickToSortBy".Translate("PainLevel".Translate())); Widgets.DrawHighlightIfMouseover(painLabel); offset = !offset; x += colWidth; // Efficiency foreach (PawnCapacityDef capDef in CapDefs) { var defLabel = new Rect(x - colWidth / 2, 10f + (offset ? 10f : 40f), colWidth * 2, 30f); Widgets.DrawLine(new Vector2(x + colWidth - colWidth / 2, 40f + (offset ? 5f : 35f)), new Vector2(x + colWidth - colWidth / 2, 80f), Color.gray, 1); Widgets.Label(defLabel, capDef.LabelCap); if (Widgets.ButtonInvisible(defLabel)) { if (OrderBy == Order.Efficiency && OrderByCapDef == capDef) { Asc = !Asc; } else { OrderBy = Order.Efficiency; OrderByCapDef = capDef; Asc = true; } IsDirty = true; } TooltipHandler.TipRegion(defLabel, "FluffyMedical.ClickToSortBy".Translate(capDef.LabelCap)); Widgets.DrawHighlightIfMouseover(defLabel); offset = !offset; x += colWidth; } GUI.EndGroup(); var content = new Rect(0f, position.yMax, rect.width, rect.height - position.yMax); GUI.BeginGroup(content); DrawRows(new Rect(0f, 0f, content.width, content.height)); GUI.EndGroup(); }