private static int MaxNeedsCount(List <Thing> things) { int num = 0; for (int i = 0; i < things.Count; i++) { Pawn pawn = things[i] as Pawn; if (pawn != null) { CaravanPeopleAndItemsTabUtility.GetNeedsToDisplay(pawn, CaravanPeopleAndItemsTabUtility.tmpNeeds); num = Mathf.Max(num, CaravanPeopleAndItemsTabUtility.tmpNeeds.Count); } } return(num); }
private static void DoRow(Rect rect, Thing thing, Caravan caravan, ref Pawn specificNeedsTabForPawn, bool doNeeds, bool listingUsesAbandonSpecificCountButtons) { GUI.BeginGroup(rect); Rect rect2 = rect.AtZero(); Pawn pawn = thing as Pawn; if (listingUsesAbandonSpecificCountButtons) { if (thing.stackCount != 1) { CaravanPeopleAndItemsTabUtility.DoAbandonSpecificCountButton(rect2, thing, caravan); } rect2.width -= 24f; } CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, thing, caravan); rect2.width -= 24f; Widgets.InfoCardButton((float)(rect2.width - 24.0), (float)((rect.height - 24.0) / 2.0), thing); rect2.width -= 24f; if (pawn != null && !pawn.Dead) { CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn); rect2.width -= 24f; } if (pawn == null) { Rect rect3 = rect2; rect3.xMin = (float)(rect3.xMax - 60.0); CaravanPeopleAndItemsTabUtility.TryDrawMass(thing, rect3); rect2.width -= 60f; } if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } Rect rect4 = new Rect(4f, (float)((rect.height - 27.0) / 2.0), 27f, 27f); Widgets.ThingIcon(rect4, thing, 1f); if (pawn != null) { Rect bgRect = new Rect((float)(rect4.xMax + 4.0), 16f, 100f, 18f); GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, false, false); if (doNeeds) { CaravanPeopleAndItemsTabUtility.GetNeedsToDisplay(pawn, CaravanPeopleAndItemsTabUtility.tmpNeeds); float xMax = bgRect.xMax; for (int i = 0; i < CaravanPeopleAndItemsTabUtility.tmpNeeds.Count; i++) { Need need = CaravanPeopleAndItemsTabUtility.tmpNeeds[i]; int maxThresholdMarkers = 0; bool doTooltip = true; Rect rect5 = new Rect(xMax, 0f, 100f, 50f); Need_Mood mood = need as Need_Mood; if (mood != null) { maxThresholdMarkers = 1; doTooltip = false; TooltipHandler.TipRegion(rect5, new TipSignal(() => CaravanPeopleAndItemsTabUtility.CustomMoodNeedTooltip(mood), rect5.GetHashCode())); } need.DrawOnGUI(rect5, maxThresholdMarkers, 10f, false, doTooltip); xMax = rect5.xMax; } } if (pawn.Downed) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, (float)(rect.height / 2.0), rect.width); GUI.color = Color.white; } } else { Rect rect6 = new Rect((float)(rect4.xMax + 4.0), 0f, 300f, 30f); Text.Anchor = TextAnchor.MiddleLeft; Text.WordWrap = false; Widgets.Label(rect6, thing.LabelCap.Truncate(rect6.width, null)); Text.Anchor = TextAnchor.UpperLeft; Text.WordWrap = true; } GUI.EndGroup(); }