Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: leegod on August 15, 2014, 03:04:06 AM
Title:
When UIEvent Trigger's [On Deselect] called?
Post by:
leegod
on
August 15, 2014, 03:04:06 AM
What I want is, I have 6 UIButtons, if I touch one of them, its tween color start ping pong and shows its now selected.
And if I touch another button, previous button's tween color effect should be turn off and new touched button's tween color effect should start.
So I added UIEventTrigger and set tween color sprite to 'On Select'.
But I don't know how to stop this when click another button.
Title:
Re: When UIEvent Trigger's [On Deselect] called?
Post by:
ArenMook
on
August 15, 2014, 07:45:34 AM
You can just examine that short script's code to answer this question.
void
OnSelect
(
bool
selected
)
{
if
(
current
!=
null
)
return
;
current
=
this
;
if
(
selected
)
EventDelegate
.
Execute
(
onSelect
)
;
else
EventDelegate
.
Execute
(
onDeselect
)
;
current
=
null
;
}