mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-15 17:14:25 +02:00
pretty much got finish down
This commit is contained in:
parent
0c7ff70b14
commit
9381f42509
7 changed files with 183 additions and 49 deletions
140
build/bundle.js
140
build/bundle.js
|
@ -4648,7 +4648,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
var whenBuilderOpen = Q.defer();
|
var whenBuilderOpen = Q.defer();
|
||||||
|
|
||||||
var LevelBuilder = require('../level/builder').LevelBuilder;
|
var LevelBuilder = require('../level/builder').LevelBuilder;
|
||||||
var levelBuilder = new LevelBuilder({
|
this.levelBuilder = new LevelBuilder({
|
||||||
deferred: whenBuilderOpen
|
deferred: whenBuilderOpen
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4727,6 +4727,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
|
|
||||||
reset: function(command, deferred) {
|
reset: function(command, deferred) {
|
||||||
this.mainVis.reset();
|
this.mainVis.reset();
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
command.finishWith(deferred);
|
command.finishWith(deferred);
|
||||||
}, this.mainVis.getAnimationTime());
|
}, this.mainVis.getAnimationTime());
|
||||||
|
@ -6593,10 +6594,7 @@ var Level = Sandbox.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
initGoalData: function(options) {
|
initGoalData: function(options) {
|
||||||
this.goalTreeString = this.level.goalTreeString;
|
if (!this.level.goalTreeString || !this.level.solutionCommand) {
|
||||||
this.solutionCommand = this.level.solutionCommand;
|
|
||||||
|
|
||||||
if (!this.goalTreeString || !this.solutionCommand) {
|
|
||||||
throw new Error('need goal tree and solution');
|
throw new Error('need goal tree and solution');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6638,7 +6636,7 @@ var Level = Sandbox.extend({
|
||||||
this.goalVis = new Visualization({
|
this.goalVis = new Visualization({
|
||||||
el: this.goalCanvasHolder.getCanvasLocation(),
|
el: this.goalCanvasHolder.getCanvasLocation(),
|
||||||
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
||||||
treeString: this.goalTreeString,
|
treeString: this.level.goalTreeString,
|
||||||
noKeyboardInput: true,
|
noKeyboardInput: true,
|
||||||
noClick: true
|
noClick: true
|
||||||
});
|
});
|
||||||
|
@ -6662,7 +6660,7 @@ var Level = Sandbox.extend({
|
||||||
// ok great add the solution command
|
// ok great add the solution command
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
'reset;' + this.solutionCommand
|
'reset;' + this.level.solutionCommand
|
||||||
);
|
);
|
||||||
this.hideGoal();
|
this.hideGoal();
|
||||||
command.setResult('Solution command added to the command queue...');
|
command.setResult('Solution command added to the command queue...');
|
||||||
|
@ -6773,7 +6771,7 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
// ok so lets see if they solved it...
|
// ok so lets see if they solved it...
|
||||||
var current = this.mainVis.gitEngine.exportTree();
|
var current = this.mainVis.gitEngine.exportTree();
|
||||||
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.goalTreeString);
|
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.level.goalTreeString);
|
||||||
|
|
||||||
if (!solved) {
|
if (!solved) {
|
||||||
defer.resolve();
|
defer.resolve();
|
||||||
|
@ -6856,6 +6854,11 @@ var Level = Sandbox.extend({
|
||||||
throw new Errors.CommandResult({
|
throw new Errors.CommandResult({
|
||||||
msg: hintMsg
|
msg: hintMsg
|
||||||
});
|
});
|
||||||
|
}],
|
||||||
|
[/^build level$/, function() {
|
||||||
|
throw new Errors.GitError({
|
||||||
|
msg: "You can't build a level inside a level! Please exit level first"
|
||||||
|
});
|
||||||
}]
|
}]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
@ -7103,6 +7106,10 @@ var Visualization = Backbone.View.extend({
|
||||||
this.setTreeOpacity(1);
|
this.setTreeOpacity(1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetFromThisTreeNow: function(treeString) {
|
||||||
|
this.treeString = treeString;
|
||||||
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.setTreeOpacity(0);
|
this.setTreeOpacity(0);
|
||||||
if (this.treeString) {
|
if (this.treeString) {
|
||||||
|
@ -13802,7 +13809,7 @@ GitVisuals.prototype.visBranchesFront = function() {
|
||||||
vBranch.textToFront();
|
vBranch.textToFront();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.visBranchCollection.each(function(visBranch) {
|
this.visBranchCollection.each(function(vBranch) {
|
||||||
vBranch.textToFrontIfInStack();
|
vBranch.textToFrontIfInStack();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -16510,7 +16517,8 @@ var regexMap = {
|
||||||
'define goal': /^define goal$/,
|
'define goal': /^define goal$/,
|
||||||
'define start': /^define start$/,
|
'define start': /^define start$/,
|
||||||
'show start': /^show start$/,
|
'show start': /^show start$/,
|
||||||
'hide start': /^hide start$/
|
'hide start': /^hide start$/,
|
||||||
|
'finish': /^finish$/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = util.genParseCommand(regexMap, 'processLevelBuilderCommand');
|
var parse = util.genParseCommand(regexMap, 'processLevelBuilderCommand');
|
||||||
|
@ -16640,6 +16648,11 @@ var LevelBuilder = Level.extend({
|
||||||
}, this.startCanvasHolder.getAnimationTime());
|
}, this.startCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetSolution: function() {
|
||||||
|
this.gitCommandsIssued = [];
|
||||||
|
this.level.solutionCommand = undefined;
|
||||||
|
},
|
||||||
|
|
||||||
hideStart: function(command, deferred) {
|
hideStart: function(command, deferred) {
|
||||||
this.startCanvasHolder.slideOut();
|
this.startCanvasHolder.slideOut();
|
||||||
|
|
||||||
|
@ -16654,10 +16667,11 @@ var LevelBuilder = Level.extend({
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
'Defining start point... solution and goal will be overwritten if they were defined earlier'
|
'Defining start point... solution and goal will be overwritten if they were defined earlier'
|
||||||
);
|
);
|
||||||
this.reset();
|
this.resetSolution();
|
||||||
this.solutionCommand = undefined;
|
|
||||||
|
|
||||||
this.level.startTree = this.mainVis.gitEngine.printTree();
|
this.level.startTree = this.mainVis.gitEngine.printTree();
|
||||||
|
this.mainVis.resetFromThisTreeNow(this.level.startTree);
|
||||||
|
|
||||||
this.initStartVisualization();
|
this.initStartVisualization();
|
||||||
|
|
||||||
this.showStart(command, deferred);
|
this.showStart(command, deferred);
|
||||||
|
@ -16672,19 +16686,45 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.solutionCommand = this.gitCommandsIssued.join(';');
|
this.level.solutionCommand = this.gitCommandsIssued.join(';');
|
||||||
this.goalTreeString = this.mainVis.gitEngine.printTree();
|
this.level.goalTreeString = this.mainVis.gitEngine.printTree();
|
||||||
this.initGoalVisualization();
|
this.initGoalVisualization();
|
||||||
|
|
||||||
this.showGoal(command, deferred);
|
this.showGoal(command, deferred);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setHint: function(command, deferred) {
|
||||||
|
this.level.hint = prompt('Enter a hint! Or blank if you dont want one');
|
||||||
|
if (command) { command.finishWith(deferred); }
|
||||||
|
},
|
||||||
|
|
||||||
|
setID: function(command, deferred) {
|
||||||
|
var id = prompt('Enter an ID');
|
||||||
|
while (!id || !id.length) {
|
||||||
|
id = prompt('Enter an ID... really this time');
|
||||||
|
}
|
||||||
|
this.level.id = id;
|
||||||
|
|
||||||
|
if (command) { command.finishWith(deferred); }
|
||||||
|
},
|
||||||
|
|
||||||
|
finish: function(command, deferred) {
|
||||||
|
if (!this.level.id) {
|
||||||
|
this.setID();
|
||||||
|
}
|
||||||
|
if (this.level.hint === undefined) {
|
||||||
|
this.setHint();
|
||||||
|
}
|
||||||
|
console.log(this.level, this.startTree);
|
||||||
|
},
|
||||||
|
|
||||||
processLevelBuilderCommand: function(command, deferred) {
|
processLevelBuilderCommand: function(command, deferred) {
|
||||||
var methodMap = {
|
var methodMap = {
|
||||||
'define goal': this.defineGoal,
|
'define goal': this.defineGoal,
|
||||||
'define start': this.defineStart,
|
'define start': this.defineStart,
|
||||||
'show start': this.showStart,
|
'show start': this.showStart,
|
||||||
'hide start': this.hideStart
|
'hide start': this.hideStart,
|
||||||
|
'finish': this.finish
|
||||||
};
|
};
|
||||||
|
|
||||||
methodMap[command.get('method')].apply(this, arguments);
|
methodMap[command.get('method')].apply(this, arguments);
|
||||||
|
@ -19351,7 +19391,8 @@ var regexMap = {
|
||||||
'define goal': /^define goal$/,
|
'define goal': /^define goal$/,
|
||||||
'define start': /^define start$/,
|
'define start': /^define start$/,
|
||||||
'show start': /^show start$/,
|
'show start': /^show start$/,
|
||||||
'hide start': /^hide start$/
|
'hide start': /^hide start$/,
|
||||||
|
'finish': /^finish$/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = util.genParseCommand(regexMap, 'processLevelBuilderCommand');
|
var parse = util.genParseCommand(regexMap, 'processLevelBuilderCommand');
|
||||||
|
@ -19481,6 +19522,11 @@ var LevelBuilder = Level.extend({
|
||||||
}, this.startCanvasHolder.getAnimationTime());
|
}, this.startCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetSolution: function() {
|
||||||
|
this.gitCommandsIssued = [];
|
||||||
|
this.level.solutionCommand = undefined;
|
||||||
|
},
|
||||||
|
|
||||||
hideStart: function(command, deferred) {
|
hideStart: function(command, deferred) {
|
||||||
this.startCanvasHolder.slideOut();
|
this.startCanvasHolder.slideOut();
|
||||||
|
|
||||||
|
@ -19495,10 +19541,11 @@ var LevelBuilder = Level.extend({
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
'Defining start point... solution and goal will be overwritten if they were defined earlier'
|
'Defining start point... solution and goal will be overwritten if they were defined earlier'
|
||||||
);
|
);
|
||||||
this.reset();
|
this.resetSolution();
|
||||||
this.solutionCommand = undefined;
|
|
||||||
|
|
||||||
this.level.startTree = this.mainVis.gitEngine.printTree();
|
this.level.startTree = this.mainVis.gitEngine.printTree();
|
||||||
|
this.mainVis.resetFromThisTreeNow(this.level.startTree);
|
||||||
|
|
||||||
this.initStartVisualization();
|
this.initStartVisualization();
|
||||||
|
|
||||||
this.showStart(command, deferred);
|
this.showStart(command, deferred);
|
||||||
|
@ -19513,19 +19560,45 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.solutionCommand = this.gitCommandsIssued.join(';');
|
this.level.solutionCommand = this.gitCommandsIssued.join(';');
|
||||||
this.goalTreeString = this.mainVis.gitEngine.printTree();
|
this.level.goalTreeString = this.mainVis.gitEngine.printTree();
|
||||||
this.initGoalVisualization();
|
this.initGoalVisualization();
|
||||||
|
|
||||||
this.showGoal(command, deferred);
|
this.showGoal(command, deferred);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setHint: function(command, deferred) {
|
||||||
|
this.level.hint = prompt('Enter a hint! Or blank if you dont want one');
|
||||||
|
if (command) { command.finishWith(deferred); }
|
||||||
|
},
|
||||||
|
|
||||||
|
setID: function(command, deferred) {
|
||||||
|
var id = prompt('Enter an ID');
|
||||||
|
while (!id || !id.length) {
|
||||||
|
id = prompt('Enter an ID... really this time');
|
||||||
|
}
|
||||||
|
this.level.id = id;
|
||||||
|
|
||||||
|
if (command) { command.finishWith(deferred); }
|
||||||
|
},
|
||||||
|
|
||||||
|
finish: function(command, deferred) {
|
||||||
|
if (!this.level.id) {
|
||||||
|
this.setID();
|
||||||
|
}
|
||||||
|
if (this.level.hint === undefined) {
|
||||||
|
this.setHint();
|
||||||
|
}
|
||||||
|
console.log(this.level, this.startTree);
|
||||||
|
},
|
||||||
|
|
||||||
processLevelBuilderCommand: function(command, deferred) {
|
processLevelBuilderCommand: function(command, deferred) {
|
||||||
var methodMap = {
|
var methodMap = {
|
||||||
'define goal': this.defineGoal,
|
'define goal': this.defineGoal,
|
||||||
'define start': this.defineStart,
|
'define start': this.defineStart,
|
||||||
'show start': this.showStart,
|
'show start': this.showStart,
|
||||||
'hide start': this.hideStart
|
'hide start': this.hideStart,
|
||||||
|
'finish': this.finish
|
||||||
};
|
};
|
||||||
|
|
||||||
methodMap[command.get('method')].apply(this, arguments);
|
methodMap[command.get('method')].apply(this, arguments);
|
||||||
|
@ -19681,10 +19754,7 @@ var Level = Sandbox.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
initGoalData: function(options) {
|
initGoalData: function(options) {
|
||||||
this.goalTreeString = this.level.goalTreeString;
|
if (!this.level.goalTreeString || !this.level.solutionCommand) {
|
||||||
this.solutionCommand = this.level.solutionCommand;
|
|
||||||
|
|
||||||
if (!this.goalTreeString || !this.solutionCommand) {
|
|
||||||
throw new Error('need goal tree and solution');
|
throw new Error('need goal tree and solution');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -19726,7 +19796,7 @@ var Level = Sandbox.extend({
|
||||||
this.goalVis = new Visualization({
|
this.goalVis = new Visualization({
|
||||||
el: this.goalCanvasHolder.getCanvasLocation(),
|
el: this.goalCanvasHolder.getCanvasLocation(),
|
||||||
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
||||||
treeString: this.goalTreeString,
|
treeString: this.level.goalTreeString,
|
||||||
noKeyboardInput: true,
|
noKeyboardInput: true,
|
||||||
noClick: true
|
noClick: true
|
||||||
});
|
});
|
||||||
|
@ -19750,7 +19820,7 @@ var Level = Sandbox.extend({
|
||||||
// ok great add the solution command
|
// ok great add the solution command
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
'reset;' + this.solutionCommand
|
'reset;' + this.level.solutionCommand
|
||||||
);
|
);
|
||||||
this.hideGoal();
|
this.hideGoal();
|
||||||
command.setResult('Solution command added to the command queue...');
|
command.setResult('Solution command added to the command queue...');
|
||||||
|
@ -19861,7 +19931,7 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
// ok so lets see if they solved it...
|
// ok so lets see if they solved it...
|
||||||
var current = this.mainVis.gitEngine.exportTree();
|
var current = this.mainVis.gitEngine.exportTree();
|
||||||
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.goalTreeString);
|
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.level.goalTreeString);
|
||||||
|
|
||||||
if (!solved) {
|
if (!solved) {
|
||||||
defer.resolve();
|
defer.resolve();
|
||||||
|
@ -19944,6 +20014,11 @@ var Level = Sandbox.extend({
|
||||||
throw new Errors.CommandResult({
|
throw new Errors.CommandResult({
|
||||||
msg: hintMsg
|
msg: hintMsg
|
||||||
});
|
});
|
||||||
|
}],
|
||||||
|
[/^build level$/, function() {
|
||||||
|
throw new Errors.GitError({
|
||||||
|
msg: "You can't build a level inside a level! Please exit level first"
|
||||||
|
});
|
||||||
}]
|
}]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
@ -20258,7 +20333,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
var whenBuilderOpen = Q.defer();
|
var whenBuilderOpen = Q.defer();
|
||||||
|
|
||||||
var LevelBuilder = require('../level/builder').LevelBuilder;
|
var LevelBuilder = require('../level/builder').LevelBuilder;
|
||||||
var levelBuilder = new LevelBuilder({
|
this.levelBuilder = new LevelBuilder({
|
||||||
deferred: whenBuilderOpen
|
deferred: whenBuilderOpen
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20337,6 +20412,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
|
|
||||||
reset: function(command, deferred) {
|
reset: function(command, deferred) {
|
||||||
this.mainVis.reset();
|
this.mainVis.reset();
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
command.finishWith(deferred);
|
command.finishWith(deferred);
|
||||||
}, this.mainVis.getAnimationTime());
|
}, this.mainVis.getAnimationTime());
|
||||||
|
@ -24098,7 +24174,7 @@ GitVisuals.prototype.visBranchesFront = function() {
|
||||||
vBranch.textToFront();
|
vBranch.textToFront();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.visBranchCollection.each(function(visBranch) {
|
this.visBranchCollection.each(function(vBranch) {
|
||||||
vBranch.textToFrontIfInStack();
|
vBranch.textToFrontIfInStack();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -25426,6 +25502,10 @@ var Visualization = Backbone.View.extend({
|
||||||
this.setTreeOpacity(1);
|
this.setTreeOpacity(1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetFromThisTreeNow: function(treeString) {
|
||||||
|
this.treeString = treeString;
|
||||||
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.setTreeOpacity(0);
|
this.setTreeOpacity(0);
|
||||||
if (this.treeString) {
|
if (this.treeString) {
|
||||||
|
|
|
@ -22,7 +22,8 @@ var regexMap = {
|
||||||
'define goal': /^define goal$/,
|
'define goal': /^define goal$/,
|
||||||
'define start': /^define start$/,
|
'define start': /^define start$/,
|
||||||
'show start': /^show start$/,
|
'show start': /^show start$/,
|
||||||
'hide start': /^hide start$/
|
'hide start': /^hide start$/,
|
||||||
|
'finish': /^finish$/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = util.genParseCommand(regexMap, 'processLevelBuilderCommand');
|
var parse = util.genParseCommand(regexMap, 'processLevelBuilderCommand');
|
||||||
|
@ -152,6 +153,11 @@ var LevelBuilder = Level.extend({
|
||||||
}, this.startCanvasHolder.getAnimationTime());
|
}, this.startCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetSolution: function() {
|
||||||
|
this.gitCommandsIssued = [];
|
||||||
|
this.level.solutionCommand = undefined;
|
||||||
|
},
|
||||||
|
|
||||||
hideStart: function(command, deferred) {
|
hideStart: function(command, deferred) {
|
||||||
this.startCanvasHolder.slideOut();
|
this.startCanvasHolder.slideOut();
|
||||||
|
|
||||||
|
@ -166,10 +172,11 @@ var LevelBuilder = Level.extend({
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
'Defining start point... solution and goal will be overwritten if they were defined earlier'
|
'Defining start point... solution and goal will be overwritten if they were defined earlier'
|
||||||
);
|
);
|
||||||
this.reset();
|
this.resetSolution();
|
||||||
this.solutionCommand = undefined;
|
|
||||||
|
|
||||||
this.level.startTree = this.mainVis.gitEngine.printTree();
|
this.level.startTree = this.mainVis.gitEngine.printTree();
|
||||||
|
this.mainVis.resetFromThisTreeNow(this.level.startTree);
|
||||||
|
|
||||||
this.initStartVisualization();
|
this.initStartVisualization();
|
||||||
|
|
||||||
this.showStart(command, deferred);
|
this.showStart(command, deferred);
|
||||||
|
@ -184,19 +191,55 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.solutionCommand = this.gitCommandsIssued.join(';');
|
this.level.solutionCommand = this.gitCommandsIssued.join(';');
|
||||||
this.goalTreeString = this.mainVis.gitEngine.printTree();
|
this.level.goalTreeString = this.mainVis.gitEngine.printTree();
|
||||||
this.initGoalVisualization();
|
this.initGoalVisualization();
|
||||||
|
|
||||||
this.showGoal(command, deferred);
|
this.showGoal(command, deferred);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setHint: function(command, deferred) {
|
||||||
|
this.level.hint = prompt('Enter a hint! Or blank if you dont want one');
|
||||||
|
if (command) { command.finishWith(deferred); }
|
||||||
|
},
|
||||||
|
|
||||||
|
setID: function(command, deferred) {
|
||||||
|
var id = prompt('Enter an ID');
|
||||||
|
while (!id || !id.length) {
|
||||||
|
id = prompt('Enter an ID... really this time');
|
||||||
|
}
|
||||||
|
this.level.id = id;
|
||||||
|
|
||||||
|
if (command) { command.finishWith(deferred); }
|
||||||
|
},
|
||||||
|
|
||||||
|
finish: function(command, deferred) {
|
||||||
|
if (!this.gitCommandsIssued.length) {
|
||||||
|
command.set('error', new GitError({
|
||||||
|
msg: 'Your solution is empty!'
|
||||||
|
});
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.level.id) {
|
||||||
|
this.setID();
|
||||||
|
}
|
||||||
|
if (this.level.hint === undefined) {
|
||||||
|
this.setHint();
|
||||||
|
}
|
||||||
|
console.log(this.level);
|
||||||
|
|
||||||
|
command.finishWith(deferred);
|
||||||
|
},
|
||||||
|
|
||||||
processLevelBuilderCommand: function(command, deferred) {
|
processLevelBuilderCommand: function(command, deferred) {
|
||||||
var methodMap = {
|
var methodMap = {
|
||||||
'define goal': this.defineGoal,
|
'define goal': this.defineGoal,
|
||||||
'define start': this.defineStart,
|
'define start': this.defineStart,
|
||||||
'show start': this.showStart,
|
'show start': this.showStart,
|
||||||
'hide start': this.hideStart
|
'hide start': this.hideStart,
|
||||||
|
'finish': this.finish
|
||||||
};
|
};
|
||||||
|
|
||||||
methodMap[command.get('method')].apply(this, arguments);
|
methodMap[command.get('method')].apply(this, arguments);
|
||||||
|
|
|
@ -85,10 +85,7 @@ var Level = Sandbox.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
initGoalData: function(options) {
|
initGoalData: function(options) {
|
||||||
this.goalTreeString = this.level.goalTreeString;
|
if (!this.level.goalTreeString || !this.level.solutionCommand) {
|
||||||
this.solutionCommand = this.level.solutionCommand;
|
|
||||||
|
|
||||||
if (!this.goalTreeString || !this.solutionCommand) {
|
|
||||||
throw new Error('need goal tree and solution');
|
throw new Error('need goal tree and solution');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -130,7 +127,7 @@ var Level = Sandbox.extend({
|
||||||
this.goalVis = new Visualization({
|
this.goalVis = new Visualization({
|
||||||
el: this.goalCanvasHolder.getCanvasLocation(),
|
el: this.goalCanvasHolder.getCanvasLocation(),
|
||||||
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
||||||
treeString: this.goalTreeString,
|
treeString: this.level.goalTreeString,
|
||||||
noKeyboardInput: true,
|
noKeyboardInput: true,
|
||||||
noClick: true
|
noClick: true
|
||||||
});
|
});
|
||||||
|
@ -154,7 +151,7 @@ var Level = Sandbox.extend({
|
||||||
// ok great add the solution command
|
// ok great add the solution command
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
'reset;' + this.solutionCommand
|
'reset;' + this.level.solutionCommand
|
||||||
);
|
);
|
||||||
this.hideGoal();
|
this.hideGoal();
|
||||||
command.setResult('Solution command added to the command queue...');
|
command.setResult('Solution command added to the command queue...');
|
||||||
|
@ -265,7 +262,7 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
// ok so lets see if they solved it...
|
// ok so lets see if they solved it...
|
||||||
var current = this.mainVis.gitEngine.exportTree();
|
var current = this.mainVis.gitEngine.exportTree();
|
||||||
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.goalTreeString);
|
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.level.goalTreeString);
|
||||||
|
|
||||||
if (!solved) {
|
if (!solved) {
|
||||||
defer.resolve();
|
defer.resolve();
|
||||||
|
@ -348,6 +345,11 @@ var Level = Sandbox.extend({
|
||||||
throw new Errors.CommandResult({
|
throw new Errors.CommandResult({
|
||||||
msg: hintMsg
|
msg: hintMsg
|
||||||
});
|
});
|
||||||
|
}],
|
||||||
|
[/^build level$/, function() {
|
||||||
|
throw new Errors.GitError({
|
||||||
|
msg: "You can't build a level inside a level! Please exit level first"
|
||||||
|
});
|
||||||
}]
|
}]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
|
@ -155,7 +155,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
var whenBuilderOpen = Q.defer();
|
var whenBuilderOpen = Q.defer();
|
||||||
|
|
||||||
var LevelBuilder = require('../level/builder').LevelBuilder;
|
var LevelBuilder = require('../level/builder').LevelBuilder;
|
||||||
var levelBuilder = new LevelBuilder({
|
this.levelBuilder = new LevelBuilder({
|
||||||
deferred: whenBuilderOpen
|
deferred: whenBuilderOpen
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -234,6 +234,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
|
|
||||||
reset: function(command, deferred) {
|
reset: function(command, deferred) {
|
||||||
this.mainVis.reset();
|
this.mainVis.reset();
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
command.finishWith(deferred);
|
command.finishWith(deferred);
|
||||||
}, this.mainVis.getAnimationTime());
|
}, this.mainVis.getAnimationTime());
|
||||||
|
|
|
@ -725,7 +725,7 @@ GitVisuals.prototype.visBranchesFront = function() {
|
||||||
vBranch.textToFront();
|
vBranch.textToFront();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.visBranchCollection.each(function(visBranch) {
|
this.visBranchCollection.each(function(vBranch) {
|
||||||
vBranch.textToFrontIfInStack();
|
vBranch.textToFrontIfInStack();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,6 +127,10 @@ var Visualization = Backbone.View.extend({
|
||||||
this.setTreeOpacity(1);
|
this.setTreeOpacity(1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetFromThisTreeNow: function(treeString) {
|
||||||
|
this.treeString = treeString;
|
||||||
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.setTreeOpacity(0);
|
this.setTreeOpacity(0);
|
||||||
if (this.treeString) {
|
if (this.treeString) {
|
||||||
|
|
12
todo.txt
12
todo.txt
|
@ -1,9 +1,8 @@
|
||||||
Big Things
|
Big Things
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
[ ] level builder? :OOO
|
[ ] level builder finish
|
||||||
* basically just an extension of level (or sandbox), that has commands like
|
[ ] level builder dialog tester
|
||||||
```save tree beginning``` or ```save tree goal``` and then a final
|
[ ] level builder dialog builder
|
||||||
dialog typing area thingy
|
|
||||||
|
|
||||||
|
|
||||||
Medium things:
|
Medium things:
|
||||||
|
@ -33,6 +32,11 @@ Ideas for cleaning
|
||||||
Done things:
|
Done things:
|
||||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[x] level builder? :OOO
|
||||||
|
* basically just an extension of level (or sandbox), that has commands like
|
||||||
|
```save tree beginning``` or ```save tree goal``` and then a final
|
||||||
|
dialog typing area thingy
|
||||||
|
[x] vis branch z index reflow bug
|
||||||
[x] fix terminal input field in general
|
[x] fix terminal input field in general
|
||||||
[x] warning for window size
|
[x] warning for window size
|
||||||
[x] esc on multiview quits absolutely
|
[x] esc on multiview quits absolutely
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue