Class ListViewControllerBase
Provides base List View Controller functionality which does not require generic arguments Allows reference to any ListViewController type without specifying generic arguments
Inherited Members
Namespace: Unity.ListViewFramework
Syntax
public abstract class ListViewControllerBase : MonoBehaviour, IScrollHandler, IEventSystemHandler
Fields
m_EnableSettling
Whether to interpolate item positions
Declaration
[Tooltip("Whether to interpolate item positions")]
[SerializeField]
protected bool m_EnableSettling
Field Value
Type | Description |
---|---|
Boolean |
m_Extents
The extents (half the size) of the list area
Declaration
protected Vector3 m_Extents
Field Value
Type | Description |
---|---|
Vector3 |
m_ItemSize
The size of each item
Declaration
protected Vector3 m_ItemSize
Field Value
Type | Description |
---|---|
Vector3 |
m_Padding
Padding between items
Declaration
[Tooltip("Padding between items")]
[SerializeField]
protected float m_Padding
Field Value
Type | Description |
---|---|
Single |
m_ScrollDelta
The current amount of scroll momentum
Declaration
protected float m_ScrollDelta
Field Value
Type | Description |
---|---|
Single |
m_Scrolling
Whether this list is currently scrolling
Declaration
protected bool m_Scrolling
Field Value
Type | Description |
---|---|
Boolean |
m_ScrollOffset
Distance we have scrolled from initial position
Declaration
[Tooltip("Distance we have scrolled from initial position")]
[SerializeField]
protected float m_ScrollOffset
Field Value
Type | Description |
---|---|
Single |
m_ScrollReturn
The offset to which this list will return when it stops scrolling Set to float.MaxValue if the list should stay where it is
Declaration
protected float m_ScrollReturn
Field Value
Type | Description |
---|---|
Single |
m_SettleSpeed
Speed at which items settle
Declaration
[Tooltip("Speed at which items settle")]
[SerializeField]
protected float m_SettleSpeed
Field Value
Type | Description |
---|---|
Single |
m_Settling
Whether the items in this list are currently settling
Declaration
protected bool m_Settling
Field Value
Type | Description |
---|---|
Boolean |
m_Size
The size of the list area
Declaration
protected Vector3 m_Size
Field Value
Type | Description |
---|---|
Vector3 |
m_StartPosition
The starting position from which to offset items
Declaration
protected Vector3 m_StartPosition
Field Value
Type | Description |
---|---|
Vector3 |
m_Templates
Item template prefabs (at least one is required)
Declaration
[Tooltip("Item template prefabs (at least one is required)")]
[SerializeField]
protected GameObject[] m_Templates
Field Value
Type | Description |
---|---|
GameObject[] |
Properties
itemSize
The size of each item
Declaration
public Vector3 itemSize { get; }
Property Value
Type | Description |
---|---|
Vector3 |
listHeight
The total height of all list rows, used to determine the maximum amount of scroll offset before snapping back
Declaration
protected abstract float listHeight { get; }
Property Value
Type | Description |
---|---|
Single |
scrollOffset
The distance we have scrolled from initial position
Declaration
public float scrollOffset { get; set; }
Property Value
Type | Description |
---|---|
Single |
scrollSpeed
The speed of fixed-speed scrolling
Declaration
public float scrollSpeed { get; set; }
Property Value
Type | Description |
---|---|
Single |
size
The size of the list area
Declaration
public virtual Vector3 size { set; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
Awake()
Called when the script instance is being loaded
Declaration
protected virtual void Awake()
ComputeConditions()
Called by UpdateView to update fields which control the state of the entire list
Declaration
protected virtual void ComputeConditions()
EndSettling()
Called when items are done settling
Declaration
protected virtual void EndSettling()
GetObjectSize(GameObject)
Get the size of a given GameObject
Declaration
protected virtual Vector3 GetObjectSize(GameObject g)
Parameters
Type | Name | Description |
---|---|---|
GameObject | g | The GameObject |
Returns
Type | Description |
---|---|
Vector3 | The size of the GameObject, which by default is the size of the renderer returned by GetComponentInChildren, if any exists |
HasData()
Check whether the m_Data array is null
Declaration
protected abstract bool HasData()
Returns
Type | Description |
---|---|
Boolean | True if m_Data is not null |
OnScroll(PointerEventData)
Called every frame while scrolling this list
Declaration
public virtual void OnScroll(PointerEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.EventSystems.PointerEventData | eventData | The input event data |
Implements
OnScrollEnded()
Called when scrolling ends
Declaration
public virtual void OnScrollEnded()
OnScrollStarted()
Called when scrolling is started
Declaration
public virtual void OnScrollStarted()
ScrollNext()
Scroll the next item
Declaration
public virtual void ScrollNext()
ScrollPrevious()
Scroll to the previous item
Declaration
public virtual void ScrollPrevious()
ScrollTo(Int32)
Scroll to an item based on its index in the list order (not its data index)
Declaration
public virtual void ScrollTo(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
StartSettling(Action)
Start the process of letting the list items settle into place
Declaration
protected virtual void StartSettling(Action onComplete = null)
Parameters
Type | Name | Description |
---|---|---|
Action | onComplete | Called when all items are done settling |
Update()
Called every frame, if the MonoBehaviour is enabled
Declaration
protected virtual void Update()
UpdateItem(IListViewItem, Int32, Single, Boolean, ref Boolean)
Update a single item
Declaration
protected virtual void UpdateItem(IListViewItem item, int order, float offset, bool dontSettle, ref bool doneSettling)
Parameters
Type | Name | Description |
---|---|---|
IListViewItem | item | The item to update |
Int32 | order | The order of this item, among the other visible items |
Single | offset | The offset at which to position this item |
Boolean | dontSettle | Whether to bypass settling behavior |
Boolean | doneSettling | Whether all items are done settling |
UpdateItems()
Called by UpdateView to update the list items
Declaration
protected abstract void UpdateItems()
UpdateItemTransform(IListViewItem, Int32, Vector3, Quaternion, Boolean, ref Boolean)
Update the transform of a single item
Declaration
protected virtual void UpdateItemTransform(IListViewItem item, int order, Vector3 targetPosition, Quaternion targetRotation, bool dontSettle, ref bool doneSettling)
Parameters
Type | Name | Description |
---|---|---|
IListViewItem | item | The item to update |
Int32 | order | The order of this item, among the other visible items |
Vector3 | targetPosition | The target position |
Quaternion | targetRotation | The target rotation |
Boolean | dontSettle | Whether to bypass settling behavior |
Boolean | doneSettling | Whether all items are done settling |
UpdateView()
Update the list view, called once per frame
Declaration
protected virtual void UpdateView()