UI#
- class UI#
Adds windows of buttons, text fields and other widgets to the game’s UI.
Note
The windows are removed when the client that added them disconnects. For messages on the screen, see
KSA.ShowMessage.
- class Window#
A window, holding widgets one per line. Created using
UI.AddWindow.Note
The window fits its widgets until its size is set. Closing the window makes it invisible. The window is hidden with the game’s UI.
- Tuple<float, float> Position { get; set; }#
The position of the top left corner of the window, from the top left corner of the game window, in pixels.
- Game Scenes:
All
- Tuple<float, float> Size { get; set; }#
The width and height of the window, in pixels.
- Game Scenes:
All
Note
Throws an exception if the width or height is not positive.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- Label AddLabel (string content, bool visible = true)#
Add a label.
- Parameters:
content – The text of the label.
visible – Whether the label is visible.
- Game Scenes:
All
- Button AddButton (string content, bool visible = true)#
Add a button.
- Parameters:
content – The text on the button.
visible – Whether the button is visible.
- Game Scenes:
All
- InputField AddInputField (string label = "", bool visible = true)#
Add a text input field, empty.
- Parameters:
label – The text shown next to the field.
visible – Whether the field is visible.
- Game Scenes:
All
- Slider AddSlider (string label = "", float minimum = 0.0f, float maximum = 1.0f, bool visible = true)#
Add a slider, at its minimum value.
- Parameters:
label – The text shown next to the slider.
minimum – The minimum value.
maximum – The maximum value.
visible – Whether the slider is visible.
- Game Scenes:
All
Note
Throws an exception if the minimum is not less than the maximum.
- Toggle AddToggle (string content, bool visible = true)#
Add a toggle, unchecked.
- Parameters:
content – The text shown next to the toggle.
visible – Whether the toggle is visible.
- Game Scenes:
All
- Dropdown AddDropdown (IList<string> options, string label = "", bool visible = true)#
Add a dropdown, with no option selected.
- Parameters:
options – The options to choose from.
label – The text shown next to the dropdown.
visible – Whether the dropdown is visible.
- Game Scenes:
All
- Separator AddSeparator (bool visible = true)#
Add a horizontal line.
- Parameters:
visible – Whether the line is visible.
- Game Scenes:
All
- Row AddRow (bool visible = true)#
Add a row, which lays out its widgets from left to right.
- Parameters:
visible – Whether the row is visible.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class Row#
A row of widgets, laid out from left to right. Added to a window or a row.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- Label AddLabel (string content, bool visible = true)#
Add a label.
- Parameters:
content – The text of the label.
visible – Whether the label is visible.
- Game Scenes:
All
- Button AddButton (string content, bool visible = true)#
Add a button.
- Parameters:
content – The text on the button.
visible – Whether the button is visible.
- Game Scenes:
All
- InputField AddInputField (string label = "", bool visible = true)#
Add a text input field, empty.
- Parameters:
label – The text shown next to the field.
visible – Whether the field is visible.
- Game Scenes:
All
- Slider AddSlider (string label = "", float minimum = 0.0f, float maximum = 1.0f, bool visible = true)#
Add a slider, at its minimum value.
- Parameters:
label – The text shown next to the slider.
minimum – The minimum value.
maximum – The maximum value.
visible – Whether the slider is visible.
- Game Scenes:
All
Note
Throws an exception if the minimum is not less than the maximum.
- Toggle AddToggle (string content, bool visible = true)#
Add a toggle, unchecked.
- Parameters:
content – The text shown next to the toggle.
visible – Whether the toggle is visible.
- Game Scenes:
All
- Dropdown AddDropdown (IList<string> options, string label = "", bool visible = true)#
Add a dropdown, with no option selected.
- Parameters:
options – The options to choose from.
label – The text shown next to the dropdown.
visible – Whether the dropdown is visible.
- Game Scenes:
All
- Separator AddSeparator (bool visible = true)#
Add a horizontal line.
- Parameters:
visible – Whether the line is visible.
- Game Scenes:
All
- Row AddRow (bool visible = true)#
Add a row, which lays out its widgets from left to right.
- Parameters:
visible – Whether the row is visible.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class Label#
A line of text. Added to a window or a row.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class Button#
A button. Added to a window or a row.
- bool Clicked { get; set; }#
Whether the button has been clicked.
- Game Scenes:
All
Note
A click sets this to
true, and it staystrueuntil set tofalse.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class InputField#
A single line text input field. Added to a window or a row.
Note
While the field is being edited, the game clears the rotation and translation inputs of the controlled vehicle each frame.
- bool Changed { get; set; }#
Whether the text has been edited.
- Game Scenes:
All
Note
An edit sets this to
true, and it staystrueuntil set tofalse. SettingInputField.Valueleaves it unchanged.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class Slider#
A horizontal slider. Added to a window or a row.
- float Minimum { get; set; }#
The minimum value.
- Game Scenes:
All
Note
Throws an exception if set to a value not less than the maximum.
- float Maximum { get; set; }#
The maximum value.
- Game Scenes:
All
Note
Throws an exception if set to a value not greater than the minimum.
- bool Changed { get; set; }#
Whether the value has been changed by dragging the slider.
- Game Scenes:
All
Note
A change sets this to
true, and it staystrueuntil set tofalse. SettingSlider.Valueleaves it unchanged.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class Toggle#
A check box with a label. Added to a window or a row.
- bool Changed { get; set; }#
Whether the toggle has been clicked.
- Game Scenes:
All
Note
A click sets this to
true, and it staystrueuntil set tofalse. SettingToggle.Checkedleaves it unchanged.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All
- class Dropdown#
A dropdown list of options. Added to a window or a row.
- IList<string> Options { get; set; }#
The options to choose from.
- Game Scenes:
All
Note
Setting the options clears the selection if the selected index is no longer in the list.
- int SelectedIndex { get; set; }#
The index of the selected option, or -1 for none.
- Game Scenes:
All
Note
Throws an exception if the index is out of range.
- bool Changed { get; set; }#
Whether an option has been chosen from the list.
- Game Scenes:
All
Note
A choice sets this to
true, and it staystrueuntil set tofalse. SettingDropdown.SelectedIndexleaves it unchanged.
- bool Enabled { get; set; }#
Whether the widget responds to input. A disabled widget is drawn dimmed.
- Game Scenes:
All
- void Remove ()#
Remove the widget.
- Game Scenes:
All