Home › Page › UghToggle

UghToggle

Revision for “UghToggle” created on 4 September, 2013 @ 15:07 [Autosave]

Title
UghToggle
Content
Inherits from <a title="UghControl" href="http://ugh.graveck.com/?incsub_wiki=ughcontrol">UghControl</a> An UghToggle is a button that changes state. When it changes state, its parent UghPublisher (if it is used with one) runs the command function associated with it. It can be used on its own by registering for the OnChanged and/or OnDown events. [table caption="Variables" colwidth=20%|20%] name, type, description HighlightState, boolean, normalPressed,UghSpritePrototype, on,UghSpritePrototype, onPressed,UghSpritePrototype, State, boolean, [/table] [table caption="Functions" colwidth=20%|20%] name, type, description OnChanged, event, Fires when the state of the toggle changes from true to false. OnDown, event, Fires when the finger or mouse presses down on the toggle. OnUghInputDown, IEnumerator,Called at the same time as OnDown. OnUghInputUp, void,Called when the mouse or finger drags off this button OnUghInputAsButton, void,Called when the mouse stops clicking or a finger lifts up when over this button [/table] [table caption="Inherited Variables" colwidth=20%|20%] name, type, description anchor,<a title="UghSprite.Anchor" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughsprite/anchor">UghSprite</a>.Anchor, The corner or custom point that the UghControl is anchored to customAnchorOffset, Vector3, The offset values for a custom anchor flippedHorizontal, boolean, Is the UghSprite flipped horizonally? flippedVertical, boolean, Is the UghSprite flipped vertically? HotFingerID, int, The ID of the finger interacting with this control isLegalControl, boolean, Is this a legal control? normal,<a title="UghSpriteDefinition" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughspritedefinition">UghSpriteDefinition</a>, The default UghSpriteDefinition for this button Prototype,<a title="UghSpritePrototype" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughspriteprototype-2">UghSpritePrototype</a>, The current UghSpritePrototype for this button Offset, Vector3, The offset of the UghSprite [/table] [table caption="Inherited Functions" colwidth=20%|20%] name, type, description GetLocalCenter, Vector3, Returns the local center of the UghControl GetLocalOrigin, Vector3, Returns the local origin of the UghControl GetParentPublisher,<a title="UghPublisher" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughpublisher">UghPublisher</a>, "Returns the UghPublisher which this UghControl belongs to, or null if none" UpdateMesh, void, Updates this control's mesh [/table] [table caption="Inherited Class Variables" colwidth=20%|20%] name, type, description Anchor, enum, Enum for different common anchor positions AnchorToTextAnchor, TextAnchor, Converts an Anchor enum into a TextAnchor enum TextAnchorToAnchor,<a title="UghSprite" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughsprite">UghSprite</a>.Anchor, Converts a TextAnchor enum into an Anchor enum theOnlyLegalControls,<a title="UghControl" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughcontrol">UghControl</a>[], Array of all currently legal controls [/table] [table caption="Inherited Class Functions" colwidth=20%|20%] name, type, description ForceUpdateAllUghSpriteMeshes, void, Forces every UghSprite's mesh to update GetOffsetForAnchor, Vector3, Returns the Vector3 offset for a given Anchor value [/table] _ <strong>Using UghToggle in script</strong> UghToggle is used similarly to an UghButton and setting one up in the inspector can be seen <span style="text-decoration: underline;">here</span> if you need. Additionally to inheriting the following function from UghControl: [sourcecode language="Csharp"] public override IEnumerator OnUghInputDown(); public override void OnUghInputUp(); public override void OnUghInputUpAsButton(); [/sourcecode] UghToggle also has two events which you can listen for that are fired upon a change in its state, and when it is pressed down. [sourcecode language="csharp"] public event System.Action&lt;UghToggle,bool&gt; OnDown; public event Action&lt;UghToggle&gt; OnChanged; [/sourcecode] If you do not use an UghPublisher to manage your UghToggle, as with many other UghControls, you must register for the OnDown and/or the OnChanged events to know when the UghToggle has been interacted with.
Excerpt


OldNewDate CreatedAuthorActions
4 September, 2013 @ 15:07 [Autosave] admin
17 April, 2013 @ 18:38 admin
17 April, 2013 @ 18:37 admin
2 April, 2013 @ 15:28 admin
2 April, 2013 @ 15:23 admin
2 April, 2013 @ 15:21 admin
2 April, 2013 @ 14:58 admin
18 March, 2013 @ 20:59 admin
18 March, 2013 @ 20:56 admin
18 March, 2013 @ 17:35 admin
18 March, 2013 @ 17:30 admin
18 March, 2013 @ 17:29 admin
11 March, 2013 @ 17:38 admin
11 March, 2013 @ 17:38 admin
11 March, 2013 @ 17:34 admin
6 March, 2013 @ 21:52 admin
6 March, 2013 @ 21:52 admin