private void DrawNeed(Rect rect, Pawn ownerPawn)
{
if (ownerPawn.RaceProps.IsMechanoid) return;
if (ownerPawn.needs == null) return;
//TODO: rebuild using code in DrawOnGUI
Need need = ownerPawn.needs.TryGetNeed((NeedDef)displayObject);
if (need == null) return;
if (Mouse.IsOver(rect))
{
Widgets.DrawHighlight(rect);
}
TooltipHandler.TipRegion(rect, new TipSignal(() => need.GetTipString(), rect.GetHashCode()));
float num2 = 14f;
float num3 = num2 + 15f;
if (rect.height < 50f)
{
num2 *= Mathf.InverseLerp(0f, 50f, rect.height);
}
Text.Font = ((rect.height <= 55f) ? GameFont.Tiny : GameFont.Small);
Text.Anchor = TextAnchor.UpperLeft;
Rect rect3 = new Rect(rect.x, rect.y + rect.height / 2f, rect.width, rect.height / 2f);
rect3 = new Rect(rect3.x + num3, rect3.y, rect3.width - num3 * 2f, rect3.height - num2);
Widgets.FillableBar(rect3, need.CurLevelPercentage);
Widgets.FillableBarChangeArrows(rect3, need.GUIChangeArrow);
List<float> threshPercents = (List<float>)needThreshPercent.GetValue(need);
if (threshPercents != null)
{
for (int i = 0; i < threshPercents.Count; i++)
{
needDrawBarThreshold(rect3, threshPercents[i], need.CurLevelPercentage);
}
}
float curInstantLevel = need.CurInstantLevelPercentage;
if (curInstantLevel >= 0f)
{
needDrawBarInstantMarkerAt(rect3, curInstantLevel);
}
Text.Font = GameFont.Small;
}