Author Topic: NGUI "Example 3 - Menu" + Two Buttons or more Pressed Together  (Read 3017 times)

TriplePAF

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
NGUI "Example 3 - Menu" + Two Buttons or more Pressed Together
« on: December 27, 2013, 05:06:56 PM »
Hello,

I started a while with the NGUI Menu 3 example for my current project. I'm trying make the menu kids proof. Apparently they like to press all buttons in a panel at once! ;)  If I press two buttons in a panel at once then the Panel Animation Object will be disabled by NGUI and there is a script left on it called: ActiveAnimation. My current workaround is to check the panel state before disabling it and if it's unfinished clean it like this:

  1. ActiveAnimation a = panelMainMenu.GetComponent <ActiveAnimation> ();
  2.                        
  3.                         if (a) {
  4.                                 Destroy(panelMainMenu.GetComponent <ActiveAnimation> ());
  5.                                 panelMainMenu.GetComponent <Animation> ().enabled = true;
  6.  
  7.                                 panelMainMenu.transform.position = Vector3.zero;
  8.                                 panelMainMenu.transform.localPosition = Vector3.zero;
  9.  
  10.                                 panelMainMenu.transform.rotation = Quaternion.identity;
  11.                                 panelMainMenu.transform.localRotation = Quaternion.identity;
  12.                         }


My Question is: How can I prevent the behaviour which set the panel in a inconsistent state after someone pressed two buttons or more at once in the same panel.   

It can be the easiest simulated on the iPad 3 in retina resolution. I'm using NGUI Version: 3.0.7 f3 from the Asset Store.

Kind regards,


Peter Fonk.   
« Last Edit: December 27, 2013, 05:18:28 PM by TriplePAF »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI "Example 3 - Menu" + Two Buttons or more Pressed Together
« Reply #1 on: December 28, 2013, 01:57:18 AM »
ActiveAnimation gets added after you use ActiveAnimation.Play, or UIPlayAnimation. This script is what makes it possible for animations to play unaffected by timescale (so in order words, UI animations will play even if the game is paused).

You shouldn't be moving the panel by adjusting its transform if you also have it move via the animation. It should be one or the other.