Argh, my issue is a result of code required to mitigate the bugs with Touch object. One has to code manually to debounce it (necessarily using a global variable) or touch-triggered events are triggered multiple times.
For the case where I want to restart a layout (new game) I can debounce in a diff way, using button UI visability (this isn't always possible when managing touch events using multiple instances of identical sprites).
However this has revealed to me that what I'd really like is a new variable scope: layout variable. Or at the very least, to be able to set local variables for root events instead of globals.
There's no method to create a new instance of a layout; only a reset. This means one is almost always going to require a global variable reset to achieve a meaningful reset of the layout. So for the common situation where you need certain values to persist that can't be implemented as constants before the user makes choices (eg, number of players) one will have to use a data dictionary or something. I mean that's fine, but a) one won't know this at the design stage and b) its very inelegant, and begs the question, "why not use a data dictionary for everything that needs to persist?"
Not only that, but the likelihood that you'll need to reset global variables in order to meaningfully achieve a layout reset means that other layouts are necessarily affected, further forcing me to use a data dictionary for anything I need to persist. Surely that can't be considered optimal at any stage, design, code or run time?
This status quo implies the following issue I don't even have a solution for: how do allow a player to back out from a game into a menu, then start a new game? I can only code for a 'go to layout' action from the menu, which gives no option to reset the old state; and there's no event for 'on layout changed' to use as a basis for triggering a reset.
It seems to me that I am currently forced to manually include data dictionary storage and instance management for pretty much every aspect of every layout I might ever need to reset the state of. Please tell me this is not the case and I am a lunatic!