public override void DoHeader(Rect rect, PawnTable table) { // decrease height of rect (base does this already, but MedCareSetter does not. rect.yMin = rect.yMax - Constants.DesiredHeaderHeight; if (Event.current.shift && Mouse.IsOver(rect) && table.PawnsListForReading.Any()) { // mass assign // note; weird as f**k sentinel/token approach, because somehow an intercepted click event and the medCareSetter do not fire in the same GUI phase? var sentinel = OverallCare; var token = table.PawnsListForReading.Max(p => p.playerSettings.medCare); MedicalCareUtility.MedicalCareSetter(rect, ref token); if (sentinel != token) { OverallCare = token; } TooltipHandler.TipRegion(rect, GetHeaderTip(table)); } else if (Event.current.control && Mouse.IsOver(rect)) { // defaults DoDefaultMedCareHeader(rect); TooltipHandler.TipRegion(rect, GetHeaderTip(table)); } else { // text base.DoHeader(rect, table); } }
public void DoDefaultMedCareHeader(Rect rect) { switch (MainTabWindow_Medical.Instance.Source) { case SourceType.Animals: MedicalCareUtility.MedicalCareSetter(rect, ref Find.PlaySettings.defaultCareForColonyAnimal); break; case SourceType.Colonists: MedicalCareUtility.MedicalCareSetter(rect, ref Find.PlaySettings.defaultCareForColonyHumanlike); break; case SourceType.Hostiles: MedicalCareUtility.MedicalCareSetter(rect, ref Find.PlaySettings.defaultCareForHostileFaction); break; case SourceType.Prisoners: MedicalCareUtility.MedicalCareSetter(rect, ref Find.PlaySettings.defaultCareForColonyPrisoner); break; case SourceType.Visitors: MedicalCareUtility.MedicalCareSetter(rect, ref Find.PlaySettings.defaultCareForNeutralFaction); break; } }
public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { if (pawn?.playerSettings?.medCare != null) { MedicalCareUtility.MedicalCareSetter(rect, ref pawn.playerSettings.medCare); } }
public override void DoHeader(Rect rect, PawnTable table) { // decrease height of rect (base does this already, but MedCareSetter does not. rect.yMin = rect.yMax - Constants.DesiredHeaderHeight; if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Mouse.IsOver(rect) && table.PawnsListForReading.Any()) { var current = table.PawnsListForReading.Max(p => p.playerSettings.medCare); MedicalCareUtility.MedicalCareSetter(rect, ref current); if (OverallCare != current) { OverallCare = current; } TooltipHandler.TipRegion(rect, GetHeaderTip(table)); } else if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand)) && Mouse.IsOver(rect)) { // defaults DoDefaultMedCareHeader(rect); TooltipHandler.TipRegion(rect, GetHeaderTip(table)); } else { // text base.DoHeader(rect, table); } }
public override void DoWindowContents(Rect inRect) { Text.Font = GameFont.Medium; Rect rect = new Rect(0f, 0f, InitialSize.x, 50f); Widgets.Label(rect, "Medical Defaults"); Text.Font = GameFont.Small; Rect content = new Rect(0, 50, inRect.width, inRect.height - 70); Listing_Standard listing_Standard = new Listing_Standard(content); float stdHeight = MedicalCareUtility.CareSetterHeight; float hgap = 40; float hposA = 10; float hposB = 160; float hposC = hposB + MedicalCareUtility.CareSetterWidth + hgap; float hwidthA = 120; float hwidthB = MedicalCareUtility.CareSetterWidth; float hwidthC = MedicalCareUtility.CareSetterWidth; try { Config config = UtilityWorldObjectManager.GetUtilityWorldObject <Config>(); MedicalCareUtility_Detour.HorribleHackWithinDefaultDialog = true; listing_Standard.Gap(20); { Rect title = listing_Standard.GetRect(stdHeight); Widgets.Label(new Rect(hposB + 30, title.y, hwidthB, stdHeight), "Human"); Widgets.Label(new Rect(hposC + 30, title.y, hwidthC, stdHeight), "Animal"); } { Rect title = listing_Standard.GetRect(stdHeight); Widgets.Label(new Rect(hposA, title.y, hwidthA, stdHeight), "Colonist"); MedicalCareUtility.MedicalCareSetter(new Rect(hposB, title.y, hwidthB, stdHeight), ref config.care_PlayerHuman); MedicalCareUtility.MedicalCareSetter(new Rect(hposC, title.y, hwidthC, stdHeight), ref config.care_PlayerAnimal); } { Rect title = listing_Standard.GetRect(stdHeight); Widgets.Label(new Rect(hposA, title.y, hwidthA, stdHeight), "Colonist Prisoner"); MedicalCareUtility.MedicalCareSetter(new Rect(hposB, title.y, hwidthB, stdHeight), ref config.care_PrisonerHuman); } { Rect title = listing_Standard.GetRect(stdHeight); Widgets.Label(new Rect(hposA, title.y, hwidthA, stdHeight), "Ally"); MedicalCareUtility.MedicalCareSetter(new Rect(hposB, title.y, hwidthB, stdHeight), ref config.care_AllyHuman); MedicalCareUtility.MedicalCareSetter(new Rect(hposC, title.y, hwidthC, stdHeight), ref config.care_AllyAnimal); } { Rect title = listing_Standard.GetRect(stdHeight); Widgets.Label(new Rect(hposA, title.y, hwidthA, stdHeight), "Enemy"); MedicalCareUtility.MedicalCareSetter(new Rect(hposB, title.y, hwidthB, stdHeight), ref config.care_EnemyHuman); MedicalCareUtility.MedicalCareSetter(new Rect(hposC, title.y, hwidthC, stdHeight), ref config.care_EnemyAnimal); } listing_Standard.Gap(50); if (listing_Standard.ButtonText("Reset all pawns to these values")) { foreach (Pawn p in PawnsFinder.AllMapsAndWorld_Alive) { Pawn_PlayerSettings_Detour.ResetPPSMedicalCare(p.playerSettings, p); } } } finally { MedicalCareUtility_Detour.HorribleHackWithinDefaultDialog = false; } listing_Standard.End(); }
protected override void FillTab() { ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; var rect1 = new Rect(0.0f, 0.0f, this.size.x, this.size.y).ContractedBy(10f); var listingStandard = new Listing_Standard(rect1); { var getsFood = this.SelPawn.guest.GetsFood; listingStandard.DoLabelCheckbox("GetsFood".Translate(), ref getsFood, (string)null); this.SelPawn.guest.GetsFood = getsFood; var rect2 = listingStandard.GetRect(28f); rect2.width = 140f; MedicalCareUtility.MedicalCareSetter(rect2, ref this.SelPawn.playerSettings.medCare); listingStandard.DoGap(4f); listingStandard.DoLabel("RecruitmentDifficulty".Translate() + ": " + this.SelPawn.guest.RecruitDifficulty.ToString("##0")); if (Prefs.DevMode) { listingStandard.DoLabel("Dev: Prison break MTB days: " + (object)(int)PrisonBreakUtility.InitiatePrisonBreakMtbDays(this.SelPawn)); } var rect3 = listingStandard.GetRect(200f); Widgets.DrawMenuSection(rect3, true); var position = rect3.ContractedBy(10f); GUI.BeginGroup(position); { var rect4 = new Rect(0.0f, 0.0f, position.width, 30f); foreach (PrisonerInteractionMode mode in Enum.GetValues(typeof(PrisonerInteractionMode))) { if (Widgets.LabelRadioButton(rect4, mode.GetLabel(), this.SelPawn.guest.interactionMode == mode)) { this.SelPawn.guest.interactionMode = mode; } rect4.y += 28f; } if (Widgets.LabelRadioButton(rect4, "PI_Enslave".Translate(), this.SelPawn.guest.interactionMode == (PrisonerInteractionMode)Data.PIM_EnslavePrisoner)) { this.SelPawn.guest.interactionMode = (PrisonerInteractionMode)Data.PIM_EnslavePrisoner; } } GUI.EndGroup(); var compSlave = this.SelPawn.TryGetComp <CompSlave>(); if (compSlave != null) { listingStandard.DoGap(4f); var rect5 = listingStandard.GetRect(30f); if (!compSlave.ShouldBeTransfered) { if (Widgets.TextButton(rect5, "PI_TransferPrisoner".Translate())) { var list = this.GenOptions(); if ( (list.Count == 0) || ( (list.Count == 1) && (list[0].label == "PI_Prison_Cell".Translate()) && (this.SelPawn.GetRoom() == this.SelPawn.ownership.OwnedBed.GetRoom()) ) ) { list.Add(new FloatMenuOption("PI_InstallCamera".Translate(), (Action)null)); } Find.WindowStack.Add((Window) new FloatMenu(list, false)); } else { this.cached = null; } } else { if (Widgets.TextButton(rect5, "PI_CancelTransfer".Translate())) { compSlave.haulTarget = null; } listingStandard.DoGap(4f); var rect7 = listingStandard.GetRect(30f); var style = new GUIStyle(Text.CurTextFieldStyle); style.alignment = TextAnchor.MiddleCenter; string label = string.Empty; if (compSlave.haulTarget is Building_PrisonMarker) { label = ((Building_PrisonMarker)compSlave.haulTarget).markerName; } else if (compSlave.haulTarget is Building_Bed) { label = "PI_Prison_Cell".Translate(); } GUI.Label(rect7, label, style); } } } listingStandard.End(); }