Modding:DynamicOptions

From SkyCorp Global
Jump to navigation Jump to search

Introduced in r56.1, this class provides a means to build customized scene flows in your mods.

This object holds a set of buttons that can be pushed to the UI.

Sample code: DynamicOptionsExample

Public static methods

DynamicOptions generateNew()

Creates a new DynamicOptions

Public methods

void clearOptions()

Removes all options/buttons from this object

(This does not immediately affect UI, see MainScreen.resetUI() for that)

void addOption(string name, Closure onButtonScript, int preferredButtonLocation=-1)

Adds a new button to the collection.

name - The name for the button. Highly recommended to keep short or it will be unreadable.

onButtonScript - pass the function to be called if user presses the button. Usually just a function name, but you could create a lambda-style function, also.

preferredButtonLocation - An integer from 0-9, inclusive, will decide the button location. -1 will let the button go anywhere. If you plan to have a lot of buttons, just leave most of them as -1 and a dropdown will be created.

void showOptions()

Render options to MainScreen. This function assumes all buttons are already reset / non-enabled.