C# Class UIScrollList, urban-survivors

Inheritance: MonoBehaviour, IUIObject
Mostrar archivo Open project: exdev/urban-survivors Class Usage Examples

Public Properties

Property Type Description
activateWhenAdding bool
alignment ALIGNMENT
clipContents bool
clipWhenMoving bool
direction DIRECTION
dragThreshold float
itemSpacing float
manager SpriteManager,
methodToInvokeOnSelect string
orientation ORIENTATION
prefabItems PrefabListItem[],
sceneItems GameObject[]
scriptWithMethodToInvoke MonoBehaviour
slider UISlider,
spacingAtEnds bool
touchScroll bool
viewableArea Vector2

Protected Properties

Property Type Description
cachedPos Vector3
cachedRot Quaternion
cachedScale Vector3
changeDelegate EZValueChangedDelegate
clientClippingRect Rect3D
container IUIContainer
contentExtents float
inputDelegate EZInputDelegate
isScrolling bool
items List
m_controlIsEnabled bool
m_started bool
mover GameObject
noTouch bool
scrollMax float
scrollPos float
selectedItem IUIListObject
tempVisItems List
visibleItems List

Public Methods

Method Description
AddInputDelegate ( EZInputDelegate del ) : void
AddItem ( GameObject itemGO ) : void

Adds an item to the end of the list. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

AddItem ( IUIListObject item ) : void

Adds an item to the end of the list. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

AddItem ( IUIListObject item, string text ) : void

Adds an item to the end of the list. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

AddValueChangedDelegate ( EZValueChangedDelegate del ) : void
Awake ( ) : void
ClearList ( bool destroy ) : void

Empties the contents of the list entirely. Destroys the items if instructed, otherwise it just deactivates them.

Create ( string name, Vector3 pos ) : UIScrollList,

Creates a GameObject and attaches this component type to it.

Create ( string name, Vector3 pos, Quaternion rotation ) : UIScrollList,

Creates a GameObject and attaches this component type to it.

CreateItem ( GameObject prefab ) : IUIListObject

Instantiates a new list item based on the prefab to clone, adds it to the end of the list and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

CreateItem ( GameObject prefab, int position ) : IUIListObject

Instantiates a new list item based on the prefab to clone, adds it to the list at the position specified by "position" and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

CreateItem ( GameObject prefab, int position, string text ) : IUIListObject

Instantiates a new list item based on the prefab to clone, adds it to the list at the position specified by "position" and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

CreateItem ( GameObject prefab, string text ) : IUIListObject

Instantiates a new list item based on the prefab to clone, adds it to the end of the list and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.

DidClick ( IUIListObject item ) : void
DidSelect ( IUIListObject item ) : void
GetItem ( int index ) : IUIListObject

Returns a reference to the specified list item.

GotFocus ( ) : bool
InsertItem ( IUIListObject item, int position ) : void

Inserts a list item at the specified position in the list.

InsertItem ( IUIListObject item, int position, string text ) : void

Inserts a list item at the specified position in the list.

ListDragged ( POINTER_INFO, ptr ) : void
OnDrawGizmosSelected ( ) : void
OnEnable ( ) : void
OnInput ( POINTER_INFO, ptr ) : void
PointerReleased ( ) : void
PositionItems ( ) : void

Positions list items according to the current scroll position.

RemoveInputDelegate ( EZInputDelegate del ) : void
RemoveItem ( IUIListObject item, bool destroy ) : void

Removes the specified item. Remaining items are repositioned to fill the gap. The removed item is destroyed if 'destroy' is true. Otherwise, it is deactivated.

RemoveItem ( int index, bool destroy ) : void

Removes the item at the specified index. Remaining items are repositioned to fill the gap. The removed item is destroyed if 'destroy' is true. Otherwise, it is deactivated.

RemoveValueChangedDelegate ( EZValueChangedDelegate del ) : void
RepositionItems ( ) : void

Repositions list items according to the current scroll position, and adjusts for any change in the items' extents.

RequestContainership ( IUIContainer cont ) : bool
ScrollListTo ( float pos ) : void

Scrolls the list directly to the position indicated (0-1).

SetInputDelegate ( EZInputDelegate del ) : void
SetSelectedItem ( int index ) : void

Sets the item at the specified index as the currently selected item.

SetValueChangedDelegate ( EZValueChangedDelegate del ) : void
SliderMoved ( IUIObject slider ) : void
Start ( ) : void
Update ( ) : void

Protected Methods

Method Description
AddItemsToContainer ( ) : void
CalcClippingRect ( ) : void
ClipItems ( ) : void
PositionHorizontally ( bool updateExtents ) : void
PositionVertically ( bool updateExtents ) : void
RemoveItemsFromContainer ( ) : void
ScrollListTo_Internal ( float pos ) : void
UpdateContentExtents ( float change ) : void

Method Details

AddInputDelegate() public method

public AddInputDelegate ( EZInputDelegate del ) : void
del EZInputDelegate
return void

AddItem() public method

Adds an item to the end of the list. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public AddItem ( GameObject itemGO ) : void
itemGO GameObject
return void

AddItem() public method

Adds an item to the end of the list. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public AddItem ( IUIListObject item ) : void
item IUIListObject Reference to the list item to be added.
return void

AddItem() public method

Adds an item to the end of the list. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public AddItem ( IUIListObject item, string text ) : void
item IUIListObject Reference to the list item to be added.
text string Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).
return void

AddItemsToContainer() protected method

protected AddItemsToContainer ( ) : void
return void

AddValueChangedDelegate() public method

public AddValueChangedDelegate ( EZValueChangedDelegate del ) : void
del EZValueChangedDelegate
return void

Awake() public method

public Awake ( ) : void
return void

CalcClippingRect() protected method

protected CalcClippingRect ( ) : void
return void

ClearList() public method

Empties the contents of the list entirely. Destroys the items if instructed, otherwise it just deactivates them.
public ClearList ( bool destroy ) : void
destroy bool When true, the list items are actually destroyed. Otherwise, they are deactivated.
return void

ClipItems() protected method

protected ClipItems ( ) : void
return void

Create() static public method

Creates a GameObject and attaches this component type to it.
static public Create ( string name, Vector3 pos ) : UIScrollList,
name string Name to give to the new GameObject.
pos Vector3 Position, in world space, where the new object should be created.
return UIScrollList,

Create() static public method

Creates a GameObject and attaches this component type to it.
static public Create ( string name, Vector3 pos, Quaternion rotation ) : UIScrollList,
name string Name to give to the new GameObject.
pos Vector3 Position, in world space, where the new object should be created.
rotation Quaternion Rotation of the object.
return UIScrollList,

CreateItem() public method

Instantiates a new list item based on the prefab to clone, adds it to the end of the list and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public CreateItem ( GameObject prefab ) : IUIListObject
prefab GameObject GameObject/Prefab which is to be instantiated and added to the end of the list.
return IUIListObject

CreateItem() public method

Instantiates a new list item based on the prefab to clone, adds it to the list at the position specified by "position" and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public CreateItem ( GameObject prefab, int position ) : IUIListObject
prefab GameObject GameObject/Prefab which is to be instantiated and added to the end of the list.
position int 0-based index where the new item will be placed in the list.
return IUIListObject

CreateItem() public method

Instantiates a new list item based on the prefab to clone, adds it to the list at the position specified by "position" and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public CreateItem ( GameObject prefab, int position, string text ) : IUIListObject
prefab GameObject GameObject/Prefab which is to be instantiated and added to the end of the list.
position int 0-based index where the new item will be placed in the list.
text string Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).
return IUIListObject

CreateItem() public method

Instantiates a new list item based on the prefab to clone, adds it to the end of the list and returns a reference to it. NOTE: The prefab/GameObject is required to have a component that implements IUIListObject. NOTE: For proper appearance, list items should each be of uniform width when the list is vertical, and of uniform height when the list is horizontal. Besides that, list items can vary in size.
public CreateItem ( GameObject prefab, string text ) : IUIListObject
prefab GameObject GameObject/Prefab which is to be instantiated and added to the end of the list.
text string Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).
return IUIListObject

DidClick() public method

public DidClick ( IUIListObject item ) : void
item IUIListObject
return void

DidSelect() public method

public DidSelect ( IUIListObject item ) : void
item IUIListObject
return void

GetItem() public method

Returns a reference to the specified list item.
public GetItem ( int index ) : IUIListObject
index int Index of the item to retrieve.
return IUIListObject

GotFocus() public method

public GotFocus ( ) : bool
return bool

InsertItem() public method

Inserts a list item at the specified position in the list.
public InsertItem ( IUIListObject item, int position ) : void
item IUIListObject Reference to the item to be inserted into the list.
position int 0-based index of the position in the list where the item will be placed.
return void

InsertItem() public method

Inserts a list item at the specified position in the list.
public InsertItem ( IUIListObject item, int position, string text ) : void
item IUIListObject Reference to the item to be inserted into the list.
position int 0-based index of the position in the list where the item will be placed.
text string Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).
return void

ListDragged() public method

public ListDragged ( POINTER_INFO, ptr ) : void
ptr POINTER_INFO,
return void

OnDrawGizmosSelected() public method

public OnDrawGizmosSelected ( ) : void
return void

OnEnable() public method

public OnEnable ( ) : void
return void

OnInput() public method

public OnInput ( POINTER_INFO, ptr ) : void
ptr POINTER_INFO,
return void

PointerReleased() public method

public PointerReleased ( ) : void
return void

PositionHorizontally() protected method

protected PositionHorizontally ( bool updateExtents ) : void
updateExtents bool
return void

PositionItems() public method

Positions list items according to the current scroll position.
public PositionItems ( ) : void
return void

PositionVertically() protected method

protected PositionVertically ( bool updateExtents ) : void
updateExtents bool
return void

RemoveInputDelegate() public method

public RemoveInputDelegate ( EZInputDelegate del ) : void
del EZInputDelegate
return void

RemoveItem() public method

Removes the specified item. Remaining items are repositioned to fill the gap. The removed item is destroyed if 'destroy' is true. Otherwise, it is deactivated.
public RemoveItem ( IUIListObject item, bool destroy ) : void
item IUIListObject
destroy bool
return void

RemoveItem() public method

Removes the item at the specified index. Remaining items are repositioned to fill the gap. The removed item is destroyed if 'destroy' is true. Otherwise, it is deactivated.
public RemoveItem ( int index, bool destroy ) : void
index int Index of the item to remove.
destroy bool
return void

RemoveItemsFromContainer() protected method

protected RemoveItemsFromContainer ( ) : void
return void

RemoveValueChangedDelegate() public method

public RemoveValueChangedDelegate ( EZValueChangedDelegate del ) : void
del EZValueChangedDelegate
return void

RepositionItems() public method

Repositions list items according to the current scroll position, and adjusts for any change in the items' extents.
public RepositionItems ( ) : void
return void

RequestContainership() public method

public RequestContainership ( IUIContainer cont ) : bool
cont IUIContainer
return bool

ScrollListTo() public method

Scrolls the list directly to the position indicated (0-1).
public ScrollListTo ( float pos ) : void
pos float Position of the list - 0-1 (0 == beginning, 1 == end)
return void

ScrollListTo_Internal() protected method

protected ScrollListTo_Internal ( float pos ) : void
pos float
return void

SetInputDelegate() public method

public SetInputDelegate ( EZInputDelegate del ) : void
del EZInputDelegate
return void

SetSelectedItem() public method

Sets the item at the specified index as the currently selected item.
public SetSelectedItem ( int index ) : void
index int The zero-based index of the item.
return void

SetValueChangedDelegate() public method

public SetValueChangedDelegate ( EZValueChangedDelegate del ) : void
del EZValueChangedDelegate
return void

SliderMoved() public method

public SliderMoved ( IUIObject slider ) : void
slider IUIObject
return void

Start() public method

public Start ( ) : void
return void

Update() public method

public Update ( ) : void
return void

UpdateContentExtents() protected method

protected UpdateContentExtents ( float change ) : void
change float
return void

Property Details

activateWhenAdding public_oe property

When true, items added or inserted to this list will be activated recursively. This is STRONGLY recommended when using managed sprites/controls.
public bool activateWhenAdding
return bool

alignment public_oe property

Determines how the items will be aligned in the list when added. See UIScrollList.ALIGNMENT [ALIGNMENT]
public ALIGNMENT alignment
return ALIGNMENT

cachedPos protected_oe property

protected Vector3 cachedPos
return Vector3

cachedRot protected_oe property

protected Quaternion cachedRot
return Quaternion

cachedScale protected_oe property

protected Vector3 cachedScale
return Vector3

changeDelegate protected_oe property

protected EZValueChangedDelegate changeDelegate
return EZValueChangedDelegate

clientClippingRect protected_oe property

protected Rect3D clientClippingRect
return Rect3D

clipContents public_oe property

When true, the contents of the list will be clipped to the viewable area. Otherwise, the content will extend beyond the specified viewable area.
public bool clipContents
return bool

clipWhenMoving public_oe property

When true, items will be clipped each frame in which it is detected that the list has moved, rotated, or scaled. Use this if you are having clipping errors after scaling, rotating, etc, a list as part of a panel transition, etc. Leave set to false otherwise to improve performance.
public bool clipWhenMoving
return bool

container protected_oe property

protected IUIContainer container
return IUIContainer

contentExtents protected_oe property

protected float contentExtents
return float

direction public_oe property

Determines whether items will be added to the list from top-to-bottom and left-to-right, or from bottom-to-top and right-to-left. See UIScrollList.DIRECTION [DIRECTION]
public DIRECTION direction
return DIRECTION

dragThreshold public_oe property

Distance the pointer must travel beyond which when it is released, the item under the pointer will not be considered to have been selected. This allows touch scrolling without inadvertently selecting the item under the pointer.
public float dragThreshold
return float

inputDelegate protected_oe property

protected EZInputDelegate inputDelegate
return EZInputDelegate

isScrolling protected_oe property

protected bool isScrolling
return bool

itemSpacing public_oe property

Empty space to put between each list item.
public float itemSpacing
return float

items protected_oe property

protected List items
return List

m_controlIsEnabled protected_oe property

protected bool m_controlIsEnabled
return bool

m_started protected_oe property

protected bool m_started
return bool

manager public_oe property

(Optional) Manager to which instantiated list items should be added once created. If none is set, sprites must either be unmanaged, or must already have been added to a manager.
public SpriteManager, manager
return SpriteManager,

methodToInvokeOnSelect public_oe property

A string containing the name of the method to be invoked when an item is selected.
public string methodToInvokeOnSelect
return string

mover protected_oe property

protected GameObject mover
return GameObject

noTouch protected_oe property

protected bool noTouch
return bool

orientation public_oe property

The orientation of the list - horizontal or vertical.
public ORIENTATION orientation
return ORIENTATION

prefabItems public_oe property

Optional array of item prefabs that are to be added to the list on startup. These will be added after the items in the sceneItems array.
public PrefabListItem[], prefabItems
return PrefabListItem[],

sceneItems public_oe property

Optional array of items in the scene that are to be added to the list on startup. These will be added before the items in the prefabItems array.
public GameObject[] sceneItems
return GameObject[]

scriptWithMethodToInvoke public_oe property

Reference to the script component with the method you wish to invoke when an item is selected.
public MonoBehaviour scriptWithMethodToInvoke
return MonoBehaviour

scrollMax protected_oe property

protected float scrollMax
return float

scrollPos protected_oe property

protected float scrollPos
return float

selectedItem protected_oe property

protected IUIListObject selectedItem
return IUIListObject

slider public_oe property

An optional slider control that will control the scroll position of the list.
public UISlider, slider
return UISlider,

spacingAtEnds public_oe property

When set to true, the itemSpacing value will be applied before the first item, and after the last so as to "pad" the first and last items a bit from the edge. If false, the first and last items will be flush with the edges of the viewable area.
public bool spacingAtEnds
return bool

tempVisItems protected_oe property

protected List tempVisItems
return List

touchScroll public_oe property

When true, scrolling will operate like a scrollable list on an iPhone - when a pointing device (normally a finger) is dragged across it, it scrolls and coasts to an eventual stop if not stopped manually.
public bool touchScroll
return bool

viewableArea public_oe property

The extents of the viewable area, in local space units. The contents of the list will be clipped to this area. Ex: If an area of 10x10 is specified, the list contents will be clipped 5 units above the center of the scroll list's GameObject, 5 units below, and 5 units on either side.
public Vector2 viewableArea
return Vector2

visibleItems protected_oe property

protected List visibleItems
return List