Author Topic: nested UITable and delegate function in UI'S  (Read 1667 times)

nospam94

  • Guest
nested UITable and delegate function in UI'S
« on: May 15, 2013, 02:47:19 AM »
Hi,

i was playing with UITable (nested) and i manage to do the job (for nested) with propagation of repositionNow in uitables parent of the uitable that had it's var reposition now to true; it was quite simple so it could be add in next release.

Next, i was playing with Tweener and UIButtonTween (in quest log demo) and i wanted to change the sprite of the uiButtonTween when tween is finished. so i create a script and register a delegate for tween.onFinished but it didn't work because UIButtonTween do this :

  1. // Set the delegate
  2. tw.onFinished = onFinished;

I think i would be better if we put instead :
  1. // Set the delegate
  2. tw.onFinished += onFinished;

so we can have multiple receivers...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: nested UITable and delegate function in UI'S
« Reply #1 on: May 15, 2013, 11:47:52 AM »
Can't do that as-is, as it will cause callbacks to be cumulative whether you want it or not.

nospam94

  • Guest
Re: nested UITable and delegate function in UI'S
« Reply #2 on: May 17, 2013, 12:27:13 AM »
Hi

I don't understand. if you have two UI that need to talk to a third common UI, you can't (or you shouldn't).
So one UI should tell second UI what third UI is expected to do. Or you need to rewrite all UIs if you want to avoid this ?

when using NGUI, i try to avoid modification of UI because file doesn't have versioning number so you have to use file comparator to see if it has been modified. Even readme.txt has bad version number...

in UIbuttonTween, onFinished is registered to the tween onFinished even if it's null (undefined) so i think it's hazardous

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: nested UITable and delegate function in UI'S
« Reply #3 on: May 17, 2013, 01:29:20 AM »
You need to follow NGUI's updating instructions from the readme file and it will always show the correct version.

Write a script to do multiple things if you need to do multiple things, and trigger this script's function.