Class Slider
- Namespace
- Fallencake.UI
- Assembly
- Fallencake.UI.dll
public abstract class Slider : MultipleGraphicsSelectable, IMultiSelectable, ISlider
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourUIBehaviourSelectableSlider
- Implements
- Derived
- Inherited Members
Fields
_axis
protected Slider.SliderAxis _axis
Field Value
_currentValueOnPointerDown
protected float _currentValueOnPointerDown
Field Value
- float
_decimals
[SerializeField]
[Range(0, 5)]
protected int _decimals
Field Value
- int
_displayedValuePrecision
protected float _displayedValuePrecision
Field Value
- float
_fillImage
[SerializeField]
protected Image _fillImage
Field Value
- Image
_handle
[SerializeField]
protected RectTransform _handle
Field Value
- RectTransform
_hitRectTransform
protected RectTransform _hitRectTransform
Field Value
- RectTransform
_inputField
[SerializeField]
protected TMP_InputField _inputField
Field Value
- TMP_InputField
_isAutoSizeEnabled
[SerializeField]
protected bool _isAutoSizeEnabled
Field Value
- bool
_isInputFieldEnabled
[SerializeField]
protected bool _isInputFieldEnabled
Field Value
- bool
_isLoadedFromSave
protected bool _isLoadedFromSave
Field Value
- bool
_isPercent
[SerializeField]
protected bool _isPercent
Field Value
- bool
_isPointerDown
protected bool _isPointerDown
Field Value
- bool
_isPointerUp
protected bool _isPointerUp
Field Value
- bool
_isSavingEnabled
[SerializeField]
protected bool _isSavingEnabled
Field Value
- bool
_isValueTextEnabled
[SerializeField]
protected bool _isValueTextEnabled
Field Value
- bool
_isWholeNumbers
[SerializeField]
protected bool _isWholeNumbers
Field Value
- bool
_maxValue
[SerializeField]
protected float _maxValue
Field Value
- float
_minValue
[SerializeField]
protected float _minValue
Field Value
- float
_reverseValue
protected bool _reverseValue
Field Value
- bool
_value
[SerializeField]
protected float _value
Field Value
- float
_valueChanged
protected bool _valueChanged
Field Value
- bool
_valueSaveKey
[SerializeField]
protected string _valueSaveKey
Field Value
- string
_valueTextLabel
[SerializeField]
protected TMP_Text _valueTextLabel
Field Value
- TMP_Text
k_savingTag
protected const string k_savingTag = "_Saved_Value"
Field Value
- string
onPointerEnter
public UnityEvent onPointerEnter
Field Value
- UnityEvent
onPointerExit
public UnityEvent onPointerExit
Field Value
- UnityEvent
onValueChanged
[SerializeField]
public Slider.SliderEvent onValueChanged
Field Value
s_FillImageWarning
protected static readonly string s_FillImageWarning
Field Value
- string
s_HandleWarning
protected static readonly string s_HandleWarning
Field Value
- string
s_ValueTextWarning
protected static readonly string s_ValueTextWarning
Field Value
- string
Properties
Axis
public Slider.SliderAxis Axis { get; set; }
Property Value
Decimals
public int Decimals { get; set; }
Property Value
- int
DisplayedValue
Readable value rendered according to configured precision/format.
public float DisplayedValue { get; }
Property Value
- float
IsAutoSizeEnabled
public bool IsAutoSizeEnabled { get; set; }
Property Value
- bool
IsInputFieldEnabled
Whether the input field is enabled to change the value of the slider.
public bool IsInputFieldEnabled { get; set; }
Property Value
- bool
IsPercent
public bool IsPercent { get; set; }
Property Value
- bool
IsSavingEnabled
public bool IsSavingEnabled { get; set; }
Property Value
- bool
IsValueTextEnabled
public bool IsValueTextEnabled { get; set; }
Property Value
- bool
IsWholeNumbers
public bool IsWholeNumbers { get; set; }
Property Value
- bool
MaxValue
Maximum allowed value.
public float MaxValue { get; set; }
Property Value
- float
MinValue
Minimum allowed value.
public float MinValue { get; set; }
Property Value
- float
NormalizedValue
Value normalized to [0..1] considering MinValue, MaxValue and IsWholeNumbers.
public virtual float NormalizedValue { get; set; }
Property Value
- float
ReverseValue
public bool ReverseValue { get; set; }
Property Value
- bool
Value
Current slider value in real units.
public float Value { get; set; }
Property Value
- float
ValueText
public string ValueText { get; }
Property Value
- string
_stepSize
protected float _stepSize { get; }
Property Value
- float
Methods
FindSelectableOnDown()
Find the selectable object below this one.
public override Selectable FindSelectableOnDown()
Returns
- Selectable
FindSelectableOnLeft()
Find the selectable object to the left of this one.
public override Selectable FindSelectableOnLeft()
Returns
- Selectable
FindSelectableOnRight()
Find the selectable object to the right of this one.
public override Selectable FindSelectableOnRight()
Returns
- Selectable
FindSelectableOnUp()
The Selectable object above current
public override Selectable FindSelectableOnUp()
Returns
- Selectable
ForceUpdateVisuals()
Force-update the slider. Useful if you've changed the properties and want it to update visually.
protected void ForceUpdateVisuals()
HandleSliderMouseInput(PointerEventData, bool)
protected abstract void HandleSliderMouseInput(PointerEventData eventData, bool isValueClamped)
Parameters
eventDataPointerEventDataisValueClampedbool
HasValueChanged()
protected virtual bool HasValueChanged()
Returns
- bool
Initialize()
protected virtual void Initialize()
LoadState()
public void LoadState()
OnDisable()
protected override void OnDisable()
OnEnable()
protected override void OnEnable()
OnPointerEnter(PointerEventData)
Evaluate current state and transition to appropriate state. New state could be pressed or hover depending on pressed state.
public override void OnPointerEnter(PointerEventData eventData)
Parameters
eventDataPointerEventData
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;// Required when using Event data.
public class ExampleClass : MonoBehaviour, IPointerEnterHandler// required interface when using the OnPointerEnter method.
{
//Do this when the cursor enters the rect area of this selectable UI object.
public void OnPointerEnter(PointerEventData eventData)
{
Debug.Log("The cursor entered the selectable UI element.");
}
}
OnPointerExit(PointerEventData)
Evaluate current state and transition to normal state.
public override void OnPointerExit(PointerEventData eventData)
Parameters
eventDataPointerEventData
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;// Required when using Event data.
public class ExampleClass : MonoBehaviour, IPointerExitHandler// required interface when using the OnPointerExit method.
{
//Do this when the cursor exits the rect area of this selectable UI object.
public void OnPointerExit(PointerEventData eventData)
{
Debug.Log("The cursor exited the selectable UI element.");
}
}
OnRectTransformDimensionsChange()
This callback is called when the dimensions of an associated RectTransform change. It is always called before Awake, OnEnable, or Start. The call is also made to all child RectTransforms, regardless of whether their dimensions change (which depends on how they are anchored).
protected override void OnRectTransformDimensionsChange()
SaveState()
public void SaveState()
SetActiveInputField(bool)
public virtual void SetActiveInputField(bool isEnabled)
Parameters
isEnabledbool
SetActiveValueTextLabel(bool)
public virtual void SetActiveValueTextLabel(bool isEnabled)
Parameters
isEnabledbool
SetFillImage()
protected virtual void SetFillImage()
SetHandlePosition()
protected abstract void SetHandlePosition()
SetInputFieldValue(string)
public virtual void SetInputFieldValue(string inputValue)
Parameters
inputValuestring
SetOrigin()
protected abstract void SetOrigin()
SetValue(float, bool)
protected virtual void SetValue(float input, bool sendCallback = true)
Parameters
inputfloatsendCallbackbool
SetValueText()
protected virtual void SetValueText()
Start()
protected override void Start()
UpdateInputField()
protected virtual void UpdateInputField()
UpdateInputFieldListener()
protected virtual void UpdateInputFieldListener()
UpdateTextAutoSize()
protected virtual void UpdateTextAutoSize()
UpdateVisuals()
protected virtual void UpdateVisuals()