UI (functions)/Menus

From PMDOWiki
More functions: Script Reference

This page documents the ScriptUI class for Lua scripting.

As a singleton class, it can be accessed from Lua with UI.

BeginChoiceMenu

UI:BeginChoiceMenu(message, choicesPairs, defaultChoice, cancelChoice, callbacks)

Marks the start of a multi-choice menu.
UI:WaitForChoice() must be called afterwards for the menu to be actually displayed,
and for execution to suspend until the choice is returned.
Then to retrieve the integer value indicating the result of the menu, UI:ChoiceResult() must be called.

Parameters

Name Type Description
System.String System.String The question to ask the user.
NLua.LuaTable NLua.LuaTable A table of choices. Each choice can be either a string, or { string, bool } representing the text and enabled status.
System.Object System.Object The cursor starts on this choice.
System.Object System.Object This choice is chosen if the player presses the cancel button.
NLua.LuaTable NLua.LuaTable The Lua table of callbacks for the textbox to call.


BeginMultiPageMenu

UI:BeginMultiPageMenu(x, y, width, title, choicesPairs, linesPerPage, defaultChoice, cancelChoice)

Marks the start of a multi-paged choice menu.
UI:WaitForChoice() must be called afterwards for the menu to be actually displayed,
and for execution to suspend until the choice is returned.
Then to retrieve the integer value indicating the result of the menu, UI:ChoiceResult() must be called.

Parameters

Name Type Description
System.Int32 System.Int32 X position of the menu
System.Int32 System.Int32 Y position of the menu
System.Int32 System.Int32 Width of the menu
System.String System.String Height of the menu
NLua.LuaTable NLua.LuaTable A table of choices. Each choice can be either a string, or { string, bool } representing the text and enabled status.
System.Int32 System.Int32 Number of choices per page
System.Object System.Object The cursor starts on this choice.
System.Object System.Object This choice is chosen if the player presses the cancel button.


SetCustomMenu

UI:SetCustomMenu(menu)

Displays a custom menu of the caller's choice.

UI:WaitForChoice() must be called afterwards for the menu to be actually displayed,
and for execution to suspend until the menu is exited.

Parameters

Name Type Description
RogueEssence.Menu.InteractableMenu RogueEssence.Menu.InteractableMenu


ChoiceResult

UI:ChoiceResult()

Get the result of the last choice menu


Returns

Type Description
System.Object The result of the choice


GetChoiceAction

UI:GetChoiceAction(obj)

Creates an action that sets the choice result to a specified object.

Parameters

Name Type Description
System.Object System.Object The object to set the choice result to, if the action was fired.

Returns

Type Description
System.Action This action will set the choice result.


WaitForChoice

UI:WaitForChoice()

Displays the currently set choice menu and waits for the player's selection to complete.


Returns

Type Description
NLua.LuaFunction


ProcessMenuCoroutine

UI:ProcessMenuCoroutine(menu)

Opens the provided menu and starts the menu coroutine.
This should be called only from non-coroutine sources.

Parameters

Name Type Description
System.Object System.Object

Returns

Type Description
RogueEssence.Coroutine


References

https://github.com/RogueCollab/RogueEssence/blob/master/RogueEssence/Lua/ScriptUIMenus.cs