protected override void FillTab() { ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; Rect position = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(20f); bool isPrisonerOfColony = base.SelPawn.IsPrisonerOfColony; try { GUI.BeginGroup(position); float num = 10f; Rect rect = new Rect(10f, num, position.width - 20f, 32f); MedicalCareUtility.MedicalCareSetter(rect, ref base.SelPawn.playerSettings.medCare); num += 32f; num += 18f; Rect rect2 = new Rect(10f, num, position.width - 28f, position.height - num); bool getsFood = base.SelPawn.guest.GetsFood; num += WidgetDrawer.DrawLabeledCheckbox(rect2, "GetsFood".Translate(), ref getsFood); base.SelPawn.guest.GetsFood = getsFood; if (isPrisonerOfColony) { num += 6f; int length = Enum.GetValues(typeof(PrisonerInteractionMode)).Length; float height = (float)(length * 28 + 20); Rect rect3 = new Rect(0f, num, position.width, height); TabDrawer.DrawBox(rect3); Rect rect4 = rect3.ContractedBy(10f); rect4.height = 28f; IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator(); while (enumerator.MoveNext()) { PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current); if (WidgetDrawer.DrawLabeledRadioButton(rect4, prisonerInteractionMode.GetLabel(), base.SelPawn.guest.interactionMode == prisonerInteractionMode, true)) { base.SelPawn.guest.interactionMode = prisonerInteractionMode; } rect4.y += 28f; } Rect rect5 = new Rect(rect3.x, rect3.y + rect3.height + 5f, rect3.width - 4f, 28f); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect5, "RecruitmentDifficulty".Translate() + ": " + base.SelPawn.guest.RecruitDifficulty.ToString("##0")); Text.Anchor = TextAnchor.UpperLeft; } } finally { GUI.EndGroup(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; } if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value) { Pawn selPawn = base.SelPawn; if (selPawn != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, selPawn); } } }
public void ResetTextures() { BrowseButtonDrawer.ResetTextures(); ITab_Pawn_Health_Alternate.ResetTextures(); MedicalCareUtility.Reset(); BillDrawer.ResetTextures(); TabDrawer.ResetTextures(); }
public float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY) { curY += 4f; if (pawn.playerSettings != null && !pawn.Dead) { Rect rect = new Rect(0f, curY, 140f, 28f); MedicalCareUtility.MedicalCareSetter(rect, ref pawn.playerSettings.medCare); curY += 32f; } Text.Font = GameFont.Small; if (pawn.def.race.isFlesh) { Pair <string, Color> painLabel = RimWorld.HealthCardUtility.GetPainLabel(pawn); string tipLabel = "PainLevel".Translate() + ": " + (pawn.health.hediffSet.Pain * 100f).ToString("F0") + "%"; curY = this.DrawLeftRow(leftRect, curY, "PainLevel".Translate(), painLabel.First, painLabel.Second, tipLabel); } if (!pawn.Dead) { IEnumerable <PawnCapacityDef> source; if (pawn.def.race.Humanlike) { source = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnHumanlikes select x; } else if (pawn.def.race.Animal) { source = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnAnimals select x; } else { source = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnMechanoids select x; } foreach (PawnCapacityDef current in from act in source orderby act.listOrder select act) { if (PawnCapacityUtility.BodyCanEverDoActivity(pawn.RaceProps.body, current)) { Pair <string, Color> efficiencyLabel = RimWorld.HealthCardUtility.GetEfficiencyLabel(pawn, current); string tipLabel2 = "Efficiency".Translate() + ": " + (pawn.health.capacities.GetEfficiency(current) * 100f).ToString("F0") + "%"; curY = this.DrawLeftRow(leftRect, curY, current.GetLabelFor(pawn.RaceProps.isFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, tipLabel2); } } } return(curY); }
protected override void FillTab() { Pawn pawn = null; if (base.SelPawn != null) { pawn = base.SelPawn; } else { Corpse corpse = base.SelThing as Corpse; if (corpse != null) { pawn = corpse.innerPawn; } } if (pawn == null) { Log.Error("Health tab found no selected pawn to display."); return; } Corpse corpse2 = base.SelThing as Corpse; bool showBloodLoss = corpse2 == null || corpse2.Age < 60000; bool flag = !pawn.RaceProps.Humanlike && pawn.Downed; bool flag2 = base.SelThing.def.AllRecipes.Any <RecipeDef>(); bool flag3 = flag2 && !pawn.Dead && (pawn.IsColonist || pawn.IsPrisonerOfColony || flag); TextAnchor anchor = Text.Anchor; Rect rect = new Rect(20f, 51f, ITab_Pawn_Health_Alternate.PanelSize.x - 40f, 345f); float height = this.size.y - rect.height - 109f; Rect position = new Rect(rect.x, rect.y + rect.height + 16f, rect.width, height); if (!flag3) { this.operationsTabSelected = false; } List <TabRecord> list = new List <TabRecord>(); list.Add(new TabRecord("HealthOverview".Translate(), delegate { this.operationsTabSelected = false; }, !this.operationsTabSelected)); if (flag3) { string label; if (pawn.RaceProps.mechanoid) { label = "MedicalOperationsMechanoidsShort".Translate(new object[] { pawn.BillStack.Count }); } else { label = "MedicalOperationsShort".Translate(new object[] { pawn.BillStack.Count }); } list.Add(new TabRecord(label, delegate { this.operationsTabSelected = true; }, this.operationsTabSelected)); } GUI.color = TabDrawer.BoxColor; GUI.DrawTexture(rect, TabDrawer.WhiteTexture); GUI.color = TabDrawer.BoxBorderColor; Widgets.DrawBox(rect, 1); GUI.color = Color.white; TabDrawer.DrawTabs(new Rect(rect.x, rect.y, rect.width - 90f, rect.height), list, ITab_Pawn_Health_Alternate.TabAtlasTex); float num = 0f; GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; if (!this.operationsTabSelected) { Rect position2 = rect.ContractedBy(12f); if (pawn.playerSettings != null && !pawn.Dead) { Rect rect2 = new Rect(position2.x + 4f, position2.y + 8f, position2.width, 32f); MedicalCareUtility.MedicalCareSetter(rect2, ref pawn.playerSettings.medCare); position2.y += 50f; position2.height -= 50f; } try { GUI.BeginGroup(position2); Rect leftRect = new Rect(0f, num, position2.width, position2.height - num); num = this.healthCardUtility.DrawStatus(leftRect, pawn, num, showBloodLoss); } finally { GUI.EndGroup(); } } else { Rect position3 = rect.ContractedBy(12f); try { GUI.BeginGroup(position3); Rect rect3 = new Rect(0f, 0f, position3.width, position3.height); this.operationsScrollView.Begin(rect3); ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.MedicalOperations, KnowledgeAmount.GuiFrame); num = this.healthCardUtility.DrawMedOperationsTab(rect3, pawn, base.SelThing, num); this.operationsScrollView.End(num); } finally { GUI.EndGroup(); } } Text.Font = GameFont.Small; GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; GUI.BeginGroup(position); Rect leftRect2 = new Rect(0f, 0f, position.width, position.height); this.healthCardUtility.DrawInjuries(leftRect2, pawn, showBloodLoss); GUI.EndGroup(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value) { Pawn pawn2 = null; if (base.SelPawn != null) { pawn2 = base.SelPawn; } else { Corpse corpse3 = base.SelThing as Corpse; if (corpse3 != null) { pawn2 = corpse3.innerPawn; } } if (pawn2 != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, pawn2); } } GUI.color = Color.white; Text.Anchor = anchor; Rect rect4 = new Rect(0f, 0f, this.size.x, this.size.y); if (Event.current.type == EventType.ScrollWheel && Mouse.IsOver(rect4)) { Event.current.Use(); } }