Author Topic: What is the best way for to do....  (Read 14765 times)

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
What is the best way for to do....
« on: August 22, 2014, 12:13:09 PM »
I have this situation :
1) First scene where there are some button : play, option, info etc
2) If I click on play button I must go to the worlds choice screen
3) If I click on one world button I must go to levels choice the screen
4) If I click on one level button the game must start

The question is : what is the best way for to do this with NGUI ?
a) 4 scene with 4 ui root and call Application.levelload ?
b) 1 scene with 1 ui root and 4 Panel and enable / disable every panel for change the scene
c) There is another way ?



Thank you

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #1 on: August 23, 2014, 01:37:30 AM »
Aren please help me, there are not video tutorial or documentation for this question.

Thank you

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #2 on: August 23, 2014, 03:21:21 AM »
One scene, one root, 4 panels. Enable/disable them as needed. That's what I do for both Windward and Starlink, and what you see in the Starlink UI kit. Starlink UI kit has a window manager system that automatically handles opening/hiding of windows and stores history for easy GoBack() logic. UIWindow.Show(panel) will automatically hide the current and will open the chosen one. UIWindow.GoBack() will hide the 'panel' and go back to the previous. Handy tool. I recently re-used it in Windward almost without modifications.

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #3 on: August 25, 2014, 02:41:13 AM »
...Starlink UI kit has a window manager system that automatically handles opening/hiding of windows and stores history for easy GoBack() logic. UIWindow.Show(panel) will automatically hide the current and will open the chosen one. UIWindow.GoBack() will hide the 'panel' and go back to the previous. Handy tool. I recently re-used it in Windward almost without modifications.

I can ask you why you have not inserted into the editor the option for reenable the tweens ? Because now when you show an menu with tweens if I click on one button with UIPlay Tween component you can choose "Play direction : reverse" but you must also reenable the tweens via script...would be nice reverse the tweens to the original state (if they were active They must return active... )
« Last Edit: August 25, 2014, 02:50:29 AM by mimmog »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #4 on: August 26, 2014, 01:41:29 AM »
What do you mean? UIPlayTween has an option of what to do if the target object is disabled. Enabling is one of the options.

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #5 on: August 26, 2014, 02:10:50 AM »
What do you mean? UIPlayTween has an option of what to do if the target object is disabled. Enabling is one of the options.

Ok but the target's tweens must be reenabled and resetted (Toggle, ToBeginning) via script...or I wrong something ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #6 on: August 26, 2014, 03:31:25 AM »
What happens with the tween is also chosen on UIPlayTween. Resetting it to beginning is one of the options.

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #7 on: August 26, 2014, 08:29:13 AM »
No, I set Player Tween like this :
- Tween Target (insert gameobject menu showed)
- Include children : No (if I set yes the menu showed is not disabled after reverse)
- Trigger Condition : On Click
- Play direction : Reverse
- if target is disabled : Enable Then Play
- If already playing : Continue
- When finished : Disable After Reverse

but the tweens was disabled and not coming back to active...I must call via script Toggle o toBeginner....why ?
« Last Edit: August 26, 2014, 08:35:49 AM by mimmog »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #8 on: August 27, 2014, 04:00:12 AM »
You chose "if already playing - continue". Once it gets to the beginning (in your case, since you chose reverse), it will stay there. You need to choose "restart if not playing".

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #9 on: August 29, 2014, 04:38:40 AM »
Not work...

I have an button child of MainMenu that contain "Tween Scale"

This is UI Play Tween attached to button :

- Tween Target : MainMenu
- Include children : No
- Trigger Condition : On Click
- Play direction : Reverse
- if target is disabled : Enable Then Play
- If already playing : Restart if not playing (like you said me)
- When finished : Disable After Reverse

When I click the button the MainMenu is disabled but also Tween Scale! (instead should be reenabled) Then, now with "restart if not playing", the tween reverse not work because the gameobject is disabled immediately not when the tween finish....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #10 on: August 30, 2014, 08:56:34 AM »
Does it work fine if the direction is Forward instead?

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #11 on: September 01, 2014, 04:32:17 AM »
Does it work fine if the direction is Forward instead?
No, it not work fine also if the direction is Forward...but it's always been like this I always had to use the script for disable the menu and the tweens....I have also created another simple project with a base menu but not work...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #12 on: September 01, 2014, 02:15:44 PM »
I tried a simple case.

1. New scene.
2. Two sprites, one with a TweenColor on it that makes the sprite red. Another sprite has a UIPlayTween on it and a collider.
3. The UIPlayTween references the object with the TweenColor on it.
4. TweenColor is turned off -- both the tween is disabled in inspector, and the game object.
5. UIPlayTween is set to play OnClick, enable if disabled, and restart if finished.
6. Now I hit Play, click on the sprite with the UIPlayTween on it. The color of the second sprite changes smoothly, then the sprite gets disabled. I click again, the sprite gets re-enabled, and the tween works as expected. I click many times, the tween does not restart while it's running.

Everything works as expected. What are you doing differently?

mimmog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: What is the best way for to do....
« Reply #13 on: September 02, 2014, 08:26:22 AM »
Ok but this is the situation :

1. New scene.
2. Two sprites, one with a TweenColor on it that makes the sprite red. Another sprite has a UIPlayTween on it and a collider.
3. The UIPlayTween references the object with the TweenColor on it.
4. TweenColor is turned ON and GameObject is enabled and visible
5. UIPlayTween is set to play OnClick, Play Direction REVERSE, If target is disabled ENABLE THEN PLAY, If already playing RESTART IF NOT PLAYING and When finished DISABLE AFTER REVERSE.
6. Now I hit Play, the color of sprite changes automatically to red, click on the sprite with the UIPlayTween but the tween not reverse and the red sprite is disabled before the tween reverse start...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the best way for to do....
« Reply #14 on: September 02, 2014, 12:32:31 PM »
I may have a solution, but I will need more time to test its effects -- meaning I need to be home first. I'm currently on vacation, meaning away from my main PC.