DiscoverTenerife
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
uniqueselectionDesplegableMenu Class Reference

This class controls the unique selection desplegable menu. More...

Inheritance diagram for uniqueselectionDesplegableMenu:

Public Member Functions

void OnClick ()
 This method should be called when the main button of the menu is clicked by the user. It checks if lastOptionClicked_ static property of optionsController class: More...
 
void showAllToggles (bool show)
 
bool checkToggle (int index)
 This method returns true if the toggle that is on the index-th position is on, in other case its false. More...
 
int size ()
 getter of the length of the toggles_ property. More...
 
void selectToggle (int index)
 This method active the toggle that is on the index-th position. it also puts the anyChange_ property to true. More...
 
void saveOptions ()
 This method calls the saveOptions method of the optionsController class. More...
 

Public Attributes

bool showToggles_
 true if the toggles should be shown, false if the toggles should be hidden. More...
 

Private Member Functions

void Awake ()
 This method is called before the first frame, it initialices anyChange_ as true, showToggles_ as false, the shown text as the default text and the active toggle as zero. More...
 
void Update ()
 This method is called once per frame. If anychange_ is false, it doesnt do nothing but if its true, it calls showAllToggles and updateState methods. More...
 
void updateState ()
 This method put off all the toggles except the active one. More...
 

Private Attributes

GameObject[] toggles_
 Array of GameObjects that each of them contains a toggle. More...
 
string defaultText_
 The default text that will be shown when the user didnt have clicked on the menu. More...
 
string saveText_ = "Click here to save options"
 The default text that will be shown when the user have clicked on the menu. More...
 
Text textField_
 Text that shows the state of the menu, waiting to be clicked for showing itself or waiting to be clicked for hiding itself. More...
 
bool anyChange_
 true if there is some change that could reconfigure the menu or the toggle. More...
 
int activeToggle_
 int that store the position of the current active toggle. More...
 

Detailed Description

This class controls the unique selection desplegable menu.

Member Function Documentation

◆ Awake()

void uniqueselectionDesplegableMenu.Awake ( )
private

This method is called before the first frame, it initialices anyChange_ as true, showToggles_ as false, the shown text as the default text and the active toggle as zero.

◆ checkToggle()

bool uniqueselectionDesplegableMenu.checkToggle ( int  index)

This method returns true if the toggle that is on the index-th position is on, in other case its false.

Parameters
intthe toggle's number that you want to check.
Returns
bool, true if the activeToggle_ is the same as the given number, false in other case.

◆ OnClick()

void uniqueselectionDesplegableMenu.OnClick ( )

This method should be called when the main button of the menu is clicked by the user. It checks if lastOptionClicked_ static property of optionsController class:

  • if it is null, it sets lastOptionClicked_ as this gameObject.
  • if it is this gameObject, it sets it as null.
  • if it is another gameObject, it doesnt do nothing.

That is the way to control that only one of the desplegables menus are opened at the same time. It also sets the correspondent text to the text field. Hide or shown the toggles, and it calls the saveOptions method of optionsController class.

◆ saveOptions()

void uniqueselectionDesplegableMenu.saveOptions ( )

This method calls the saveOptions method of the optionsController class.

◆ selectToggle()

void uniqueselectionDesplegableMenu.selectToggle ( int  index)

This method active the toggle that is on the index-th position. it also puts the anyChange_ property to true.

Parameters
intthe position of the toggle that you want to select.

◆ showAllToggles()

void uniqueselectionDesplegableMenu.showAllToggles ( bool  show)
Parameters
booltrue if you want to show all the toggles, false if you want to hide them.

◆ size()

int uniqueselectionDesplegableMenu.size ( )

getter of the length of the toggles_ property.

Returns
int Length of the toggles_ property.

◆ Update()

void uniqueselectionDesplegableMenu.Update ( )
private

This method is called once per frame. If anychange_ is false, it doesnt do nothing but if its true, it calls showAllToggles and updateState methods.

◆ updateState()

void uniqueselectionDesplegableMenu.updateState ( )
private

This method put off all the toggles except the active one.

Member Data Documentation

◆ activeToggle_

int uniqueselectionDesplegableMenu.activeToggle_
private

int that store the position of the current active toggle.

◆ anyChange_

bool uniqueselectionDesplegableMenu.anyChange_
private

true if there is some change that could reconfigure the menu or the toggle.

◆ defaultText_

string uniqueselectionDesplegableMenu.defaultText_
private

The default text that will be shown when the user didnt have clicked on the menu.

◆ saveText_

string uniqueselectionDesplegableMenu.saveText_ = "Click here to save options"
private

The default text that will be shown when the user have clicked on the menu.

◆ showToggles_

bool uniqueselectionDesplegableMenu.showToggles_

true if the toggles should be shown, false if the toggles should be hidden.

◆ textField_

Text uniqueselectionDesplegableMenu.textField_
private

Text that shows the state of the menu, waiting to be clicked for showing itself or waiting to be clicked for hiding itself.

◆ toggles_

GameObject [] uniqueselectionDesplegableMenu.toggles_
private

Array of GameObjects that each of them contains a toggle.


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