Skip to content

Get Sansar

Script API

UIMenu

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

Class Namespace Sansar.Simulation Inherits Sansar.Script.InstanceInterface Added in 47.1.1

Manages a clickable on-screen menu UI element.

public class UIMenu : Sansar.Script.InstanceInterface

Remarks

Use this for text-heavy game menus, voting prompts, settings panels, or non-interactive leaderboards.

Members at a glance

KindMembers
FieldscMaxItems
PropertiesFooter · SelectedIndex · SelectedItem · Subtitle · Title
MethodsHide · Show · ShowStyled · ToString

Fields

cMaxItems

Added in 47.1.1
public static readonly int cMaxItems

Maximum number of menu items allowed per menu.

Properties

Added in 47.1.1
public string Footer { get; }

The current menu footer.

SelectedIndex

Added in 47.1.1
public int SelectedIndex { get; }

The zero-based index of the last selected menu item, or -1 if none selected.

SelectedItem

Added in 47.1.1
public string SelectedItem { get; }

The label of the last selected menu item.

Subtitle

Added in 47.1.1
public string Subtitle { get; }

The current menu subtitle.

Title

Added in 47.1.1
public string Title { get; }

The current menu title.

Methods

Hide

Added in 47.1.1
public void Hide()

Hide the current menu.

Show

Added in 47.1.1
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.

ParameterTypeDescription
titlestringPrimary header text.
subtitlestringOptional secondary header text.
footerstringOptional footer or hint text.
itemsobject[]List of rows to display.
positionXPercentfloatHorizontal menu center position in percent of screen width.
positionYPercentfloatVertical menu center position in percent of screen height.
interactiveboolIf false, the menu becomes a click-through display panel.
closeOnSelectionboolIf true, the menu closes on the first click.
Remarks

Call this with WaitFor to block until the first menu row is clicked.

Added in 47.1.1
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.

ParameterTypeDescription
titlestringPrimary header text.
subtitlestringOptional secondary header text.
footerstringOptional footer or hint text.
itemsobject[]List of rows to display.
positionXPercentfloatHorizontal menu center position in percent of screen width.
positionYPercentfloatVertical menu center position in percent of screen height.
interactiveboolIf false, the menu becomes a click-through display panel.
closeOnSelectionboolIf true, the menu closes on the first click.
handlerAction<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

Added in 47.1.1
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.

ParameterTypeDescription
titlestringPrimary header text.
subtitlestringOptional secondary header text.
footerstringOptional footer or hint text.
itemsobject[]List of rows to display.
positionXPercentfloatHorizontal menu center position in percent of screen width.
positionYPercentfloatVertical menu center position in percent of screen height.
interactiveboolIf false, the menu becomes a click-through display panel.
closeOnSelectionboolIf true, the menu closes on the first click.
panelBackgroundColorSansar.ColorBackground color for the menu body.
panelBorderColorSansar.ColorBorder color for the menu frame.
titleColorSansar.ColorTitle text color.
textColorSansar.ColorBody and row text color.
accentColorSansar.ColorAccent color used for hover and separators.
Remarks

Call this with WaitFor to block until the first menu row is clicked.

Added in 47.1.1
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.

ParameterTypeDescription
titlestringPrimary header text.
subtitlestringOptional secondary header text.
footerstringOptional footer or hint text.
itemsobject[]List of rows to display.
positionXPercentfloatHorizontal menu center position in percent of screen width.
positionYPercentfloatVertical menu center position in percent of screen height.
interactiveboolIf false, the menu becomes a click-through display panel.
closeOnSelectionboolIf true, the menu closes on the first click.
panelBackgroundColorSansar.ColorBackground color for the menu body.
panelBorderColorSansar.ColorBorder color for the menu frame.
titleColorSansar.ColorTitle text color.
textColorSansar.ColorBody and row text color.
accentColorSansar.ColorAccent color used for hover and separators.
handlerAction<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

Added in 47.1.1
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.