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

This method controlls a multiselection desplegable menu. More...

Inheritance diagram for multiselectionDesplegableMenu:

Public Member Functions

void OnClick ()
 This method should be called when the user clicks the menu's button. First it checks if the lastOptionClicked_ static property of optionsController is null it sets that property as this GameObject, if that property is this GameObject, it sets that property to null, in other case this method dont do nothing. When the lastOptionClicked_ static property of optionsController is null or it is this GameObject it changes the button's text to the default text or the saving text. It also changes the showToggles_ property to the opposite value, the anyChange to true and then calls the saveOptions method of optionsController class. More...
 
void showAllToggles (bool show)
 This method hide all the menu's toggles if you give as a parameter a false, if you give a true it shows all of them. It puts the anyChange_ property as false. More...
 
bool checkToggle (int index)
 This method returns if the toggle that is on the index-th position is selected or not. If the index is bigger than the toggles_ array or negative it will raise an exception. More...
 
void setStateToggle (int index, bool state)
 This method select or deselect depending on the boolean that you pass as parameter the index-th toggle. It also puts the anyChange_ property to true. More...
 
int size ()
 Getter of the toggle's array length. More...
 
bool anyChange ()
 Getter of the anyChange property. More...
 
bool checkToggleByText (string name)
 This method returns the state of the toggle that has the given text, if there isnt any toggle with the given text it returns false. More...
 
void setToggleStateByText (string name, bool state)
 This method sets the given state on the toggle that has the given text. More...
 

Public Attributes

bool showToggles_
 True if it has to show the toggles, false if it has to hide the toggles. More...
 
bool defaultToggleValue_ = true
 True if all the toggles have to been selected by default, false in other case. More...
 

Private Member Functions

void Start ()
 This method is called on the first frame. It search all the toggles that are childs of this gameobject, then it applies the default value to all of them. It also changes the text of the menu's button to the default text and intialize the anyChange_ property to true and the optionController_ property to a reference of the optionsController. More...
 
void Update ()
 This method is called on each frame. It checks if anyChange_ property is true, it calls the showAllToggles method. More...
 

Private Attributes

bool anyChange_
 True if there is any change on any of the toggles, false in other case. More...
 
Toggle[] toggles_
 Array with a reference to all the toggles that this menu has. More...
 
string defaultText_
 String that contains the text that the button of the menu shows as default text. More...
 
Text textField_
 Text that is showed on the menu's button. More...
 
optionsController optionController_
 Reference to the optionsController instance. More...
 

Detailed Description

This method controlls a multiselection desplegable menu.

Member Function Documentation

◆ anyChange()

bool multiselectionDesplegableMenu.anyChange ( )

Getter of the anyChange property.

Returns
bool anyChange_'s property value.

◆ checkToggle()

bool multiselectionDesplegableMenu.checkToggle ( int  index)

This method returns if the toggle that is on the index-th position is selected or not. If the index is bigger than the toggles_ array or negative it will raise an exception.

Parameters
intposition of the toggle that you want to check his value.
Returns
bool true if that toggle is selected, false in other case.

◆ checkToggleByText()

bool multiselectionDesplegableMenu.checkToggleByText ( string  name)

This method returns the state of the toggle that has the given text, if there isnt any toggle with the given text it returns false.

Parameters
stringthat contains the text of the toggle that you want to check.
Returns
bool with the value of the toggle that has the given text.

◆ OnClick()

void multiselectionDesplegableMenu.OnClick ( )

This method should be called when the user clicks the menu's button. First it checks if the lastOptionClicked_ static property of optionsController is null it sets that property as this GameObject, if that property is this GameObject, it sets that property to null, in other case this method dont do nothing. When the lastOptionClicked_ static property of optionsController is null or it is this GameObject it changes the button's text to the default text or the saving text. It also changes the showToggles_ property to the opposite value, the anyChange to true and then calls the saveOptions method of optionsController class.

◆ setStateToggle()

void multiselectionDesplegableMenu.setStateToggle ( int  index,
bool  state 
)

This method select or deselect depending on the boolean that you pass as parameter the index-th toggle. It also puts the anyChange_ property to true.

Parameters
intpostition of the toggle that will change its value.
boolstate that you want to put to that toggle.

◆ setToggleStateByText()

void multiselectionDesplegableMenu.setToggleStateByText ( string  name,
bool  state 
)

This method sets the given state on the toggle that has the given text.

Parameters
stringthat contains the text of the toggle that you want to check.
boolstate that you want to set on the toggle that has that text.

◆ showAllToggles()

void multiselectionDesplegableMenu.showAllToggles ( bool  show)

This method hide all the menu's toggles if you give as a parameter a false, if you give a true it shows all of them. It puts the anyChange_ property as false.

Parameters
booltrue if you want to show all the toggles, false if you want to hide them.

◆ size()

int multiselectionDesplegableMenu.size ( )

Getter of the toggle's array length.

Returns
int Size of the toggles array.

◆ Start()

void multiselectionDesplegableMenu.Start ( )
private

This method is called on the first frame. It search all the toggles that are childs of this gameobject, then it applies the default value to all of them. It also changes the text of the menu's button to the default text and intialize the anyChange_ property to true and the optionController_ property to a reference of the optionsController.

◆ Update()

void multiselectionDesplegableMenu.Update ( )
private

This method is called on each frame. It checks if anyChange_ property is true, it calls the showAllToggles method.

Member Data Documentation

◆ anyChange_

bool multiselectionDesplegableMenu.anyChange_
private

True if there is any change on any of the toggles, false in other case.

◆ defaultText_

string multiselectionDesplegableMenu.defaultText_
private

String that contains the text that the button of the menu shows as default text.

◆ defaultToggleValue_

bool multiselectionDesplegableMenu.defaultToggleValue_ = true

True if all the toggles have to been selected by default, false in other case.

◆ optionController_

optionsController multiselectionDesplegableMenu.optionController_
private

Reference to the optionsController instance.

◆ showToggles_

bool multiselectionDesplegableMenu.showToggles_

True if it has to show the toggles, false if it has to hide the toggles.

◆ textField_

Text multiselectionDesplegableMenu.textField_
private

Text that is showed on the menu's button.

◆ toggles_

Toggle [] multiselectionDesplegableMenu.toggles_
private

Array with a reference to all the toggles that this menu has.


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