Pseudo-blocking ask block for Play Lab#9749
Merged
Merged
Conversation
| var cmd = handler.cmdQueue[0]; | ||
| if (cmd && cmd.name === 'moveDistance' && cmd.opts.spriteIndex === index) { | ||
| var distThisMove = Math.min(cmd.opts.queuedDistance, | ||
| var distThisMove = Math.min(cmd.opts.queuedDistance || Infinity, |
Contributor
Author
There was a problem hiding this comment.
I don't fully understand why this is needed, but cmd.opts.queuedDistance is occasionally undefined and Math.min(undefined, 2) is NaN.
Contributor
|
couple comments, but otherwise LGTM! Far less complexity than I expected for such a feature; very elegantly done. |
Contributor
Author
|
TODO:
|
| }; | ||
|
|
||
| Studio.hideInputPrompt = function () { | ||
| // To be overriden when the prompt is displayed. |
Contributor
There was a problem hiding this comment.
Given that we (presumably) only ever want one prompt shown at once, what about if askForInput does something like Studio.inputPrompt = target (after perhaps checking to make sure that it isn't already assigned), and this method references and clears that variable?
Contributor
|
LGTM after comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change builds on PR #9610 to use an input prompt that shows up in the play space instead of the browser's modal
prompt()dialog.Before, we got blocking for free because
prompt()stops JavaScript execution until the user enters a value. With this change, we must alter code generation to place all subsequent blocks inside a callback after an "ask" block.A new
askCallbackevent queue is created in order for the callback to execute as part of the Play Lab command queue.