SliderMenuOption
Classpublic sealed class SliderMenuOption : MenuOptionBase, IMenuOption, IDisposableRepresents a slider menu option that allows selecting a numeric value within a range.
View sourceConstructors
Creates an instance of SliderMenuOption.
public SliderMenuOption(float min = 0, float max = 100, float? defaultValue = null, float step = 5, int totalBars = 10, int updateIntervalMs = 120, int pauseIntervalMs = 1000)- minfloatoptionalThe minimum value. Defaults to 0.
- maxfloatoptionalThe maximum value. Defaults to 100.
- defaultValuefloat?optionalThe default starting value. Defaults to the minimum value.
- stepfloatoptionalThe increment/decrement step. Defaults to 5.
- totalBarsintoptionalThe number of visual bars to display. Defaults to 10.
- updateIntervalMsintoptionalThe interval in milliseconds between text updates. Defaults to 120ms.
- pauseIntervalMsintoptionalThe pause duration in milliseconds before starting the next text update cycle. Defaults to 1000ms.
When using this constructor, the Text property must be manually set to specify the initial text.
Creates an instance of SliderMenuOption.
public SliderMenuOption(string text, float min = 0, float max = 100, float? defaultValue = null, float step = 5, int totalBars = 10, int updateIntervalMs = 120, int pauseIntervalMs = 1000)- textstringThe text content to display.
- minfloatoptionalThe minimum value. Defaults to 0.
- maxfloatoptionalThe maximum value. Defaults to 100.
- defaultValuefloat?optionalThe default starting value. Defaults to the minimum value.
- stepfloatoptionalThe increment/decrement step. Defaults to 5.
- totalBarsintoptionalThe number of visual bars to display. Defaults to 10.
- updateIntervalMsintoptionalThe interval in milliseconds between text updates. Defaults to 120ms.
- pauseIntervalMsintoptionalThe pause duration in milliseconds before starting the next text update cycle. Defaults to 1000ms.
Properties
Methods
Decrements the slider value by the step amount for the specified player. Wraps to Max if the value goes below Min.
public ValueTask DecrementValue(IPlayer player)- playerIPlayerThe player whose value to decrement.
Gets the display text for this option as it should appear to the specified player.
public override string GetDisplayText(IPlayer player, int displayLine = 0)When a menu option occupies multiple lines, MenuAPI may only need to display a specific line of that option. When LineCount=1 : The displayLine parameter is not needed; return the HTML-formatted string directly. When LineCount>=2 : Check the displayLine parameter: displayLine=0 : Return all content displayLine=1 : Return only the first line content displayLine=2 : Return only the second line content And so on... Note: MenuAPI ensures that the displayLine parameter will not exceed the option's LineCount .
Gets the current slider value for the specified player.
public float GetValue(IPlayer player)- playerIPlayerThe player whose value to retrieve.
Increments the slider value by the step amount for the specified player. Wraps to Min if the value goes above Max.
public ValueTask IncrementValue(IPlayer player)- playerIPlayerThe player whose value to increment.
Sets the slider value for the specified player.
public void SetValue(IPlayer player, float value)Occurs when the slider value changes for a player.
public event EventHandler<MenuOptionValueChangedEventArgs<float>>? ValueChanged