Class MenuBuilder

java.lang.Object
mindustry.ui.builder.MenuBuilder

public class MenuBuilder extends Object
Builder for presenting a complex menu to the player.
  • Field Details

    • title

      @Nullable public String title
      Title string; if null, no title is shown at all (the orange bar is removed too)
    • hideOnClick

      public boolean hideOnClick
      If false, the dialog will not immediately be hidden when a button with a click listener is clicked. keep in mind that users will be able to spam buttons.
    • hideExisting

      public boolean hideExisting
      If true (default), existing menus with this ID are hidden.
    • fillScreen

      public boolean fillScreen
      If true (default), the dialog fills the screen. If you're showing something small, make it false. For large complex menus, this has to be true in order to work properly.
    • token

      public long token
      Unique value that is passed to the result after menu is closed.
    • id

      public int id
      ID for menu callback; you can reuse this as long as you have unique keys for button results.
    • ui

      public UiBuilder.NodeBuilder<?> ui
      contents of the dialog, must not be null
  • Constructor Details

    • MenuBuilder

      public MenuBuilder()
  • Method Details

    • of

      public static MenuBuilder of(UiBuilder.NodeBuilder<?> ui)
      Returns:
      a menu constructed from a builder.
    • of

      public static MenuBuilder of(String dslString)
      Returns:
      a menu constructed from a DSL string (see UI DSL docs).
    • show

      public void show(mindustry.gen.Player player)
      Submits this menu to the relevant player.
    • showAll

      public void showAll()
      Submits this menu to all players.
    • update

      public void update(mindustry.gen.Player player, String elementId)
      Rebuilds a specific Table with the specified elementId. This can be used for updating dialog content based on user interaction.
    • hideExisting

      public MenuBuilder hideExisting(boolean hideExisting)
    • token

      public MenuBuilder token(long token)
    • title

      public MenuBuilder title(String title)
    • hideOnClick

      public MenuBuilder hideOnClick(boolean hideOnClick)
    • fillScreen

      public MenuBuilder fillScreen(boolean fillScreen)
    • id

      public MenuBuilder id(int id)