PagedRect  1.26
UI.Pagination.PagedRect Class Reference
Inheritance diagram for UI.Pagination.PagedRect:

Classes

class  PageChangedEventType
 

Public Types

enum  eAnimationType { eAnimationType.None, eAnimationType.SlideHorizontal, eAnimationType.SlideVertical, eAnimationType.Fade }
 
enum  eDirection { eDirection.Left, eDirection.Right }
 
enum  DeltaDirection { DeltaDirection.None, DeltaDirection.Next, DeltaDirection.Previous }
 

Public Member Functions

void OnEndDrag (PointerEventData data)
 Called whenever the user stops dragging More...
 
void UpgradeLayoutGroupIfNecessary ()
 
void AddPage (Page page)
 Add a new page to this PagedRect - this Page should already have been instantiated. More...
 
Page AddPageUsingTemplate ()
 Add a new page to this PagedRect - this Page will be instantiated and returned by this function. You can then customize it as required. More...
 
void RemovePage (Page page, bool destroyPageObject=false)
 Remove a Page from this PagedRect, and optionally destroy it More...
 
void RemovePage (int pageNumber, bool destroyPageObject=false)
 
void RemoveAllPages (bool destroyPageObjects=false)
 
void SetEditorSelectedPage (int page)
 Used by the Editor to keep track of the selected page in edit mode More...
 
Page GetPageByNumber (int pageNumber, bool secondAttempt=false, bool allowNulls=false)
 
Page GetCurrentPage ()
 
int GetPageNumber (Page page)
 
void UpdatePagination ()
 Updates the page buttons More...
 
void ScrollBarValueChanged ()
 
void CenterScrollRectOnCurrentPage (bool initial=false)
 
float GetPageOffset (Page page)
 
float GetPageOffset_PagePreviews (Page page)
 
void SetShowFirstAndLastButtons (bool show)
 Show or hide the First and Last Buttons More...
 
void SetShowPreviousAndNextButtons (bool show)
 Show or Hide the Previous and Next Buttons More...
 
void SetAnimationSpeed (float animationSpeed)
 Set the animation speed for this PagedRect More...
 
void SetAnimationType (string animationType)
 Set the Animation type of this PagedRect More...
 
void SetDelayBetweenPages (float delay)
 Set the delay between pages (when automatically scrolling through pages) More...
 
void SetLoopEndlessly (bool loop)
 Enable or Disable Endless Looping More...
 
void SetAutomaticallyMoveToNextPage (bool move)
 Enable or Disable automatically moving to the next page More...
 
void SetShowPageNumbersOnButtons (bool show)
 Show or Hide page numbers on Buttons More...
 
void SetShowPageTitlesOnButtons (bool show)
 Show or Hide page titles on Buttons (page titles are sourced from Page.PageTitle) More...
 
void SetMaximumNumberOfButtonsToShow (int maxNumber)
 Set the maximum number of buttons to show at once More...
 
void SetMaximumNumberOfButtonsToShow (float maxNumber)
 Float version of SetMaximumNumberOfButtonsToShow so we can accept input from a UI slider. More...
 
void SetUseKeyboardInput (bool useInput)
 Enable or disable keyboard input More...
 
void SetUseSwipeInput (bool useInput)
 Enable or disable Swipe input Please be advised that if this PagedRect is using a ScrollRect, this value will be ignored More...
 
void SetUseScrollWheelInput (bool useInput)
 Enable or disable scroll wheel input More...
 
void SetOnlyUseScrollWheelInputOnlyWhenMouseIsOver (bool onlyWhenMouseIsOver)
 
void SetHighlightWhenMouseIsOver (bool highlight)
 
void SetSwipeDeltaThreshold (float threshold)
 
virtual void SetCurrentPage (Page newPage, bool initial=false)
 Set the Current Page of this PagedRect. More...
 
virtual void SetCurrentPage (int newPage)
 
virtual void SetCurrentPage (int newPage, bool initial)
 Set the Current Page of this PagedRect (by its position in the hierarchy) More...
 
virtual void NextPage ()
 Show the next enabled Page (if there is one) More...
 
virtual void PreviousPage ()
 Show the previous enabled Page (if there is one) More...
 
virtual void ShowFirstPage ()
 Show the first enabled page More...
 
virtual void ShowLastPage ()
 Show the last enabled page More...
 
System.Collections.IEnumerator DelayedCall (float delay, Action call)
 Call a function after the specified delay. More...
 
void UpdateDisplay ()
 Shows/Hides pagination and buttons as required More...
 
void UpdatePages (bool force=false, bool forceRenewPageNumbers=false)
 Call this function at any time to update the page collection.

Parameters
forceRenewPageNumbersIf this is set to true, then all pages will be given new page numbers based on their order - if not, only pages which have not yet been issued a pageNumber will be granted one. The reasoning behind this is that, if this PagedRect is using Infinite Scrolling, then the pages themselves will be reordered as you scroll through them, but we still want to preserve the page numbers (in the past the order was always the page number).
More...
 
void ViewportDimensionsChanged ()
 

Public Attributes

int DefaultPage
 
bool AutoDiscoverPages = true
 
bool ShowPagination = true
 
bool ShowFirstAndLastButtons = true
 
bool ShowPreviousAndNextButtons = true
 
int MaximumNumberOfButtonsToShow = 15
 
bool ShowButtonTemplatesInEditor = true
 
bool ShowPageButtons = true
 
bool ShowNumbersOnButtons = true
 
bool ShowPageTitlesOnButtons = false
 
eAnimationType AnimationType = eAnimationType.SlideHorizontal
 
float AnimationSpeed = 1.0f
 
bool AutomaticallyMoveToNextPage = false
 
float DelayBetweenPages = 5f
 
bool LoopEndlessly = true
 
Page NewPageTemplate
 
bool UseKeyboardInput = false
 
KeyCode PreviousPageKey = KeyCode.LeftArrow
 
KeyCode NextPageKey = KeyCode.RightArrow
 
KeyCode FirstPageKey = KeyCode.Home
 
KeyCode LastPageKey = KeyCode.End
 
bool UseSwipeInput = true
 
float SwipeDeltaThreshold = .1f
 
float SpaceBetweenPages = 0f
 
bool LoopSeamlessly = false
 
bool ShowScrollBar = false
 
bool UseScrollWheelInput = false
 
bool OnlyUseScrollWheelInputWhenMouseIsOver = true
 
bool HighlightWhenMouseIsOver = false
 
Color NormalColor = new Color(1f, 1f, 1f)
 
Color HighlightColor = new Color(0.9f, 0.9f, 0.9f)
 
PageChangedEventType PageChangedEvent = new PageChangedEventType()
 
bool ShowPagePreviews = false
 
float PagePreviewScale = 0.25f
 
bool LockOneToOneScaleRatio = true
 
Sprite PagePreviewOverlayImage
 
Color PagePreviewOverlayNormalColor
 
Color PagePreviewOverlayHoverColor
 
float PagePreviewOverlayScaleOverride = 1f
 
PagedRect_ScrollRect ScrollRect
 
GameObject ScrollRectViewport
 
GameObject Viewport
 
GameObject Pagination
 
PaginationButton ButtonTemplate_CurrentPage
 
PaginationButton ButtonTemplate_OtherPages
 
PaginationButton ButtonTemplate_DisabledPage
 
PaginationButton Button_PreviousPage
 
PaginationButton Button_NextPage
 
PaginationButton Button_FirstPage
 
PaginationButton Button_LastPage
 
RuntimeAnimatorController AnimationControllerTemplate
 
List< PagePages = new List<Page>()
 
int editorSelectedPage = 1
 
RectTransform sizingTransform
 

Protected Member Functions

void PageEnterAnimation (Page page, eDirection direction, bool initial=false)
 Trigger a Page Show animation More...
 
void PageExitAnimation (Page page, eDirection direction)
 Trigger a Page Exit animation More...
 
void ScrollToClosestPage ()
 
DeltaDirection GetDragDeltaDirection (PointerEventData data)
 
bool HandleDragDelta (PointerEventData data)
 
bool HandleDragDelta (DeltaDirection deltaDirection)
 
void ShowHighlight ()
 
void ClearHighlight ()
 
void OnMouseOver ()
 
void OnMouseExit ()
 
int GetPagePosition (int PageNumber)
 Return the position of the given page number (as pages are moved around by Infinite Scrolling) More...
 
int GetPagePosition (Page page)
 
void ScrollRectValueChanged (Vector2 newPosition)
 Called whenever the ScrollRect's position changes More...
 
void SetScrollRectPosition ()
 
IEnumerator ScrollToDesiredPosition ()
 
int GetClosestPageNumberToScrollRectCenter ()
 
Dictionary< int, float > GetPageDistancesFromScrollRectCenter ()
 
float GetDesiredScrollRectOffset ()
 
void RecalculateDesiredPageSizes ()
 
float GetDesiredScrollRectOffset_PagePreviews ()
 
void HandlePagePreviewPreferredSizes ()
 
void HandlePagePreviewScaling ()
 

Protected Attributes

eAnimationType previousAnimationTypeValue
 
float _timeSinceLastPage = 0f
 
bool mouseIsOverPagedRect = false
 
List< Page_pages = new List<Page>()
 This is used to check for changes to the Page collection and avoid updating except where necessary If we do update unnecessarily, the scene gets marked as dirty without it actually needing to be More...
 
Vector2 _ScrollRectPosition = new Vector2()
 
bool firstPageSet = false
 
List< KeyValuePair< double, Action > > delayedEditorActions = new List<KeyValuePair<double, Action>>()
 

Properties

bool isDirty [get, set]
 
int CurrentPage [get, protected set]
 
int NumberOfPages [get]
 
MobileInput MobileInput [get]
 
ScrollWheelInput ScrollWheelInput [get]
 
UnityEngine.UI.Image imageComponent [get]
 
UnityEngine.UI.HorizontalOrVerticalLayoutGroup layoutGroup [get]
 
bool UsingScrollRect [get]
 If this is true, this PagedRect has detected that it is using a ScrollRect, and some behaviour will work differently (e.g. MobileInput) More...
 

Member Enumeration Documentation

Enumerator
None 
Next 
Previous 
Enumerator
None 
SlideHorizontal 
SlideVertical 
Fade 
Enumerator
Left 
Right 

Member Function Documentation

void UI.Pagination.PagedRect.AddPage ( Page  page)

Add a new page to this PagedRect - this Page should already have been instantiated.

Parameters
page
Page UI.Pagination.PagedRect.AddPageUsingTemplate ( )

Add a new page to this PagedRect - this Page will be instantiated and returned by this function. You can then customize it as required.

void UI.Pagination.PagedRect.CenterScrollRectOnCurrentPage ( bool  initial = false)
void UI.Pagination.PagedRect.ClearHighlight ( )
protected
System.Collections.IEnumerator UI.Pagination.PagedRect.DelayedCall ( float  delay,
Action  call 
)

Call a function after the specified delay.

Parameters
delay
call
Returns
int UI.Pagination.PagedRect.GetClosestPageNumberToScrollRectCenter ( )
protected
Page UI.Pagination.PagedRect.GetCurrentPage ( )
float UI.Pagination.PagedRect.GetDesiredScrollRectOffset ( )
protected
float UI.Pagination.PagedRect.GetDesiredScrollRectOffset_PagePreviews ( )
protected
DeltaDirection UI.Pagination.PagedRect.GetDragDeltaDirection ( PointerEventData  data)
protected
Page UI.Pagination.PagedRect.GetPageByNumber ( int  pageNumber,
bool  secondAttempt = false,
bool  allowNulls = false 
)
Dictionary<int, float> UI.Pagination.PagedRect.GetPageDistancesFromScrollRectCenter ( )
protected
int UI.Pagination.PagedRect.GetPageNumber ( Page  page)
float UI.Pagination.PagedRect.GetPageOffset ( Page  page)
float UI.Pagination.PagedRect.GetPageOffset_PagePreviews ( Page  page)
int UI.Pagination.PagedRect.GetPagePosition ( int  PageNumber)
protected

Return the position of the given page number (as pages are moved around by Infinite Scrolling)

Parameters
PageNumber
Returns
int UI.Pagination.PagedRect.GetPagePosition ( Page  page)
protected
bool UI.Pagination.PagedRect.HandleDragDelta ( PointerEventData  data)
protected
bool UI.Pagination.PagedRect.HandleDragDelta ( DeltaDirection  deltaDirection)
protected
void UI.Pagination.PagedRect.HandlePagePreviewPreferredSizes ( )
protected
void UI.Pagination.PagedRect.HandlePagePreviewScaling ( )
protected
virtual void UI.Pagination.PagedRect.NextPage ( )
virtual

Show the next enabled Page (if there is one)

void UI.Pagination.PagedRect.OnEndDrag ( PointerEventData  data)

Called whenever the user stops dragging

Parameters
data
void UI.Pagination.PagedRect.OnMouseExit ( )
protected
void UI.Pagination.PagedRect.OnMouseOver ( )
protected
void UI.Pagination.PagedRect.PageEnterAnimation ( Page  page,
eDirection  direction,
bool  initial = false 
)
protected

Trigger a Page Show animation

Parameters
page
direction
initial
void UI.Pagination.PagedRect.PageExitAnimation ( Page  page,
eDirection  direction 
)
protected

Trigger a Page Exit animation

Parameters
page
direction
virtual void UI.Pagination.PagedRect.PreviousPage ( )
virtual

Show the previous enabled Page (if there is one)

void UI.Pagination.PagedRect.RecalculateDesiredPageSizes ( )
protected
void UI.Pagination.PagedRect.RemoveAllPages ( bool  destroyPageObjects = false)
void UI.Pagination.PagedRect.RemovePage ( Page  page,
bool  destroyPageObject = false 
)

Remove a Page from this PagedRect, and optionally destroy it

Parameters
page
destroyPageObject
void UI.Pagination.PagedRect.RemovePage ( int  pageNumber,
bool  destroyPageObject = false 
)
void UI.Pagination.PagedRect.ScrollBarValueChanged ( )
void UI.Pagination.PagedRect.ScrollRectValueChanged ( Vector2  newPosition)
protected

Called whenever the ScrollRect's position changes

Parameters
newPosition
void UI.Pagination.PagedRect.ScrollToClosestPage ( )
protected
IEnumerator UI.Pagination.PagedRect.ScrollToDesiredPosition ( )
protected
void UI.Pagination.PagedRect.SetAnimationSpeed ( float  animationSpeed)

Set the animation speed for this PagedRect

Parameters
animationSpeed
void UI.Pagination.PagedRect.SetAnimationType ( string  animationType)

Set the Animation type of this PagedRect

Parameters
animationType
void UI.Pagination.PagedRect.SetAutomaticallyMoveToNextPage ( bool  move)

Enable or Disable automatically moving to the next page

Parameters
move
virtual void UI.Pagination.PagedRect.SetCurrentPage ( Page  newPage,
bool  initial = false 
)
virtual

Set the Current Page of this PagedRect.

Parameters
newPage
initial
virtual void UI.Pagination.PagedRect.SetCurrentPage ( int  newPage)
virtual
virtual void UI.Pagination.PagedRect.SetCurrentPage ( int  newPage,
bool  initial 
)
virtual

Set the Current Page of this PagedRect (by its position in the hierarchy)

Parameters
newPage
initial
void UI.Pagination.PagedRect.SetDelayBetweenPages ( float  delay)

Set the delay between pages (when automatically scrolling through pages)

Parameters
delay
void UI.Pagination.PagedRect.SetEditorSelectedPage ( int  page)

Used by the Editor to keep track of the selected page in edit mode

Parameters
page
void UI.Pagination.PagedRect.SetHighlightWhenMouseIsOver ( bool  highlight)
void UI.Pagination.PagedRect.SetLoopEndlessly ( bool  loop)

Enable or Disable Endless Looping

Parameters
loop
void UI.Pagination.PagedRect.SetMaximumNumberOfButtonsToShow ( int  maxNumber)

Set the maximum number of buttons to show at once

Parameters
maxNumber
void UI.Pagination.PagedRect.SetMaximumNumberOfButtonsToShow ( float  maxNumber)

Float version of SetMaximumNumberOfButtonsToShow so we can accept input from a UI slider.

Parameters
maxNumber
void UI.Pagination.PagedRect.SetOnlyUseScrollWheelInputOnlyWhenMouseIsOver ( bool  onlyWhenMouseIsOver)
void UI.Pagination.PagedRect.SetScrollRectPosition ( )
protected
void UI.Pagination.PagedRect.SetShowFirstAndLastButtons ( bool  show)

Show or hide the First and Last Buttons

Parameters
show
void UI.Pagination.PagedRect.SetShowPageNumbersOnButtons ( bool  show)

Show or Hide page numbers on Buttons

Parameters
show
void UI.Pagination.PagedRect.SetShowPageTitlesOnButtons ( bool  show)

Show or Hide page titles on Buttons (page titles are sourced from Page.PageTitle)

Parameters
show
void UI.Pagination.PagedRect.SetShowPreviousAndNextButtons ( bool  show)

Show or Hide the Previous and Next Buttons

Parameters
show
void UI.Pagination.PagedRect.SetSwipeDeltaThreshold ( float  threshold)
void UI.Pagination.PagedRect.SetUseKeyboardInput ( bool  useInput)

Enable or disable keyboard input

Parameters
useInput
void UI.Pagination.PagedRect.SetUseScrollWheelInput ( bool  useInput)

Enable or disable scroll wheel input

Parameters
useInput
void UI.Pagination.PagedRect.SetUseSwipeInput ( bool  useInput)

Enable or disable Swipe input Please be advised that if this PagedRect is using a ScrollRect, this value will be ignored

Parameters
useInput
virtual void UI.Pagination.PagedRect.ShowFirstPage ( )
virtual

Show the first enabled page

void UI.Pagination.PagedRect.ShowHighlight ( )
protected
virtual void UI.Pagination.PagedRect.ShowLastPage ( )
virtual

Show the last enabled page

void UI.Pagination.PagedRect.UpdateDisplay ( )

Shows/Hides pagination and buttons as required

void UI.Pagination.PagedRect.UpdatePages ( bool  force = false,
bool  forceRenewPageNumbers = false 
)

Call this function at any time to update the page collection.

Parameters
forceRenewPageNumbersIf this is set to true, then all pages will be given new page numbers based on their order - if not, only pages which have not yet been issued a pageNumber will be granted one. The reasoning behind this is that, if this PagedRect is using Infinite Scrolling, then the pages themselves will be reordered as you scroll through them, but we still want to preserve the page numbers (in the past the order was always the page number).

void UI.Pagination.PagedRect.UpdatePagination ( )

Updates the page buttons

void UI.Pagination.PagedRect.UpgradeLayoutGroupIfNecessary ( )
void UI.Pagination.PagedRect.ViewportDimensionsChanged ( )

Member Data Documentation

List<Page> UI.Pagination.PagedRect._pages = new List<Page>()
protected

This is used to check for changes to the Page collection and avoid updating except where necessary If we do update unnecessarily, the scene gets marked as dirty without it actually needing to be

Vector2 UI.Pagination.PagedRect._ScrollRectPosition = new Vector2()
protected
float UI.Pagination.PagedRect._timeSinceLastPage = 0f
protected
RuntimeAnimatorController UI.Pagination.PagedRect.AnimationControllerTemplate
float UI.Pagination.PagedRect.AnimationSpeed = 1.0f
eAnimationType UI.Pagination.PagedRect.AnimationType = eAnimationType.SlideHorizontal
bool UI.Pagination.PagedRect.AutoDiscoverPages = true
bool UI.Pagination.PagedRect.AutomaticallyMoveToNextPage = false
PaginationButton UI.Pagination.PagedRect.Button_FirstPage
PaginationButton UI.Pagination.PagedRect.Button_LastPage
PaginationButton UI.Pagination.PagedRect.Button_NextPage
PaginationButton UI.Pagination.PagedRect.Button_PreviousPage
PaginationButton UI.Pagination.PagedRect.ButtonTemplate_CurrentPage
PaginationButton UI.Pagination.PagedRect.ButtonTemplate_DisabledPage
PaginationButton UI.Pagination.PagedRect.ButtonTemplate_OtherPages
int UI.Pagination.PagedRect.DefaultPage
float UI.Pagination.PagedRect.DelayBetweenPages = 5f
List<KeyValuePair<double, Action> > UI.Pagination.PagedRect.delayedEditorActions = new List<KeyValuePair<double, Action>>()
protected
int UI.Pagination.PagedRect.editorSelectedPage = 1
KeyCode UI.Pagination.PagedRect.FirstPageKey = KeyCode.Home
bool UI.Pagination.PagedRect.firstPageSet = false
protected
Color UI.Pagination.PagedRect.HighlightColor = new Color(0.9f, 0.9f, 0.9f)
bool UI.Pagination.PagedRect.HighlightWhenMouseIsOver = false
KeyCode UI.Pagination.PagedRect.LastPageKey = KeyCode.End
bool UI.Pagination.PagedRect.LockOneToOneScaleRatio = true
bool UI.Pagination.PagedRect.LoopEndlessly = true
bool UI.Pagination.PagedRect.LoopSeamlessly = false
int UI.Pagination.PagedRect.MaximumNumberOfButtonsToShow = 15
bool UI.Pagination.PagedRect.mouseIsOverPagedRect = false
protected
Page UI.Pagination.PagedRect.NewPageTemplate
KeyCode UI.Pagination.PagedRect.NextPageKey = KeyCode.RightArrow
Color UI.Pagination.PagedRect.NormalColor = new Color(1f, 1f, 1f)
bool UI.Pagination.PagedRect.OnlyUseScrollWheelInputWhenMouseIsOver = true
PageChangedEventType UI.Pagination.PagedRect.PageChangedEvent = new PageChangedEventType()
Color UI.Pagination.PagedRect.PagePreviewOverlayHoverColor
Sprite UI.Pagination.PagedRect.PagePreviewOverlayImage
Color UI.Pagination.PagedRect.PagePreviewOverlayNormalColor
float UI.Pagination.PagedRect.PagePreviewOverlayScaleOverride = 1f
float UI.Pagination.PagedRect.PagePreviewScale = 0.25f
List<Page> UI.Pagination.PagedRect.Pages = new List<Page>()
GameObject UI.Pagination.PagedRect.Pagination
eAnimationType UI.Pagination.PagedRect.previousAnimationTypeValue
protected
KeyCode UI.Pagination.PagedRect.PreviousPageKey = KeyCode.LeftArrow
PagedRect_ScrollRect UI.Pagination.PagedRect.ScrollRect
GameObject UI.Pagination.PagedRect.ScrollRectViewport
bool UI.Pagination.PagedRect.ShowButtonTemplatesInEditor = true
bool UI.Pagination.PagedRect.ShowFirstAndLastButtons = true
bool UI.Pagination.PagedRect.ShowNumbersOnButtons = true
bool UI.Pagination.PagedRect.ShowPageButtons = true
bool UI.Pagination.PagedRect.ShowPagePreviews = false
bool UI.Pagination.PagedRect.ShowPageTitlesOnButtons = false
bool UI.Pagination.PagedRect.ShowPagination = true
bool UI.Pagination.PagedRect.ShowPreviousAndNextButtons = true
bool UI.Pagination.PagedRect.ShowScrollBar = false
RectTransform UI.Pagination.PagedRect.sizingTransform
float UI.Pagination.PagedRect.SpaceBetweenPages = 0f
float UI.Pagination.PagedRect.SwipeDeltaThreshold = .1f
bool UI.Pagination.PagedRect.UseKeyboardInput = false
bool UI.Pagination.PagedRect.UseScrollWheelInput = false
bool UI.Pagination.PagedRect.UseSwipeInput = true
GameObject UI.Pagination.PagedRect.Viewport

Property Documentation

int UI.Pagination.PagedRect.CurrentPage
getprotected set
UnityEngine.UI.Image UI.Pagination.PagedRect.imageComponent
getprotected
bool UI.Pagination.PagedRect.isDirty
getset
UnityEngine.UI.HorizontalOrVerticalLayoutGroup UI.Pagination.PagedRect.layoutGroup
getprotected
MobileInput UI.Pagination.PagedRect.MobileInput
get
int UI.Pagination.PagedRect.NumberOfPages
get
ScrollWheelInput UI.Pagination.PagedRect.ScrollWheelInput
get
bool UI.Pagination.PagedRect.UsingScrollRect
get

If this is true, this PagedRect has detected that it is using a ScrollRect, and some behaviour will work differently (e.g. MobileInput)


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