code-dot-org/blockly — pull request #510 by cpirich (2014-04-22 00:36:39+00:00)
Title: [Continues 68414526]: add sayQueues per event handler, fix hardcourt skin bug

We may be able to get away without adding a "wait" block yet...

The goal is that when you place a "say" block right after another "say" block, they run more in series than in parallel - meaning that it looks like a conversation. But, we know that we can't block inside the say command for 3 seconds. And we don't want to create a single global queues of "say" commands across the entire app because some "say" commands should popup instantly in response to distinct events.

So, the solution is a bit of a hybrid. We create a separate queue for each event handler that runs. "say" commands get pushed onto the associated queue with tick counts based on when they should appear on the screen (which depends on what else is in the queue). Then all of the display for the "say" speech bubbles moves into the onTick function, where we scan the queues and remove any pending say commands with tick counts that indicate they are ready to be displayed.

Seems to work reasonably well, but we will need to play with it more. It's unclear if this logic is really unique to the say command, but we'll try it only there for now.