Package com.skloch.game
Class DialogueBox.SelectBox
java.lang.Object
com.skloch.game.DialogueBox.SelectBox
- Enclosing class:
DialogueBox
A class displaying a little selction box to the user when an input is needed in dialog
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
The same as choiceUp but in the opposite directionvoid
choiceUp()
Moves the player's choice up one selection Also hides the pointer at the old index, and shows the pointer at the new indexReturns the event string associated with the selected choice Call hide() afterwards to close the menucom.badlogic.gdx.scenes.scene2d.ui.Window
Gets the window of the select boxvoid
hide()
Hides the selection widgetboolean
Returns whether the selection box is visible or notvoid
setChoice
(int index) Sets the player's choice to a specific value, used to default to "No" for most optionsvoid
setOptions
(String[] options, String[] events) Sets the options visible to the player when asking for a choice.void
show()
Shows the selection widget
-
Field Details
-
selectWindow
private com.badlogic.gdx.scenes.scene2d.ui.Window selectWindow -
selectTable
private com.badlogic.gdx.scenes.scene2d.ui.Table selectTable -
choiceIndex
private int choiceIndex -
options
-
events
-
optionPointers
private com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Label> optionPointers
-
-
Constructor Details
-
SelectBox
public SelectBox()
-
-
Method Details
-
setOptions
Sets the options visible to the player when asking for a choice. Also sets which events to call from each option. Event strings are translated into events in EventManager- Parameters:
options
- The options available to the player e.g. "Yes" and "No"events
- The events called to the option of the same index E.g. "piazza" and "closeDialogue"- See Also:
-
choiceUp
public void choiceUp()Moves the player's choice up one selection Also hides the pointer at the old index, and shows the pointer at the new index -
choiceDown
public void choiceDown()The same as choiceUp but in the opposite direction -
getChoice
Returns the event string associated with the selected choice Call hide() afterwards to close the menu- Returns:
- An event string to be passed to EventManager
-
getWindow
public com.badlogic.gdx.scenes.scene2d.ui.Window getWindow()Gets the window of the select box- Returns:
- The window of the select box
-
hide
public void hide()Hides the selection widget -
show
public void show()Shows the selection widget -
isVisible
public boolean isVisible()Returns whether the selection box is visible or not- Returns:
- true if the selection box is visible
-
setChoice
public void setChoice(int index) Sets the player's choice to a specific value, used to default to "No" for most options- Parameters:
index
- The new choice index
-