13
« on: March 04, 2014, 04:45:23 PM »
Most of the cases where I've run into this involve multiple buttons in the same dialog, or somebody accidentally clicking a button with multiple fingers. In those cases, I only want to handle the first input (if they're simultaneous, I'm fine with NGUI deciding which is the "first"), and then get rid of the dialog. I'm not bothering with any transitions at the moment, I just destroy the GameObject. Most of my input handlers make use of that fact by starting with a simple, if odd looking, "if (this == null)" and an early return. You could just as easily have some state flag that gets set when you start a transition to remove the dialog, and have your event handlers check that state.
It can be a pain to have to remember to write those checks, but I'm actually with Michael on this. If and when your game needs these restrictions, you should add it yourself. UICamera shouldn't have to know anything about the transitions your UI is making or whether specific objects are interested in hearing about events that have occurred, because that's going to vary wildly based on the application and the developer's coding style. You might be able to set up a flag on UIPanel that does what you want and could be checked quickly enough to not impact performance for everyone, but this seems clumsy to me. Maybe one button should be able to receive multiple clicks, but another should only be clickable once. (EventDelegate does allow you to add one-shot delegates, btw.) What if I want my widgets to still respond to mouseovers during a transition but not clicks? Or only certain widgets should respond but not others? Or I have multiple panels in a single dialog? There's no one right solution here, it's just one of those tedious things you have to do yourself.