Table of Contents
ModHelperComponent for a sliding input
public class ModHelperSlider : BTD_Mod_Helper.Api.Components.ModHelperComponent
Inheritance UnityEngine.MonoBehaviour ModHelperComponent ModHelperSlider
The Default value, not scaled to anything
public float defaultValue;
The real current value, scaled by the appropriate scale factor
private float CurrentValue { get; }
The image showing where the default value is on the slider
public BTD_Mod_Helper.Api.Components.ModHelperImage DefaultNotch { get; }
The panel that's the filled up bar part of the slider
public BTD_Mod_Helper.Api.Components.ModHelperPanel Fill { get; }
The text that's on the notch of the slider
public BTD_Mod_Helper.Api.Components.ModHelperText Label { get; }
The min value of this slider, adjusted for internal scale factor
private float MaxValue { get; }
The min value of this slider, adjusted for internal scale factor
private float MinValue { get; }
The scale factor used for the step size of this slider
public float ScaleFactor { get; set; }
The actual Slider component
public Slider Slider { get; }
Creates a new ModHelperSlider
public static BTD_Mod_Helper.Api.Components.ModHelperSlider Create(BTD_Mod_Helper.Api.Components.Info info, float defaultValue, float minValue, float maxValue, float stepSize, Vector2 handleSize, UnityAction<float> onValueChanged=null, float fontSize=42f, string labelSuffix="", System.Nullable<float> startingValue=null);
info
Info
The name/position/size info. NOTE: height must be a set value
defaultValue
System.Single
The default slider amount
minValue
System.Single
The minimum value of the slider
maxValue
System.Single
The maximum value of the slider
stepSize
System.Single
What value the slider should increase by per tick
handleSize
UnityEngine.Vector2
The height and width of the pip
onValueChanged
UnityEngine.Events.UnityAction
Action should happen when the slider changes value, or null
fontSize
System.Single
The size of the label text
labelSuffix
System.String
String to add to the end of the label, e.g. "%"
startingValue
System.Nullable<System.Single>
If not null, the value that this should start as instead of the default
Sets the current value of this
public void SetCurrentValue(float value, bool sendCallback=true);
value
System.Single
The new value
sendCallback
System.Boolean
Whether the onValueChanged listener should fire