Classes | |
| class | DropdownElement |
Public Member Functions | |
| void | Initialize () |
| Initializes the dropdown with current elements and creates the UI. | |
| void | SelectElement (int index) |
| Selects a dropdown element by index. | |
| void | SelectElement (string text) |
| Selects a dropdown element by text value. | |
| void | AddElement (string text, Sprite icon=null) |
| Adds a new dropdown element. | |
| void | AddElement (string name, Sprite icon, Action action) |
| Adds a new dropdown element with an action callback. | |
| void | AddElement (string name, string icon, Action action) |
| void | RemoveElement (int index) |
| Removes an element by index. | |
| void | ClearElements () |
| Clears all dropdown elements. | |
| void | Rebuild () |
| Rebuilds the dropdown UI after modifying elements. | |
| override void | RefreshLayout () |
| override RectTransform | GetContentRoot () |
| void | ShowDropdown () |
| Shows the dropdown panel. | |
| void | HideDropdown () |
| Hides the dropdown panel. | |
| void | ToggleDropdown () |
| Toggles the dropdown panel visibility. | |
| DropdownElement | GetSelectedElement () |
| Gets the currently selected element. | |
| int | GetElementCount () |
| Gets the number of elements in the dropdown. | |
| void | OnWindowStyleChanged (rvUIMenuWindow.Style newStyle) |
| Called when the parent window's style changes. | |
Public Member Functions inherited from realvirtual.rvUIContainer | |
| RectTransform | GetContentRoot () |
| List< rvUIContent > | GetUIContents () |
| void | MoveContentToContainer (rvUIContainer container) |
Public Member Functions inherited from realvirtual.rvUIContent | |
| void | RefreshLayout () |
| void | RefreshLayoutRecursive () |
| void | RefreshLayoutBottomUp () |
| List< rvUIContent > | GetChildContents () |
| void | MoveToContainer (rvUIContainer container, bool refresh=true) |
| rvUIContainer | GetContainer () |
| List< rvUIContent > | GetPathToRoot () |
| void | ApplyColorScheme (ColorScheme colorScheme) |
Public Attributes | |
| string | title |
| Title text for the dropdown button. | |
| bool | changeIcon |
| Update button icon to match selected item. | |
| bool | changeText |
| Update button text to match selected item. | |
| List< DropdownElement > | elements |
| List of dropdown options. | |
| int | selectedIndex |
| Currently selected element index. | |
| string | selectedValue |
| Currently selected element text. | |
| UnityEvent< string > | OnElementSelected |
| Fired when an element is selected. | |
| UnityEvent< int > | OnIndexChanged |
| Fired when selection index changes. | |
Public Attributes inherited from realvirtual.rvUIContainer | |
| UnityEvent< rvUIContent > | OnChildAdded |
| UnityEvent< rvUIContent > | OnChildRemoved |
Public Attributes inherited from realvirtual.rvUIContent | |
| UnityEvent< ColorScheme > | OnApplyColorScheme |
Member Function Documentation
◆ AddElement() [1/2]
| void realvirtual.rvUIDropdown.AddElement | ( | string | name, |
| Sprite | icon, | ||
| Action | action | ||
| ) |
Adds a new dropdown element with an action callback.
- Parameters
-
name Display text for the element icon Optional icon sprite action Action to invoke when element is selected
◆ AddElement() [2/2]
| void realvirtual.rvUIDropdown.AddElement | ( | string | text, |
| Sprite | icon = null |
||
| ) |
Adds a new dropdown element.
◆ ClearElements()
| void realvirtual.rvUIDropdown.ClearElements | ( | ) |
Clears all dropdown elements.
◆ GetContentRoot()
| override RectTransform realvirtual.rvUIDropdown.GetContentRoot | ( | ) |
Implements realvirtual.IrvUIContainer.
◆ GetElementCount()
| int realvirtual.rvUIDropdown.GetElementCount | ( | ) |
Gets the number of elements in the dropdown.
◆ GetSelectedElement()
| DropdownElement realvirtual.rvUIDropdown.GetSelectedElement | ( | ) |
Gets the currently selected element.
◆ HideDropdown()
| void realvirtual.rvUIDropdown.HideDropdown | ( | ) |
Hides the dropdown panel.
◆ Initialize()
| void realvirtual.rvUIDropdown.Initialize | ( | ) |
Initializes the dropdown with current elements and creates the UI.
Call this manually in edit mode, or it will be called automatically at Start() in play mode.
◆ OnWindowStyleChanged()
| void realvirtual.rvUIDropdown.OnWindowStyleChanged | ( | rvUIMenuWindow::Style | newStyle | ) |
Called when the parent window's style changes.
Adjusts the dropdown panel's relative placement based on the new window style. IMPLEMENTS IRuntimeWindowStyle::OnWindowStyleChanged
- Parameters
-
newStyle The new window style
Implements realvirtual.IRuntimeWindowStyle.
◆ Rebuild()
| void realvirtual.rvUIDropdown.Rebuild | ( | ) |
Rebuilds the dropdown UI after modifying elements.
Same as Initialize() but provided for clarity.
◆ RemoveElement()
| void realvirtual.rvUIDropdown.RemoveElement | ( | int | index | ) |
Removes an element by index.
◆ SelectElement() [1/2]
| void realvirtual.rvUIDropdown.SelectElement | ( | int | index | ) |
Selects a dropdown element by index.
◆ SelectElement() [2/2]
| void realvirtual.rvUIDropdown.SelectElement | ( | string | text | ) |
Selects a dropdown element by text value.
◆ ShowDropdown()
| void realvirtual.rvUIDropdown.ShowDropdown | ( | ) |
Shows the dropdown panel.
◆ ToggleDropdown()
| void realvirtual.rvUIDropdown.ToggleDropdown | ( | ) |
Toggles the dropdown panel visibility.
Member Data Documentation
◆ changeIcon
| bool realvirtual.rvUIDropdown.changeIcon |
Update button icon to match selected item.
◆ changeText
| bool realvirtual.rvUIDropdown.changeText |
Update button text to match selected item.
◆ elements
| List<DropdownElement> realvirtual.rvUIDropdown.elements |
List of dropdown options.
◆ OnElementSelected
| UnityEvent<string> realvirtual.rvUIDropdown.OnElementSelected |
Fired when an element is selected.
◆ OnIndexChanged
| UnityEvent<int> realvirtual.rvUIDropdown.OnIndexChanged |
Fired when selection index changes.
◆ selectedIndex
| int realvirtual.rvUIDropdown.selectedIndex |
Currently selected element index.
◆ selectedValue
| string realvirtual.rvUIDropdown.selectedValue |
Currently selected element text.
◆ title
| string realvirtual.rvUIDropdown.title |
Title text for the dropdown button.
Public Member Functions inherited from