Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: TriplePAF on December 27, 2013, 05:06:56 PM

Title: NGUI "Example 3 - Menu" + Two Buttons or more Pressed Together
Post by: TriplePAF 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.   
Title: Re: NGUI "Example 3 - Menu" + Two Buttons or more Pressed Together
Post by: ArenMook 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.