Files

81 lines
1.8 KiB
Markdown

# IMappetUIBuilder.textbox
[← IMappetUIBuilder](index.md) · [← Master](../../wiki.md)
Parça 2/6 · [önceki](textbox.md) · [sonraki](textbox-3.md)
ui.text("[oTo close this screen, gently click on the button in the top right corner...").rxy(0.5, 0.5).w(200).anchor(0.5);
close.rx(1, -25).y(5).wh(20, 20);
c.getSubject().openUI(ui);
}
function handler(c)
{
var uiContext = c.getSubject().getUIContext();
if (uiContext.getLast() === "exit")
{
c.getSubject().closeUI();
}
}
closable
IMappetUIBuilder closable(boolean closable)
Toggle closability of this UI screen.
Parameters:
closable - Whether this UI screen can be closed or not (by default it is closable).
paused
IMappetUIBuilder paused(boolean paused)
Toggle pausing of this UI screen.
Parameters:
paused - Whether this UI screen is paused when opened.
create
UIComponent create(java.lang.String id)
Create and insert a UI component based on its ID into UI being built by this builder.
This method is future proof for in case other modders will be adding their own components, and the only way to create 3rd
party UI components is using this method by providing the ID of 3rd party UI component.
function main(c)
{
var ui = mappet.createUI().background();
var label = ui.create("label").label("Welcome, [l" + c.getSubject().getName() + "[r!");
label.rxy(0.5, 0.5).wh(100, 20).anchor(0.5);
label.color(0x00ee22).background(0x88000000).labelAnchor(0.5);
c.getSubject().openUI(ui);
}
Parameters:
id - ID of desired component to be created.
graphics
UIGraphicsComponent graphics()
Create and insert a graphics UI component into UI being built by this builder.
Check UIGraphicsComponent for description and examples.
button
UIButtonComponent button(java.lang.String label)