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.
  1.         void OnSelect (bool selected)
  2.         {
  3.                 if (current != null) return;
  4.                 current = this;
  5.                 if (selected) EventDelegate.Execute(onSelect);
  6.                 else EventDelegate.Execute(onDeselect);
  7.                 current = null;
  8.         }