Class NumberedSceneSelectorScene

java.lang.Object
com.calebleavell.textinterface.scenes.GenericScene
com.calebleavell.textinterface.scenes.NumberedSceneSelectorScene
All Implemented Interfaces:
Function, Scene

public class NumberedSceneSelectorScene extends GenericScene

NumberedSceneSelectorScene Class

Utilizes a NumberedListInputScene to create a scene-selection mechanism

Much easier to construct than building a scene selector manually

  • Constructor Details

    • NumberedSceneSelectorScene

      public NumberedSceneSelectorScene(NumberedSceneSelectorScene.Builder builder)
      Return a new instance based on the builder fields
      Parameters:
      builder - The new NumberedSceneSelectorScene
  • Method Details

    • addScene

      public void addScene(Scene newScene, String text)
      Adds a new scene to choose from
      Parameters:
      newScene - The new scene
      text - The display text of the option
    • run

      public void run() throws Exception
      display displays the selector, gets the input, then display the chosen scene NOTE: all child scenes and functions will be ran BEFORE the selected scene is displayed
      Specified by:
      run in interface Function
      Overrides:
      run in class GenericScene
      Throws:
      Exception
    • toString

      public String toString(int indent, boolean displayChildren)
      Overrides GenericScene's toString to include it's scene options
      Specified by:
      toString in interface Scene
      Overrides:
      toString in class GenericScene
      Parameters:
      indent - the amount of spacing (increases deeper into the layers of children)
      displayChildren - Whether or not to include children in the toString
      Returns:
      the formatted string of the object and its children