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

Simple example script of how a button can be colored when the mouse hovers over it or it gets pressed. More...

Inheritance diagram for UIButtonColor:
UIWidgetContainer UIButton

Public Types

enum  State { State.Normal, State.Hover, State.Pressed, State.Disabled }
 

Public Member Functions

void ResetDefaultColor ()
 Reset the default color to what the button started with. More...
 
virtual void SetState (State state, bool instant)
 Change the visual state. 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

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...
 

Protected Member Functions

virtual void OnInit ()
 
virtual void OnEnable ()
 Set the initial state. More...
 
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 OnDragOver ()
 Set the pressed state on drag over. More...
 
virtual void OnDragOut ()
 Set the normal state on drag out. More...
 
virtual void OnSelect (bool isSelected)
 Set the selected state. More...
 

Protected Attributes

Color mStartingColor
 
Color mDefaultColor
 
bool mInitDone = false
 
UIWidget mWidget
 
State mState = State.Normal
 

Properties

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...
 

Detailed Description

Simple example script of how a button can be colored when the mouse hovers over it or it gets pressed.

Member Enumeration Documentation

Enumerator
Normal 
Hover 
Pressed 
Disabled 

Member Function Documentation

virtual void UIButtonColor.OnDisable ( )
protectedvirtual

Reset the initial state.

virtual void UIButtonColor.OnDragOut ( )
protectedvirtual

Set the normal state on drag out.

Reimplemented in UIButton.

virtual void UIButtonColor.OnDragOver ( )
protectedvirtual

Set the pressed state on drag over.

Reimplemented in UIButton.

virtual void UIButtonColor.OnEnable ( )
protectedvirtual

Set the initial state.

Reimplemented in UIButton.

virtual void UIButtonColor.OnHover ( bool  isOver)
protectedvirtual

Set the hover state.

virtual void UIButtonColor.OnInit ( )
protectedvirtual

Reimplemented in UIButton.

virtual void UIButtonColor.OnPress ( bool  isPressed)
protectedvirtual

Set the pressed state.

virtual void UIButtonColor.OnSelect ( bool  isSelected)
protectedvirtual

Set the selected state.

void UIButtonColor.ResetDefaultColor ( )

Reset the default color to what the button started with.

virtual void UIButtonColor.SetState ( State  state,
bool  instant 
)
virtual

Change the visual state.

Reimplemented in UIButton.

void UIButtonColor.UpdateColor ( bool  instant)

Update the button's color. Call this method after changing the colors of the button at run-time.

Member Data Documentation

Color UIButtonColor.disabledColor = Color.grey

Color that will be applied when the button is disabled.

float UIButtonColor.duration = 0.2f

Duration of the tween process.

Color UIButtonColor.hover = new Color(225f / 255f, 200f / 255f, 150f / 255f, 1f)

Color to apply on hover event (mouse only).

Color UIButtonColor.mDefaultColor
protected
bool UIButtonColor.mInitDone = false
protected
Color UIButtonColor.mStartingColor
protected
State UIButtonColor.mState = State.Normal
protected
UIWidget UIButtonColor.mWidget
protected
Color UIButtonColor.pressed = new Color(183f / 255f, 163f / 255f, 123f / 255f, 1f)

Color to apply on the pressed event.

GameObject UIButtonColor.tweenTarget

Target with a widget, renderer, or light that will have its color tweened.

Property Documentation

Color UIButtonColor.defaultColor
getset

UIButtonColor's default (starting) color. It's useful to be able to change it, just in case.

virtual bool UIButtonColor.isEnabled
getset

Whether the script should be active or not.

State UIButtonColor.state
getset

Button's current state.


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