Manages a clickable on-screen menu UI element.
public class UIMenu : Sansar.Script.InstanceInterfaceRemarks
Use this for text-heavy game menus, voting prompts, settings panels, or non-interactive leaderboards.
Members at a glance
| Kind | Members |
|---|---|
| Fields | cMaxItems |
| Properties | Footer · SelectedIndex · SelectedItem · Subtitle · Title |
| Methods | Hide · Show · ShowStyled · ToString |
Fields
cMaxItems
public static readonly int cMaxItemsMaximum number of menu items allowed per menu.
Properties
Footer
public string Footer { get; }The current menu footer.
SelectedIndex
public int SelectedIndex { get; }The zero-based index of the last selected menu item, or -1 if none selected.
SelectedItem
public string SelectedItem { get; }The label of the last selected menu item.
Subtitle
public string Subtitle { get; }The current menu subtitle.
Title
public string Title { get; }The current menu title.
Methods
Hide
public void Hide()Hide the current menu.
Show
public void Show(
string title,
string subtitle,
string footer,
object[] items,
float positionXPercent,
float positionYPercent,
bool interactive,
bool closeOnSelection
)Show a scriptable menu using the default client theme.
| Parameter | Type | Description |
|---|---|---|
title | string | Primary header text. |
subtitle | string | Optional secondary header text. |
footer | string | Optional footer or hint text. |
items | object[] | List of rows to display. |
positionXPercent | float | Horizontal menu center position in percent of screen width. |
positionYPercent | float | Vertical menu center position in percent of screen height. |
interactive | bool | If false, the menu becomes a click-through display panel. |
closeOnSelection | bool | If true, the menu closes on the first click. |
Remarks
Call this with WaitFor to block until the first menu row is clicked.
public void Show(
string title,
string subtitle,
string footer,
object[] items,
float positionXPercent,
float positionYPercent,
bool interactive,
bool closeOnSelection,
Action<Sansar.Script.OperationCompleteEvent> handler
)Show a scriptable menu using the default client theme.
| Parameter | Type | Description |
|---|---|---|
title | string | Primary header text. |
subtitle | string | Optional secondary header text. |
footer | string | Optional footer or hint text. |
items | object[] | List of rows to display. |
positionXPercent | float | Horizontal menu center position in percent of screen width. |
positionYPercent | float | Vertical menu center position in percent of screen height. |
interactive | bool | If false, the menu becomes a click-through display panel. |
closeOnSelection | bool | If true, the menu closes on the first click. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Call this with WaitFor to block until the first menu row is clicked.
ShowStyled
public void ShowStyled(
string title,
string subtitle,
string footer,
object[] items,
float positionXPercent,
float positionYPercent,
bool interactive,
bool closeOnSelection,
Sansar.Color panelBackgroundColor,
Sansar.Color panelBorderColor,
Sansar.Color titleColor,
Sansar.Color textColor,
Sansar.Color accentColor
)Show a scriptable menu with caller-provided colors.
| Parameter | Type | Description |
|---|---|---|
title | string | Primary header text. |
subtitle | string | Optional secondary header text. |
footer | string | Optional footer or hint text. |
items | object[] | List of rows to display. |
positionXPercent | float | Horizontal menu center position in percent of screen width. |
positionYPercent | float | Vertical menu center position in percent of screen height. |
interactive | bool | If false, the menu becomes a click-through display panel. |
closeOnSelection | bool | If true, the menu closes on the first click. |
panelBackgroundColor | Sansar.Color | Background color for the menu body. |
panelBorderColor | Sansar.Color | Border color for the menu frame. |
titleColor | Sansar.Color | Title text color. |
textColor | Sansar.Color | Body and row text color. |
accentColor | Sansar.Color | Accent color used for hover and separators. |
Remarks
Call this with WaitFor to block until the first menu row is clicked.
public void ShowStyled(
string title,
string subtitle,
string footer,
object[] items,
float positionXPercent,
float positionYPercent,
bool interactive,
bool closeOnSelection,
Sansar.Color panelBackgroundColor,
Sansar.Color panelBorderColor,
Sansar.Color titleColor,
Sansar.Color textColor,
Sansar.Color accentColor,
Action<Sansar.Script.OperationCompleteEvent> handler
)Show a scriptable menu with caller-provided colors.
| Parameter | Type | Description |
|---|---|---|
title | string | Primary header text. |
subtitle | string | Optional secondary header text. |
footer | string | Optional footer or hint text. |
items | object[] | List of rows to display. |
positionXPercent | float | Horizontal menu center position in percent of screen width. |
positionYPercent | float | Vertical menu center position in percent of screen height. |
interactive | bool | If false, the menu becomes a click-through display panel. |
closeOnSelection | bool | If true, the menu closes on the first click. |
panelBackgroundColor | Sansar.Color | Background color for the menu body. |
panelBorderColor | Sansar.Color | Border color for the menu frame. |
titleColor | Sansar.Color | Title text color. |
textColor | Sansar.Color | Body and row text color. |
accentColor | Sansar.Color | Accent color used for hover and separators. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Call this with WaitFor to block until the first menu row is clicked.
ToString
public override string ToString()A string representation of this object.
Returns: string — A string representation of this object.
Remarks
The format of this string may change between releases.
Generated from the Sansar 47.10.0 client ScriptApi snapshot.