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; }
private static int MaxNeedsCount(List <Pawn> pawns) { int num = 0; for (int i = 0; i < pawns.Count; i++) { CaravanNeedsTabUtility.GetNeedsToDisplay(pawns[i], CaravanNeedsTabUtility.tmpNeeds); num = Mathf.Max(num, CaravanNeedsTabUtility.tmpNeeds.Count); } return(num); }
private static void DoRow(Rect rect, Pawn pawn, Caravan caravan, ref Pawn specificNeedsTabForPawn, bool doNeeds) { GUI.BeginGroup(rect); Rect rect2 = rect.AtZero(); CaravanThingsTabUtility.DoAbandonButton(rect2, pawn, caravan); rect2.width -= 24f; Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, pawn); rect2.width -= 24f; if (!pawn.Dead) { CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn); rect2.width -= 24f; } Widgets.DrawHighlightIfMouseover(rect2); Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f); Widgets.ThingIcon(rect3, pawn, 1f); Rect bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f); GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, false, false); if (doNeeds) { CaravanNeedsTabUtility.GetNeedsToDisplay(pawn, CaravanNeedsTabUtility.tmpNeeds); float xMax = bgRect.xMax; for (int i = 0; i < CaravanNeedsTabUtility.tmpNeeds.Count; i++) { Need need = CaravanNeedsTabUtility.tmpNeeds[i]; int maxThresholdMarkers = 0; bool doTooltip = true; Rect rect4 = new Rect(xMax, 0f, 100f, 50f); Need_Mood mood = need as Need_Mood; if (mood != null) { maxThresholdMarkers = 1; doTooltip = false; TooltipHandler.TipRegion(rect4, new TipSignal(() => CaravanNeedsTabUtility.CustomMoodNeedTooltip(mood), rect4.GetHashCode())); } need.DrawOnGUI(rect4, maxThresholdMarkers, 10f, false, doTooltip); xMax = rect4.xMax; } } if (pawn.Downed) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width); GUI.color = Color.white; } GUI.EndGroup(); }
protected override void UpdateSize() { base.UpdateSize(); this.size = CaravanNeedsTabUtility.GetSize(base.SelCaravan.PawnsListForReading, this.PaneTopY, true); if (this.size.x + this.SpecificNeedsTabWidth > (float)UI.screenWidth) { this.doNeeds = false; this.size = CaravanNeedsTabUtility.GetSize(base.SelCaravan.PawnsListForReading, this.PaneTopY, false); } else { this.doNeeds = true; } this.size.y = Mathf.Max(this.size.y, NeedsCardUtility.FullSize.y); }
public static Vector2 GetSize(List <Pawn> pawns, float paneTopY, bool doNeeds = true) { float num = 100f; if (doNeeds) { num += (float)CaravanNeedsTabUtility.MaxNeedsCount(pawns) * 100f; } num += 24f; Vector2 result; result.x = 103f + num + 16f; result.y = Mathf.Min(550f, paneTopY - 30f); return(result); }
protected override void UpdateSize() { EnsureSpecificNeedsTabForPawnValid(); base.UpdateSize(); base.size = CaravanNeedsTabUtility.GetSize(base.SelCaravan.PawnsListForReading, PaneTopY); if (base.size.x + SpecificNeedsTabWidth > (float)UI.screenWidth) { doNeeds = false; base.size = CaravanNeedsTabUtility.GetSize(base.SelCaravan.PawnsListForReading, PaneTopY, doNeeds: false); } else { doNeeds = true; } ref Vector2 size = ref base.size;
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(); }
protected override void UpdateSize() { EnsureSpecificNeedsTabForPawnValid(); base.UpdateSize(); size = CaravanNeedsTabUtility.GetSize(base.SelCaravan.PawnsListForReading, PaneTopY); if (size.x + SpecificNeedsTabWidth > (float)UI.screenWidth) { doNeeds = false; size = CaravanNeedsTabUtility.GetSize(base.SelCaravan.PawnsListForReading, PaneTopY, doNeeds: false); } else { doNeeds = true; } size.y = Mathf.Max(size.y, NeedsCardUtility.FullSize.y); }
protected override void FillTab() { this.EnsureSpecificNeedsTabForPawnValid(); CaravanNeedsTabUtility.DoRows(this.size, base.SelCaravan.PawnsListForReading, base.SelCaravan, ref this.scrollPosition, ref this.scrollViewHeight, ref this.specificNeedsTabForPawn, this.doNeeds); }
internal string <> m__0() { return(CaravanNeedsTabUtility.CustomMoodNeedTooltip(this.mood)); }