Home › Page › UghSlider

UghSlider

Revision for “UghSlider” created on 9 April, 2013 @ 22:00

Title
UghSlider
Content
Inherits from <a title="UghControl" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughcontrol">UghControl</a> UghSlider is an UghControl that provides a track and thumb interface.  This is useful to represent a control that can be adjusted for a range of values.  Good examples include a control to adjust sound volume, or a timeline scrubber for a sound or animation.  The UghSlider represents the thumb object.  (Another UghSprite can be used to represent the track.) To setup an UghSlider, you must specify an UghSpriteDefinition for the normal and pressed variables, and then define the range of track in the visualWidthUnits variable.  You can read the current value of the UghSlider with the Current attribute.  If you want to respond to changes in the slider, register for the OnChanged event.  This event will get fired every frame that the thumb changes position. [table caption="Variables" colwidth="20%|20%"] name, type, description Current, float,The current value of the slider (as defined by the current thumb position and the limits variable.) CurrentNormalized, float,"The current position of the thumb along the slider, as a fractional value from 0 to 1. limits, Rangef,The range of values allowed for the UghSlider (ie 0-100 for volume). pressed,<a title="UghSpriteDefinition" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughspritedefinition">UghSpriteDefinition</a>, The sprite visible when the thumb is being dragged. visualWidthUnits, float,"The width of the track, in Unity units. [/table] [table caption="Functions" colwidth="20%|20%"] name, type, description OnChanged, event, An event fired whenever the position of the thumb has changed. [/table] _ <strong>Using UghSlider in script</strong> UghSlider inherits all of the same event functions as any UghControl: [sourcecode language="csharp"] public override IEnumerator OnUghInputDown(); public override void OnUghInputUp(); public override void OnUghInputUpAsButton(); [/sourcecode] These events fire under the same situations as an <a title="UghButton" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughbutton/">UghButton</a>, and an UghSlider behaves much like an UghButton that can be dragged along a track. There is also an event that gets fired off whenever an UghSlider's value is changed. You can register for this event in order to respond to changing values.  Note that the event is fired every frame that the UghSlider has changed position. [sourcecode language="csharp"] public event Action OnChanged; [/sourcecode] &nbsp;
Excerpt


OldNewDate CreatedAuthorActions
9 April, 2013 @ 22:00 admin
9 April, 2013 @ 22:00 [Autosave] admin
2 April, 2013 @ 15:28 admin
2 April, 2013 @ 15:24 admin
2 April, 2013 @ 15:24 admin
2 April, 2013 @ 15:10 admin
2 April, 2013 @ 14:24 admin
2 April, 2013 @ 14:10 admin
2 April, 2013 @ 14:09 admin
2 April, 2013 @ 14:09 admin
2 April, 2013 @ 13:54 admin
29 March, 2013 @ 19:50 admin
29 March, 2013 @ 19:50 admin
29 March, 2013 @ 19:48 admin
29 March, 2013 @ 19:41 admin
18 March, 2013 @ 20:25 admin
18 March, 2013 @ 16:46 admin
11 March, 2013 @ 20:52 admin
11 March, 2013 @ 20:41 admin
11 March, 2013 @ 17:53 admin
6 March, 2013 @ 21:52 admin
6 March, 2013 @ 21:52 admin