Package mindustry.ui.builder
Class MenuBuilder
java.lang.Object
mindustry.ui.builder.MenuBuilder
Builder for presenting a complex menu to the player.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanIf true (default), the dialog fills the screen.booleanIf true (default), existing menus with this ID are hidden.booleanIf false, the dialog will not immediately be hidden when a button with a click listener is clicked.intID for menu callback; you can reuse this as long as you have unique keys for button results.Title string; if null, no title is shown at all (the orange bar is removed too)longUnique value that is passed to the result after menu is closed.contents of the dialog, must not be null -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfillScreen(boolean fillScreen) hideExisting(boolean hideExisting) hideOnClick(boolean hideOnClick) id(int id) static MenuBuilderstatic MenuBuilderof(UiBuilder.NodeBuilder<?> ui) voidshow(mindustry.gen.Player player) Submits this menu to the relevant player.voidshowAll()Submits this menu to all players.token(long token) voidRebuilds a specific Table with the specified elementId.
-
Field Details
-
title
Title string; if null, no title is shown at all (the orange bar is removed too) -
hideOnClick
public boolean hideOnClickIf 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 hideExistingIf true (default), existing menus with this ID are hidden. -
fillScreen
public boolean fillScreenIf 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 tokenUnique value that is passed to the result after menu is closed. -
id
public int idID for menu callback; you can reuse this as long as you have unique keys for button results. -
ui
contents of the dialog, must not be null
-
-
Constructor Details
-
MenuBuilder
public MenuBuilder()
-
-
Method Details
-
of
- Returns:
- a menu constructed from a builder.
-
of
- 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
Rebuilds a specific Table with the specified elementId. This can be used for updating dialog content based on user interaction. -
hideExisting
-
token
-
title
-
hideOnClick
-
fillScreen
-
id
-