|
NGUI: Next-Gen UI kit
3.7.2
|
Simple example script of how a button can be colored when the mouse hovers over it or it gets pressed. More...
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... | |
Simple example script of how a button can be colored when the mouse hovers over it or it gets pressed.
| enum UIButtonColor.State |
|
protectedvirtual |
Reset the initial state.
|
protectedvirtual |
Set the normal state on drag out.
Reimplemented in UIButton.
|
protectedvirtual |
Set the pressed state on drag over.
Reimplemented in UIButton.
|
protectedvirtual |
Set the initial state.
Reimplemented in UIButton.
|
protectedvirtual |
Set the hover state.
|
protectedvirtual |
Reimplemented in UIButton.
|
protectedvirtual |
Set the pressed state.
|
protectedvirtual |
Set the selected state.
| void UIButtonColor.ResetDefaultColor | ( | ) |
Reset the default color to what the button started with.
|
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.
| 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).
|
protected |
|
protected |
|
protected |
|
protected |
|
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.
|
getset |
UIButtonColor's default (starting) color. It's useful to be able to change it, just in case.
|
getset |
Whether the script should be active or not.
|
getset |
Button's current state.