NGUI: Next-Gen UI kit  3.7.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
UIWrapContent Class Reference

This script makes it possible for a scroll view to wrap its content, creating endless scroll views. Usage: simply attach this script underneath your scroll view where you would normally place a UIGrid: More...

Inheritance diagram for UIWrapContent:

Public Member Functions

delegate void OnInitializeItem (GameObject go, int wrapIndex, int realIndex)
 
void SortBasedOnScrollMovement ()
 Immediately reposition all children. More...
 
void SortAlphabetically ()
 Immediately reposition all children, sorting them alphabetically. More...
 
void WrapContent ()
 Wrap all content, repositioning all children as needed. More...
 

Public Attributes

int itemSize = 100
 Width or height of the child items for positioning purposes. More...
 
bool cullContent = true
 Whether the content will be automatically culled. Enabling this will improve performance in scroll views that contain a lot of items. More...
 
int minIndex = 0
 Minimum allowed index for items. If "min" is equal to "max" then there is no limit. For vertical scroll views indices increment with the Y position (towards top of the screen). More...
 
int maxIndex = 0
 Maximum allowed index for items. If "min" is equal to "max" then there is no limit. For vertical scroll views indices increment with the Y position (towards top of the screen). More...
 
OnInitializeItem onInitializeItem
 Callback that will be called every time an item needs to have its content updated. The 'wrapIndex' is the index within the child list, and 'realIndex' is the index using position logic. More...
 

Protected Member Functions

virtual void Start ()
 Initialize everything and register a callback with the UIPanel to be notified when the clipping region moves. More...
 
virtual void OnMove (UIPanel panel)
 Callback triggered by the UIPanel when its clipping region moves (for example when it's being scrolled). More...
 
bool CacheScrollView ()
 Cache the scroll view and return 'false' if the scroll view is not found. More...
 
virtual void UpdateItem (Transform item, int index)
 Want to update the content of items as they are scrolled? Override this function. More...
 

Detailed Description

This script makes it possible for a scroll view to wrap its content, creating endless scroll views. Usage: simply attach this script underneath your scroll view where you would normally place a UIGrid:

  • Scroll View |- UIWrappedContent |– Item 1 |– Item 2 |– Item 3

Member Function Documentation

bool UIWrapContent.CacheScrollView ( )
protected

Cache the scroll view and return 'false' if the scroll view is not found.

delegate void UIWrapContent.OnInitializeItem ( GameObject  go,
int  wrapIndex,
int  realIndex 
)
virtual void UIWrapContent.OnMove ( UIPanel  panel)
protectedvirtual

Callback triggered by the UIPanel when its clipping region moves (for example when it's being scrolled).

void UIWrapContent.SortAlphabetically ( )

Immediately reposition all children, sorting them alphabetically.

void UIWrapContent.SortBasedOnScrollMovement ( )

Immediately reposition all children.

virtual void UIWrapContent.Start ( )
protectedvirtual

Initialize everything and register a callback with the UIPanel to be notified when the clipping region moves.

virtual void UIWrapContent.UpdateItem ( Transform  item,
int  index 
)
protectedvirtual

Want to update the content of items as they are scrolled? Override this function.

void UIWrapContent.WrapContent ( )

Wrap all content, repositioning all children as needed.

Member Data Documentation

bool UIWrapContent.cullContent = true

Whether the content will be automatically culled. Enabling this will improve performance in scroll views that contain a lot of items.

int UIWrapContent.itemSize = 100

Width or height of the child items for positioning purposes.

int UIWrapContent.maxIndex = 0

Maximum allowed index for items. If "min" is equal to "max" then there is no limit. For vertical scroll views indices increment with the Y position (towards top of the screen).

int UIWrapContent.minIndex = 0

Minimum allowed index for items. If "min" is equal to "max" then there is no limit. For vertical scroll views indices increment with the Y position (towards top of the screen).

OnInitializeItem UIWrapContent.onInitializeItem

Callback that will be called every time an item needs to have its content updated. The 'wrapIndex' is the index within the child list, and 'realIndex' is the index using position logic.


The documentation for this class was generated from the following file: