NGUI: Next-Gen UI kit  3.7.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
UIButton Class Reference

Similar to UIButtonColor, but adds a 'disabled' state based on whether the collider is enabled or not. More...

Inheritance diagram for UIButton:
UIButtonColor UIWidgetContainer

Public Member Functions

override void SetState (State state, bool immediate)
 Change the visual state. More...
 
- Public Member Functions inherited from UIButtonColor
void ResetDefaultColor ()
 Reset the default color to what the button started with. More...
 
void UpdateColor (bool instant)
 Update the button's color. Call this method after changing the colors of the button at run-time. More...
 

Public Attributes

bool dragHighlight = false
 Whether the button will highlight when you drag something over it. More...
 
string hoverSprite
 Name of the hover state sprite. More...
 
string pressedSprite
 Name of the pressed sprite. More...
 
string disabledSprite
 Name of the disabled sprite. More...
 
UnityEngine.Sprite hoverSprite2D
 Name of the hover state sprite. More...
 
UnityEngine.Sprite pressedSprite2D
 Name of the pressed sprite. More...
 
UnityEngine.Sprite disabledSprite2D
 Name of the disabled sprite. More...
 
bool pixelSnap = false
 Whether the sprite changes will elicit a call to MakePixelPerfect() or not. More...
 
List< EventDelegateonClick = new List<EventDelegate>()
 Click event listener. More...
 
- Public Attributes inherited from UIButtonColor
GameObject tweenTarget
 Target with a widget, renderer, or light that will have its color tweened. More...
 
Color hover = new Color(225f / 255f, 200f / 255f, 150f / 255f, 1f)
 Color to apply on hover event (mouse only). More...
 
Color pressed = new Color(183f / 255f, 163f / 255f, 123f / 255f, 1f)
 Color to apply on the pressed event. More...
 
Color disabledColor = Color.grey
 Color that will be applied when the button is disabled. More...
 
float duration = 0.2f
 Duration of the tween process. More...
 

Static Public Attributes

static UIButton current
 Current button that sent out the onClick event. More...
 

Protected Member Functions

override void OnInit ()
 Cache the sprite we'll be working with. More...
 
override void OnEnable ()
 Set the initial state. More...
 
override void OnDragOver ()
 Drag over state logic is a bit different for the button. More...
 
override void OnDragOut ()
 Drag out state logic is a bit different for the button. More...
 
virtual void OnClick ()
 Call the listener function. More...
 
void SetSprite (string sp)
 Convenience function that changes the sprite. More...
 
void SetSprite (UnityEngine.Sprite sp)
 Convenience function that changes the sprite. More...
 
- Protected Member Functions inherited from UIButtonColor
virtual void OnDisable ()
 Reset the initial state. More...
 
virtual void OnHover (bool isOver)
 Set the hover state. More...
 
virtual void OnPress (bool isPressed)
 Set the pressed state. More...
 
virtual void OnSelect (bool isSelected)
 Set the selected state. More...
 

Properties

override bool isEnabled [get, set]
 Whether the button should be enabled. More...
 
string normalSprite [get, set]
 Convenience function that changes the normal sprite. More...
 
UnityEngine.Sprite normalSprite2D [get, set]
 Convenience function that changes the normal sprite. More...
 
- Properties inherited from UIButtonColor
State state [get, set]
 Button's current state. More...
 
Color defaultColor [get, set]
 UIButtonColor's default (starting) color. It's useful to be able to change it, just in case. More...
 
virtual bool isEnabled [get, set]
 Whether the script should be active or not. More...
 

Additional Inherited Members

- Public Types inherited from UIButtonColor
enum  State { State.Normal, State.Hover, State.Pressed, State.Disabled }
 
- Protected Attributes inherited from UIButtonColor
Color mStartingColor
 
Color mDefaultColor
 
bool mInitDone = false
 
UIWidget mWidget
 
State mState = State.Normal
 

Detailed Description

Similar to UIButtonColor, but adds a 'disabled' state based on whether the collider is enabled or not.

Member Function Documentation

virtual void UIButton.OnClick ( )
protectedvirtual

Call the listener function.

override void UIButton.OnDragOut ( )
protectedvirtual

Drag out state logic is a bit different for the button.

Reimplemented from UIButtonColor.

override void UIButton.OnDragOver ( )
protectedvirtual

Drag over state logic is a bit different for the button.

Reimplemented from UIButtonColor.

override void UIButton.OnEnable ( )
protectedvirtual

Set the initial state.

Reimplemented from UIButtonColor.

override void UIButton.OnInit ( )
protectedvirtual

Cache the sprite we'll be working with.

Reimplemented from UIButtonColor.

void UIButton.SetSprite ( string  sp)
protected

Convenience function that changes the sprite.

void UIButton.SetSprite ( UnityEngine.Sprite  sp)
protected

Convenience function that changes the sprite.

override void UIButton.SetState ( State  state,
bool  immediate 
)
virtual

Change the visual state.

Reimplemented from UIButtonColor.

Member Data Documentation

UIButton UIButton.current
static

Current button that sent out the onClick event.

string UIButton.disabledSprite

Name of the disabled sprite.

UnityEngine.Sprite UIButton.disabledSprite2D

Name of the disabled sprite.

bool UIButton.dragHighlight = false

Whether the button will highlight when you drag something over it.

string UIButton.hoverSprite

Name of the hover state sprite.

UnityEngine.Sprite UIButton.hoverSprite2D

Name of the hover state sprite.

List<EventDelegate> UIButton.onClick = new List<EventDelegate>()

Click event listener.

bool UIButton.pixelSnap = false

Whether the sprite changes will elicit a call to MakePixelPerfect() or not.

string UIButton.pressedSprite

Name of the pressed sprite.

UnityEngine.Sprite UIButton.pressedSprite2D

Name of the pressed sprite.

Property Documentation

override bool UIButton.isEnabled
getset

Whether the button should be enabled.

string UIButton.normalSprite
getset

Convenience function that changes the normal sprite.

UnityEngine.Sprite UIButton.normalSprite2D
getset

Convenience function that changes the normal sprite.


The documentation for this class was generated from the following file: