mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
level 1
This commit is contained in:
parent
895d186b36
commit
0b81e90137
4 changed files with 186 additions and 54 deletions
|
@ -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!'
|
||||
]
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue