public float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY, bool showBloodLoss) { curY += TabDrawer.DrawHeader(0f, curY, leftRect.width, "EdB.Status".Translate(), true, TextAnchor.UpperLeft); curY += 4f; Text.Font = GameFont.Small; float bleedingRate = pawn.health.hediffSet.BleedingRate; if ((double)bleedingRate > 0.01) { string rightLabel = string.Concat(new string[] { bleedingRate.ToStringPercent(), "/", "Day".Translate() }); curY = this.DrawLeftRow(leftRect, curY, "BleedingRate".Translate(), rightLabel, HealthCardUtility.GetBleedingRateColor(bleedingRate), null); } 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); } } } curY += 16f; curY += TabDrawer.DrawHeader(0f, curY, leftRect.width, "EdB.Injuries".Translate(), true, TextAnchor.UpperLeft); curY += 4f; Rect position = new Rect(leftRect.x, curY, leftRect.width, leftRect.height - curY); GUI.BeginGroup(position); Rect outRect = new Rect(0f, 0f, position.width, position.height); Rect viewRect = new Rect(0f, 0f, position.width - 16f, HealthCardUtility.scrollViewHeight); Rect rect = new Rect(position.x, position.y, position.width - 16f, position.height); GUI.color = Color.white; Widgets.BeginScrollView(outRect, ref HealthCardUtility.scrollPosition, viewRect); float num = 0f; HealthCardUtility.highlight = true; bool flag = false; foreach (IGrouping <BodyPartRecord, Hediff> current2 in ((IEnumerable <IGrouping <BodyPartRecord, Hediff> >) this.visibleHediffGroupsInOrderMethod.Invoke(null, new object[] { pawn, showBloodLoss }))) { flag = true; this.DrawHediffRow(rect, pawn, current2, ref num); } if (!flag) { GUI.color = Color.gray; Text.Anchor = TextAnchor.UpperCenter; Widgets.Label(new Rect(0f, 0f, position.width, 30f), new GUIContent("NoInjuries".Translate())); Text.Anchor = TextAnchor.UpperLeft; } if (Event.current.type == EventType.Layout) { HealthCardUtility.scrollViewHeight = num; } Widgets.EndScrollView(); GUI.EndGroup(); GUI.color = Color.white; return(curY); }
public float DrawStatus(Rect leftRect, Pawn pawn, float curY, bool showBloodLoss) { Text.Font = GameFont.Small; float bleedingRate = pawn.health.hediffSet.BleedingRate; if ((double)bleedingRate > 0.01) { string rightLabel = string.Concat(new string[] { bleedingRate.ToStringPercent(), "/", "Day".Translate() }); curY = this.DrawLeftRow(leftRect, curY, "BleedingRate".Translate(), rightLabel, HealthCardUtility.GetBleedingRateColor(bleedingRate), null); } 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); }