ItemScroller
A class in Root.Township, the global namespace.
Client UI: a row of ScrollElements that slides along to show a window of a longer list, reusing a few element copies. Scrolling left moves to higher indices.
- Listed in Global namespace: I to L
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
ItemScroller() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
20 private and internal fields
| Member | What it is |
|---|---|
private BoolEvent canScrollLeftChanged | Event raised with CanScrollLeft whenever it may have changed. |
private BoolEvent canScrollRightChanged | Event raised with CanScrollRight whenever it may have changed. |
private int count | How many elements are visible at once. |
private int finalTargetIndex | The index the scroller is heading to, possibly several steps away. |
private int index | First visible index at the start of the current step. |
private List<ScrollElement> instances | The element instances, reused as a ring. |
private float interval | Spacing between elements along the row. |
private bool isScrollingLeft | Backing field for IsScrollingLeft (scroll held down). |
private bool isScrollingRight | Backing field for IsScrollingRight (scroll held down). |
private bool isShowingByDefault | Whether the elements show on Awake without waiting for ResetAndRefresh. |
private int maxIndex | Number of items, or -1 for no limit. |
private ScrollElement prefab | The ScrollElement prefab instantiated for each slot. |
private Timeline.IEntry reshow | Timer that shows the elements again 0.1 seconds after ResetAndRefresh. |
private float rotationInterval | Angle in degrees between neighbouring elements, around the up axis. |
private float rotationOffset | Forward offset applied after the rotation, so elements can sit on an arc. |
private AltaEvent scrollExecuted | Event raised when ScrollDirection accepts a step. |
private float scrollProgress | Progress through the current step, 0 to 1. |
private float stepInterval | Seconds per scroll step. |
private int stepSize | How many items one ScrollDirection call moves. |
private int targetIndex | First visible index at the end of the current step. |
Properties
Methods
8 private and internal methods
Used in
Members of other types that take, return or hold a ItemScroller: