public static void DoRows(Vector2 size, List <TransferableImmutable> things, Caravan caravan, ref Vector2 scrollPosition, ref float scrollViewHeight) { 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; Widgets.ListSeparator(ref num, viewRect.width, "CaravanItems".Translate()); if (things.Any <TransferableImmutable>()) { for (int i = 0; i < things.Count; i++) { CaravanItemsTabUtility.DoRow(ref num, viewRect, rect, scrollPosition, things[i], caravan); } } else { Widgets.NoneLabel(ref num, viewRect.width, null); } if (Event.current.type == EventType.Layout) { scrollViewHeight = num + 30f; } Widgets.EndScrollView(); }
protected override void FillTab() { CheckCreateSorters(); Rect rect = new Rect(0f, 0f, size.x, size.y); if (Widgets.ButtonText(new Rect(rect.x + 10f, rect.y + 10f, 200f, 27f), "AssignDrugPolicies".Translate())) { Find.WindowStack.Add(new Dialog_AssignCaravanDrugPolicies(base.SelCaravan)); } rect.yMin += 37f; GUI.BeginGroup(rect.ContractedBy(10f)); TransferableUIUtility.DoTransferableSorters(sorter1, sorter2, delegate(TransferableSorterDef x) { sorter1 = x; CacheItems(); }, delegate(TransferableSorterDef x) { sorter2 = x; CacheItems(); }); GUI.EndGroup(); rect.yMin += 25f; GUI.BeginGroup(rect); CheckCacheItems(); CaravanItemsTabUtility.DoRows(rect.size, cachedItems, base.SelCaravan, ref scrollPosition, ref scrollViewHeight); GUI.EndGroup(); }
private static void DoRow(ref float curY, Rect viewRect, Rect scrollOutRect, Vector2 scrollPosition, TransferableImmutable thing, Caravan caravan) { float num = scrollPosition.y - 30f; float num2 = scrollPosition.y + scrollOutRect.height; if (curY > num && curY < num2) { CaravanItemsTabUtility.DoRow(new Rect(0f, curY, viewRect.width, 30f), thing, caravan); } curY += 30f; }
protected override void UpdateSize() { base.UpdateSize(); CheckCacheItems(); size = CaravanItemsTabUtility.GetSize(cachedItems, PaneTopY); }
protected override void UpdateSize() { base.UpdateSize(); this.CheckCacheItems(); this.size = CaravanItemsTabUtility.GetSize(this.cachedItems, this.PaneTopY, true); }