Class DialogueBox.SelectBox

java.lang.Object
com.skloch.game.DialogueBox.SelectBox
Enclosing class:
DialogueBox

class DialogueBox.SelectBox extends Object
A class displaying a little selction box to the user when an input is needed in dialog
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private String[]
     
    private com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Label>
     
    private String[]
     
    private com.badlogic.gdx.scenes.scene2d.ui.Table
     
    private com.badlogic.gdx.scenes.scene2d.ui.Window
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The same as choiceUp but in the opposite direction
    void
    Moves the player's choice up one selection Also hides the pointer at the old index, and shows the pointer at the new index
    Returns the event string associated with the selected choice Call hide() afterwards to close the menu
    com.badlogic.gdx.scenes.scene2d.ui.Window
    Gets the window of the select box
    void
    Hides the selection widget
    boolean
    Returns whether the selection box is visible or not
    void
    setChoice(int index)
    Sets the player's choice to a specific value, used to default to "No" for most options
    void
    setOptions(String[] options, String[] events)
    Sets the options visible to the player when asking for a choice.
    void
    Shows the selection widget

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      private String[] options
    • events

      private String[] events
    • optionPointers

      private com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Label> optionPointers
  • Constructor Details

    • SelectBox

      public SelectBox()
  • Method Details

    • setOptions

      public void setOptions(String[] options, String[] events)
      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

      public String 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