16
NGUI 3 Support / Addons to UILabel
« on: December 27, 2013, 05:42:15 AM »
Hello !
Currently on a slider, we can have a OnValueChange. If we drop a UILabel on this, we have some methods at disposal, such as UILabel.SetCurrentPercent.
It would be nice to have so more options here, such as SetCurrentValue and SetCurrentStepValue.
I added them on a different script that I attach to my label, but I think it would be nice to have them by default no ?
Currently on a slider, we can have a OnValueChange. If we drop a UILabel on this, we have some methods at disposal, such as UILabel.SetCurrentPercent.
It would be nice to have so more options here, such as SetCurrentValue and SetCurrentStepValue.
I added them on a different script that I attach to my label, but I think it would be nice to have them by default no ?
- public void setCurrentStepValue()
- {
- if (UIProgressBar.current != null)
- {
- m_label.text = (m_startingValue + Mathf.Round(UIProgressBar.current.value * (UIProgressBar.current.numberOfSteps - 1))).ToString();
- }
- }
- public void setCurrentValue()
- {
- if (UIProgressBar.current != null)
- {
- m_label.text = UIProgressBar.current.value.ToString("f1");
- }
- }