ProgressBarMenuOption
Class ProgressBarMenuOption
Namespace: SwiftlyS2.Core.Menus.OptionsBase
Assembly: SwiftlyS2.CS2.dll
Represents a progress bar menu option that displays progress visually.
public sealed class ProgressBarMenuOption : MenuOptionBase, IMenuOption, IDisposableInheritance
Implements
Inherited Members
- MenuOptionBase.Dispose()
- MenuOptionBase.PauseTextAnimation()
- MenuOptionBase.ResumeTextAnimation()
- MenuOptionBase.Menu
- MenuOptionBase.LineCount
- MenuOptionBase.BindingText
- MenuOptionBase.Text
- MenuOptionBase.Comment
- MenuOptionBase.MaxWidth
- MenuOptionBase.Visible
- MenuOptionBase.Enabled
- MenuOptionBase.CloseAfterClick
- MenuOptionBase.Tag
- MenuOptionBase.TextSize
- MenuOptionBase.TextStyle
- MenuOptionBase.PlaySound
- MenuOptionBase.VisibilityChanged
- MenuOptionBase.EnabledChanged
- MenuOptionBase.TextChanged
- MenuOptionBase.Validating
- MenuOptionBase.Click
- MenuOptionBase.BeforeFormat
- MenuOptionBase.AfterFormat
- MenuOptionBase.IsClickTaskCompleted(IPlayer)
- MenuOptionBase.GetVisible(IPlayer)
- MenuOptionBase.SetVisible(IPlayer, bool)
- MenuOptionBase.GetEnabled(IPlayer)
- MenuOptionBase.SetEnabled(IPlayer, bool)
- MenuOptionBase.GetDisplayText(IPlayer, int)
- MenuOptionBase.OnValidatingAsync(IPlayer)
- MenuOptionBase.OnClickAsync(IPlayer)
- object.Equals(object?)
- object.Equals(object?, object?)
- object.GetHashCode()
- object.GetType()
- object.ReferenceEquals(object?, object?)
- object.ToString()
Constructors
ProgressBarMenuOption(Func<float>, bool, bool, string, string, int, int)
Creates an instance of SwiftlyS2.Core.Menus.OptionsBase.ProgressBarMenuOption.
public ProgressBarMenuOption(Func<float> progressProvider, bool multiLine = false, bool showPercentage = true, string filledChar = "█", string emptyChar = "░", int updateIntervalMs = 120, int pauseIntervalMs = 1000)- progressProvider Func<float> — Function that returns progress value (0.0 to 1.0).
- multiLine bool — If true, uses 2 lines; if false, uses 1 line. Defaults to false.
- showPercentage bool — Whether to show percentage text. Defaults to true.
- filledChar string — Character for filled portion. Defaults to "█".
- emptyChar string — Character for empty portion. Defaults to "░".
- updateIntervalMs int — The interval in milliseconds between text updates. Defaults to 120ms.
- pauseIntervalMs int — The pause duration in milliseconds before starting the next text update cycle. Defaults to 1000ms.
When using this constructor, the SwiftlyS2.Core.Menus.OptionsBase.MenuOptionBase.Text property must be manually set to specify the initial text.
ProgressBarMenuOption(string, Func<float>, bool, bool, string, string, int, int)
Creates an instance of SwiftlyS2.Core.Menus.OptionsBase.ProgressBarMenuOption.
public ProgressBarMenuOption(string text, Func<float> progressProvider, bool multiLine = false, bool showPercentage = true, string filledChar = "█", string emptyChar = "░", int updateIntervalMs = 120, int pauseIntervalMs = 1000)- text string — The text content to display.
- progressProvider Func<float> — Function that returns progress value (0.0 to 1.0).
- multiLine bool — If true, uses 2 lines; if false, uses 1 line. Defaults to false.
- showPercentage bool — Whether to show percentage text. Defaults to true.
- filledChar string — Character for filled portion. Defaults to "█".
- emptyChar string — Character for empty portion. Defaults to "░".
- updateIntervalMs int — The interval in milliseconds between text updates. Defaults to 120ms.
- pauseIntervalMs int — The pause duration in milliseconds before starting the next text update cycle. Defaults to 1000ms.
Properties
BarWidth
Gets the width of the progress bar in characters.
public int BarWidth { get; }LineCount
Gets the number of lines this option requests to occupy in the menu.
public override int LineCount { get; }ShowPercentage
Gets whether to display the percentage value.
public bool ShowPercentage { get; }Methods
GetDisplayText(IPlayer, int)
Gets the display text for this option as it should appear to the specified player.
public override string GetDisplayText(IPlayer player, int displayLine = 0)- player IPlayer — The player requesting the display text.
- displayLine int — The display line index of the option.
- string — The formatted display text for the option.
- When
LineCount=1: ThedisplayLineparameter is not needed; return the HTML-formatted string directly.displayLine=0: Return all contentdisplayLine=1: Return only the first line contentdisplayLine=2: Return only the second line content- And so on...
GetProgress(IPlayer)
Gets the current progress value for the specified player.
public float GetProgress(IPlayer player)- player IPlayer — The player whose progress to retrieve.
- float — The current progress value (0.0 to 1.0).
SetProgressProvider(IPlayer, Func<float>)
Sets or updates the progress provider function for a specific player.
public void SetProgressProvider(IPlayer player, Func<float> progressProvider)- player IPlayer — The player whose progress provider to set.
- progressProvider Func<float> — Function that returns progress value (0.0 to 1.0).