private static void DoRow(ref float curY, Rect viewRect, Rect scrollOutRect, Vector2 scrollPosition, Pawn pawn, Caravan caravan, ref Pawn specificNeedsTabForPawn, bool doNeeds) { float num = scrollPosition.y - 50f; float num2 = scrollPosition.y + scrollOutRect.height; if (curY > num && curY < num2) { CaravanNeedsTabUtility.DoRow(new Rect(0f, curY, viewRect.width, 50f), pawn, caravan, ref specificNeedsTabForPawn, doNeeds); } curY += 50f; }
public static void DoRows(Vector2 size, List <Pawn> pawns, Caravan caravan, ref Vector2 scrollPosition, ref float scrollViewHeight, ref Pawn specificNeedsTabForPawn, bool doNeeds = true) { if (specificNeedsTabForPawn != null && (!pawns.Contains(specificNeedsTabForPawn) || specificNeedsTabForPawn.Dead)) { specificNeedsTabForPawn = null; } Text.Font = GameFont.Small; Rect rect = new Rect(0f, 0f, size.x, size.y).ContractedBy(10f); Rect viewRect = new Rect(0f, 0f, rect.width - 16f, scrollViewHeight); Widgets.BeginScrollView(rect, ref scrollPosition, viewRect, true); float num = 0f; bool flag = false; for (int i = 0; i < pawns.Count; i++) { Pawn pawn = pawns[i]; if (pawn.IsColonist) { if (!flag) { Widgets.ListSeparator(ref num, viewRect.width, "CaravanColonists".Translate()); flag = true; } CaravanNeedsTabUtility.DoRow(ref num, viewRect, rect, scrollPosition, pawn, caravan, ref specificNeedsTabForPawn, doNeeds); } } bool flag2 = false; for (int j = 0; j < pawns.Count; j++) { Pawn pawn2 = pawns[j]; if (!pawn2.IsColonist) { if (!flag2) { Widgets.ListSeparator(ref num, viewRect.width, "CaravanPrisonersAndAnimals".Translate()); flag2 = true; } CaravanNeedsTabUtility.DoRow(ref num, viewRect, rect, scrollPosition, pawn2, caravan, ref specificNeedsTabForPawn, doNeeds); } } if (Event.current.type == EventType.Layout) { scrollViewHeight = num + 30f; } Widgets.EndScrollView(); }