This commit is contained in:
Peter Cottle 2013-01-12 00:18:57 -08:00
parent 895d186b36
commit 0b81e90137
4 changed files with 186 additions and 54 deletions

View file

@ -11,6 +11,7 @@ exports.dialog = [{
' * Enter the series of git commands that compose the (optimal) solution',
' * Define the goal tree with ```define goal```. Defining the goal also defines the solution',
' * Optionally define a hint with ```define hint```',
' * Edit the name with ```define name```',
' * Optionally define a nice start dialog with ```edit dialog```',
' * Enter the command ```finish``` to output your level JSON!'
]

View file

@ -26,6 +26,7 @@ var MarkdownGrabber = require('../views/builderViews').MarkdownGrabber;
var regexMap = {
'define goal': /^define goal$/,
'define name': /^define name$/,
'help builder': /^help builder$/,
'define start': /^define start$/,
'edit dialog': /^edit dialog$/,
@ -204,6 +205,11 @@ var LevelBuilder = Level.extend({
this.showGoal(command, deferred);
},
defineName: function(command, deferred) {
this.level.name = prompt('Enter the name for the level');
if (command) { command.finishWith(deferred); }
},
defineHint: function(command, deferred) {
this.level.hint = prompt('Enter a hint! Or blank if you dont want one');
if (command) { command.finishWith(deferred); }
@ -240,6 +246,10 @@ var LevelBuilder = Level.extend({
return;
}
while (!this.level.name) {
this.defineName();
}
var masterDeferred = Q.defer();
var chain = masterDeferred.promise;