Class ListViewController<TData, TItem, TIndex> | List View Framework | 1.1.7-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class ListViewController<TData, TItem, TIndex>

    Core class of the list view framework The list view controller and its variants provide a starting point for scrollable list views which update a set of visible items once per frame based on a list of data objects. Extensions of this class will determine behavior like whether to scroll vertically or horizontally, or whether to present list items in a grid.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    ListViewControllerBase
    ListViewController<TData, TItem, TIndex>
    NestedListViewController<TData, TItem, TIndex>
    Inherited Members
    ListViewControllerBase.m_ScrollOffset
    ListViewControllerBase.m_Padding
    ListViewControllerBase.m_SettleSpeed
    ListViewControllerBase.m_Templates
    ListViewControllerBase.m_EnableSettling
    ListViewControllerBase.m_Settling
    ListViewControllerBase.m_ItemSize
    ListViewControllerBase.m_StartPosition
    ListViewControllerBase.m_Scrolling
    ListViewControllerBase.m_ScrollReturn
    ListViewControllerBase.m_ScrollDelta
    ListViewControllerBase.m_Size
    ListViewControllerBase.m_Extents
    ListViewControllerBase.scrollOffset
    ListViewControllerBase.scrollSpeed
    ListViewControllerBase.itemSize
    ListViewControllerBase.size
    ListViewControllerBase.Update()
    ListViewControllerBase.UpdateView()
    ListViewControllerBase.ComputeConditions()
    ListViewControllerBase.ScrollNext()
    ListViewControllerBase.ScrollPrevious()
    ListViewControllerBase.ScrollTo(Int32)
    ListViewControllerBase.UpdateItemTransform(IListViewItem, Int32, Vector3, Quaternion, Boolean, Boolean)
    ListViewControllerBase.GetObjectSize(GameObject)
    ListViewControllerBase.OnScrollStarted()
    ListViewControllerBase.OnScrollEnded()
    ListViewControllerBase.OnScroll(PointerEventData)
    ListViewControllerBase.StartSettling(Action)
    ListViewControllerBase.EndSettling()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Unity.ListViewFramework
    Syntax
    public abstract class ListViewController<TData, TItem, TIndex> : ListViewControllerBase, IScrollHandler, IEventSystemHandler where TData : class, IListViewItemData<TIndex> where TItem : class, IListViewItem<TData, TIndex>
    Type Parameters
    Name Description
    TData

    The type of object in the list of data

    TItem

    The base type of all list items

    TIndex

    The type which is used as a unique index to map data to list items

    Fields

    m_Data

    The list of data

    Declaration
    protected List<TData> m_Data
    Field Value
    Type Description
    List<TData>

    m_GrabbedRows

    Items which are currently "grabbed" and temporarily removed from the list

    Declaration
    protected readonly Dictionary<TIndex, Transform> m_GrabbedRows
    Field Value
    Type Description
    Dictionary<TIndex, Transform>

    m_ListItems

    The currently-visible list items

    Declaration
    protected readonly Dictionary<TIndex, TItem> m_ListItems
    Field Value
    Type Description
    Dictionary<TIndex, TItem>

    m_TemplateDictionary

    A dictionary for providing constant-time access to ListViewItemTemplates based on the name of the template prefab

    Declaration
    protected readonly Dictionary<string, ListViewItemTemplate<TItem>> m_TemplateDictionary
    Field Value
    Type Description
    Dictionary<String, ListViewItemTemplate<TItem>>

    Properties

    data

    The list of data

    Declaration
    public virtual List<TData> data { get; set; }
    Property Value
    Type Description
    List<TData>

    listHeight

    The total height of all list rows, used to determine the maximum amount of scroll offset before snapping back

    Declaration
    protected override float listHeight { get; }
    Property Value
    Type Description
    Single
    Overrides
    ListViewControllerBase.listHeight

    multiSelectMode

    Converts the List View Item into a multiselect mode, for use with combined actions

    Declaration
    protected bool multiSelectMode { get; set; }
    Property Value
    Type Description
    Boolean

    Methods

    Awake()

    Called when the script instance is being loaded

    Declaration
    protected override void Awake()
    Overrides
    ListViewControllerBase.Awake()

    GetGrabbedRow(Transform)

    Get a list item grabbed by the given ray origin

    Declaration
    protected virtual TItem GetGrabbedRow(Transform rayOrigin)
    Parameters
    Type Name Description
    Transform rayOrigin

    The ray origin used to grab a list item

    Returns
    Type Description
    TItem

    The item which is grabbed

    GetListItem(TIndex)

    Get the list item for a given index

    Declaration
    protected TItem GetListItem(TIndex index)
    Parameters
    Type Name Description
    TIndex index

    The index of the list item

    Returns
    Type Description
    TItem

    The item, if one exists

    GetNewItem(TData, out TItem)

    Get a view item for a given datum, either from its template's pool, or by creating a new one

    Declaration
    protected virtual bool GetNewItem(TData datum, out TItem item)
    Parameters
    Type Name Description
    TData datum

    The datum for the desired view item

    TItem item

    The view item

    Returns
    Type Description
    Boolean

    True if a new item was instantiated, false if the view item came from the item pool

    HasData()

    Check whether the m_Data array is null

    Declaration
    protected override sealed bool HasData()
    Returns
    Type Description
    Boolean

    True if m_Data is not null

    Overrides
    ListViewControllerBase.HasData()

    InstantiateItem(TData)

    Instantiate the list item for a given datum

    Declaration
    protected virtual TItem InstantiateItem(TData datum)
    Parameters
    Type Name Description
    TData datum

    The datum for a list item

    Returns
    Type Description
    TItem

    The instantiated list item

    Recycle(TIndex)

    Recycle a list item by index

    Declaration
    protected virtual void Recycle(TIndex index)
    Parameters
    Type Name Description
    TIndex index

    The index of the list item to be recycled

    RecycleItem(String, TItem)

    Recycle a list item into its template's pool

    Declaration
    protected virtual void RecycleItem(string template, TItem item)
    Parameters
    Type Name Description
    String template

    The template of this list item

    TItem item

    The list item

    SetMultiSelectMode(Boolean)

    Override and call base function to add custom behaviour when entering or exiting multiselect mode.

    Declaration
    protected virtual void SetMultiSelectMode(bool mode)
    Parameters
    Type Name Description
    Boolean mode

    If true, multi-select is enabling, false otherwise.

    SetRowGrabbed(TIndex, Transform, Boolean)

    Set the grabbed state of the list item at a given index

    Declaration
    protected virtual void SetRowGrabbed(TIndex index, Transform rayOrigin, bool grabbed)
    Parameters
    Type Name Description
    TIndex index

    The index of the list item/data

    Transform rayOrigin

    The ray origin used to grab this list item

    Boolean grabbed

    Whether the item is grabbed or not

    Start()

    Called on the frame when a script is enabled just before any of the Update methods are called the first time

    Declaration
    protected virtual void Start()

    UpdateItem(IListViewItem, Int32, Single, Boolean, ref Boolean)

    Update a single item

    Declaration
    protected override 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

    Overrides
    ListViewControllerBase.UpdateItem(IListViewItem, Int32, Single, Boolean, ref Boolean)

    UpdateItems()

    Called by UpdateView to update the list items

    Declaration
    protected override void UpdateItems()
    Overrides
    ListViewControllerBase.UpdateItems()

    UpdateVisibleItem(TData, Int32, Single, ref Boolean)

    Update a visible list item

    Declaration
    protected virtual TItem UpdateVisibleItem(TData datum, int order, float offset, ref bool doneSettling)
    Parameters
    Type Name Description
    TData datum

    The datum representing this list item

    Int32 order

    The order of this item, among the other visible items

    Single offset

    The offset at which to position this item

    Boolean doneSettling

    Whether all items are done settling

    Returns
    Type Description
    TItem

    The item associated with this datum

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023