Infinite Runner Engine v1.9
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoreMountains.MMInterface.MMCarousel Class Reference

A class to handle a carousel of UI elements, placed in an HorizontalLayoutGroup. All elements of the carousel need to have the same width. More...

Inheritance diagram for MoreMountains.MMInterface.MMCarousel:

Public Member Functions

virtual void MoveLeft ()
 Moves the carousel to the left. More...
 
virtual void MoveRight ()
 Moves the carousel to the right. More...
 
virtual bool CanMoveLeft ()
 
virtual bool CanMoveRight ()
 Determines whether this carousel can move right. More...
 

Public Attributes

HorizontalLayoutGroup Content
 the layout group that contains all carousel's elements More...
 
Camera UICamera
 
MMTouchButton LeftButton
 the button that moves the carousel to the left More...
 
MMTouchButton RightButton
 the button that moves the carousel to the right More...
 
int CurrentIndex = 0
 the initial and current index More...
 
int Pagination = 1
 the number of items in the carousel that should be moved every time More...
 
float ThresholdInPercent = 1f
 the percentage of distance that, when reached, will stop movement More...
 
float MoveDuration = 0.05f
 the duration (in seconds) of the carousel's movement More...
 
GameObject InitialFocus
 Bind here the carousel item that should have focus initially. More...
 
bool ForceMouseVisible = true
 if this is true, the mouse will be forced back on Start More...
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our carousel More...
 
virtual void Initialization ()
 Initializes the carousel, grabs the rect transform, computes the elements' dimensions, and inits position More...
 
virtual void MoveToCurrentIndex ()
 Initiates movement to the current index More...
 
virtual Vector2 DeterminePosition ()
 Determines the target position based on the current index value. More...
 
virtual void Update ()
 On Update we move the carousel if required, and handles button states More...
 
virtual void HandleFocus ()
 
virtual void HandleButtons ()
 Handles the buttons, enabling and disabling them if needed More...
 
virtual void LerpPosition ()
 Lerps the carousel's position. More...
 

Protected Attributes

float _elementWidth
 the number More...
 
int _contentLength = 0
 
float _spacing
 
Vector2 _initialPosition
 
RectTransform _rectTransform
 
bool _lerping = false
 
float _lerpStartedTimestamp
 
Vector2 _startPosition
 
Vector2 _targetPosition
 

Detailed Description

A class to handle a carousel of UI elements, placed in an HorizontalLayoutGroup. All elements of the carousel need to have the same width.

Member Function Documentation

◆ CanMoveLeft()

virtual bool MoreMountains.MMInterface.MMCarousel.CanMoveLeft ( )
virtual

◆ CanMoveRight()

virtual bool MoreMountains.MMInterface.MMCarousel.CanMoveRight ( )
virtual

Determines whether this carousel can move right.

Returns
true if this instance can move right; otherwise, false.

◆ DeterminePosition()

virtual Vector2 MoreMountains.MMInterface.MMCarousel.DeterminePosition ( )
protectedvirtual

Determines the target position based on the current index value.

Returns
The position.

◆ HandleButtons()

virtual void MoreMountains.MMInterface.MMCarousel.HandleButtons ( )
protectedvirtual

Handles the buttons, enabling and disabling them if needed

◆ HandleFocus()

virtual void MoreMountains.MMInterface.MMCarousel.HandleFocus ( )
protectedvirtual

◆ Initialization()

virtual void MoreMountains.MMInterface.MMCarousel.Initialization ( )
protectedvirtual

Initializes the carousel, grabs the rect transform, computes the elements' dimensions, and inits position

◆ LerpPosition()

virtual void MoreMountains.MMInterface.MMCarousel.LerpPosition ( )
protectedvirtual

Lerps the carousel's position.

◆ MoveLeft()

virtual void MoreMountains.MMInterface.MMCarousel.MoveLeft ( )
virtual

Moves the carousel to the left.

◆ MoveRight()

virtual void MoreMountains.MMInterface.MMCarousel.MoveRight ( )
virtual

Moves the carousel to the right.

◆ MoveToCurrentIndex()

virtual void MoreMountains.MMInterface.MMCarousel.MoveToCurrentIndex ( )
protectedvirtual

Initiates movement to the current index

◆ Start()

virtual void MoreMountains.MMInterface.MMCarousel.Start ( )
protectedvirtual

On Start we initialize our carousel

◆ Update()

virtual void MoreMountains.MMInterface.MMCarousel.Update ( )
protectedvirtual

On Update we move the carousel if required, and handles button states

Member Data Documentation

◆ _contentLength

int MoreMountains.MMInterface.MMCarousel._contentLength = 0
protected

◆ _elementWidth

float MoreMountains.MMInterface.MMCarousel._elementWidth
protected

the number

◆ _initialPosition

Vector2 MoreMountains.MMInterface.MMCarousel._initialPosition
protected

◆ _lerping

bool MoreMountains.MMInterface.MMCarousel._lerping = false
protected

◆ _lerpStartedTimestamp

float MoreMountains.MMInterface.MMCarousel._lerpStartedTimestamp
protected

◆ _rectTransform

RectTransform MoreMountains.MMInterface.MMCarousel._rectTransform
protected

◆ _spacing

float MoreMountains.MMInterface.MMCarousel._spacing
protected

◆ _startPosition

Vector2 MoreMountains.MMInterface.MMCarousel._startPosition
protected

◆ _targetPosition

Vector2 MoreMountains.MMInterface.MMCarousel._targetPosition
protected

◆ Content

HorizontalLayoutGroup MoreMountains.MMInterface.MMCarousel.Content

the layout group that contains all carousel's elements

◆ CurrentIndex

int MoreMountains.MMInterface.MMCarousel.CurrentIndex = 0

the initial and current index

◆ ForceMouseVisible

bool MoreMountains.MMInterface.MMCarousel.ForceMouseVisible = true

if this is true, the mouse will be forced back on Start

◆ InitialFocus

GameObject MoreMountains.MMInterface.MMCarousel.InitialFocus

Bind here the carousel item that should have focus initially.

◆ LeftButton

MMTouchButton MoreMountains.MMInterface.MMCarousel.LeftButton

the button that moves the carousel to the left

◆ MoveDuration

float MoreMountains.MMInterface.MMCarousel.MoveDuration = 0.05f

the duration (in seconds) of the carousel's movement

◆ Pagination

int MoreMountains.MMInterface.MMCarousel.Pagination = 1

the number of items in the carousel that should be moved every time

◆ RightButton

MMTouchButton MoreMountains.MMInterface.MMCarousel.RightButton

the button that moves the carousel to the right

◆ ThresholdInPercent

float MoreMountains.MMInterface.MMCarousel.ThresholdInPercent = 1f

the percentage of distance that, when reached, will stop movement

◆ UICamera

Camera MoreMountains.MMInterface.MMCarousel.UICamera

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