Class ModSliderOption.SliderValue
Component for customizing slider's value behaviour.
If you need more complex behaviour than just custom value format then you can inherit this component
and add it to "Slider" game object in OnGameObjectCreated event (see AddToPanel(uGUI_TabbedControlsPanel, int) for details on adding component)
You can override value converters ConvertToDisplayValue(float) and ConvertToSliderValue(float),
in that case internal range for slider will be changed to [0.0f : 1.0f] and you can control displayed value with these converters
(also this value will be passed to OnChange<T, E>(string, T) event)
public class ModSliderOption.SliderValue : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourModSliderOption.SliderValue
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.Internal_CancelInvokeAll(MonoBehaviour)MonoBehaviour.Internal_IsInvokingAll(MonoBehaviour)MonoBehaviour.IsObjectMonoBehaviour(Object)MonoBehaviour.StopCoroutineManaged(Coroutine)MonoBehaviour.GetScriptClassName()MonoBehaviour.useGUILayoutBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.transformComponent.gameObjectComponent.tagObject.m_CachedPtrObject.OffsetOfInstanceIDInCPlusPlusObjectObject.objectIsNullMessageObject.cloneDestroyedMessageObject.GetInstanceID()Object.GetHashCode()Object.CompareBaseObjects(Object, Object)Object.EnsureRunningOnMainThread()Object.IsNativeObjectAlive(Object)Object.GetCachedPtr()Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectOfType<T>()Object.ToString()Object.GetOffsetOfInstanceIDInCPlusPlusObject()Object.CurrentThreadIsMainThread()Object.Internal_CloneSingle(Object)Object.Internal_InstantiateSingle(Object, Vector3, Quaternion)Object.Internal_InstantiateSingleWithParent(Object, Transform, Vector3, Quaternion)Object.ToString(Object)Object.GetName(Object)Object.IsPersistent(Object)Object.Internal_InstantiateSingle_Injected(Object, ref Vector3, ref Quaternion)Object.Internal_InstantiateSingleWithParent_Injected(Object, Transform, ref Vector3, ref Quaternion)Object.nameObject.hideFlags
- Extension Methods
Fields
label
The value label of the ModSliderOption.SliderValue
protected TextMeshProUGUI label
Field Value
- TextMeshProUGUI
maxValue
The maximum value of the ModSliderOption.SliderValue.
In case of custom value converters it can be not equal to internal maximum value for slider
protected float maxValue
Field Value
minValue
The minimum value of the ModSliderOption.SliderValue.
In case of custom value converters it can be not equal to internal minimum value for slider
protected float minValue
Field Value
slider
The slider controlling this ModSliderOption.SliderValue
protected Slider slider
Field Value
- Slider
valueFormat
Custom value format
protected string valueFormat
Field Value
Properties
ValueFormat
Custom value format property. Set it right after adding component to game object for proper behaviour
public string ValueFormat { get; set; }
Property Value
ValueWidth
Width for value text field. Used by ModSliderOption.SliderOptionAdjust to adjust label width.
It is calculated in UpdateValueWidth(), but you can override this property.
public virtual float ValueWidth { get; protected set; }
Property Value
Methods
Awake()
Component initialization. If you overriding this, make sure that you calling base.Awake()
protected virtual void Awake()
ConvertToDisplayValue(float)
Converts internal slider value [0.0f : 1.0f] to displayed value
public virtual float ConvertToDisplayValue(float sliderValue)
Parameters
sliderValue
float
Returns
ConvertToSliderValue(float)
Converts displayed value to internal slider value [0.0f : 1.0f]
public virtual float ConvertToSliderValue(float displayValue)
Parameters
displayValue
float
Returns
InitConverters()
Override this if you need to initialize custom value converters
protected virtual void InitConverters()
OnValueChanged(float)
Called when user changes slider value
protected virtual void OnValueChanged(float value)
Parameters
value
float
Start()
UnityEngine.MonoBehaviour.Start()
protected virtual IEnumerator Start()
Returns
UpdateLabel()
Updates label's text with formatted and converted slider's value.
Override this if you need even more control on slider's value behaviour.
protected virtual void UpdateLabel()
UpdateValueWidth()
Method for calculating necessary label's width. Creates temporary label and compares widths of min and max values,
then sets ValueWidth to the wider. Be aware that in case of using custom converters some intermediate value may be wider than min/max values.
protected virtual IEnumerator UpdateValueWidth()