public TopToBottom(ScrollRect scrollRect, ISpacer spacer) { ScrollRect = scrollRect; Spacer = spacer; RectTransform rt = scrollRect.transform as RectTransform; ViewHeight = Mathf.CeilToInt(rt.sizeDelta.y); }
public LeftToRight(ScrollRect scrollRect, ISpacer spacer) { ScrollRect = scrollRect; Spacer = spacer; RectTransform rt = scrollRect.transform as RectTransform; ViewWidth = Mathf.CeilToInt(rt.sizeDelta.x); }
public HorizontalContainer(ScrollRect scrollRect, ISpacer spacer) { ScrollRect = scrollRect; Spacer = spacer; if (ScrollRect.content.anchorMax.x < 0.5f) { Flow = new LeftToRight(scrollRect, spacer); } else { Flow = new RightToLeft(scrollRect, spacer); } }
public VerticalContainer(ScrollRect scrollRect, ISpacer spacer) { ScrollRect = scrollRect; Spacer = spacer; if (ScrollRect.content.anchorMax.y > 0.5f) { Flow = new TopToBottom(scrollRect, spacer); } else { Flow = new BottomToTop(scrollRect, spacer); } }
public void Reload() { Setup(); cellPooler.EnqueueAll(); visibleRange = new Point(int.MaxValue, int.MinValue); if (cellCountForTableView == null) { return; } int rowCount = cellCountForTableView(this); if (sizeForCellInTableView != null) { spacer = new NonUniformSpacer((int index) => { return(sizeForCellInTableView(this, index)); }, rowCount); } else { spacer = new UniformSpacer(cellSize, rowCount); } if (scrollRect.horizontal) { container = new HorizontalContainer(scrollRect, spacer); } else { container = new VerticalContainer(scrollRect, spacer); } container.AutoSize(); scrollRect.content.anchoredPosition = Vector2.zero; Refresh(); }