mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
Resolves #248 remember resetting after level solved
This commit is contained in:
parent
68b97bef6d
commit
dfecf68690
1 changed files with 25 additions and 6 deletions
|
@ -47,6 +47,7 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
this.gitCommandsIssued = [];
|
this.gitCommandsIssued = [];
|
||||||
this.solved = false;
|
this.solved = false;
|
||||||
|
this.wasResetAfterSolved = false;
|
||||||
|
|
||||||
this.initGoalData(options);
|
this.initGoalData(options);
|
||||||
this.initName(options);
|
this.initName(options);
|
||||||
|
@ -427,14 +428,29 @@ var Level = Sandbox.extend({
|
||||||
var numCommands = this.gitCommandsIssued.length;
|
var numCommands = this.gitCommandsIssued.length;
|
||||||
var best = this.getNumSolutionCommands();
|
var best = this.getNumSolutionCommands();
|
||||||
|
|
||||||
GlobalState.isAnimating = true;
|
var skipFinishDialog = this.testOption('noFinishDialog') ||
|
||||||
var skipFinishDialog = this.testOption('noFinishDialog');
|
this.wasResetAfterSolved;
|
||||||
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
var skipFinishAnimation = this.wasResetAfterSolved;
|
||||||
if (this.mainVis.originVis) {
|
|
||||||
finishAnimationChain = finishAnimationChain.then(
|
var finishAnimationChain = null;
|
||||||
this.mainVis.originVis.gitVisuals.finishAnimation()
|
if (skipFinishAnimation) {
|
||||||
|
var deferred = Q.defer();
|
||||||
|
deferred.resolve();
|
||||||
|
finishAnimationChain = deferred.promise;
|
||||||
|
Main.getEventBaton().trigger(
|
||||||
|
'commandSubmitted',
|
||||||
|
'echo "level solved!"'
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
GlobalState.isAnimating = true;
|
||||||
|
finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||||
|
if (this.mainVis.originVis) {
|
||||||
|
finishAnimationChain = finishAnimationChain.then(
|
||||||
|
this.mainVis.originVis.gitVisuals.finishAnimation()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skipFinishDialog) {
|
if (!skipFinishDialog) {
|
||||||
finishAnimationChain = finishAnimationChain.then(function() {
|
finishAnimationChain = finishAnimationChain.then(function() {
|
||||||
// we want to ask if they will move onto the next level
|
// we want to ask if they will move onto the next level
|
||||||
|
@ -513,6 +529,9 @@ var Level = Sandbox.extend({
|
||||||
if (!this.testOptionOnString(commandStr, 'forSolution')) {
|
if (!this.testOptionOnString(commandStr, 'forSolution')) {
|
||||||
this.isShowingSolution = false;
|
this.isShowingSolution = false;
|
||||||
}
|
}
|
||||||
|
if (this.solved) {
|
||||||
|
this.wasResetAfterSolved = true;
|
||||||
|
}
|
||||||
this.solved = false;
|
this.solved = false;
|
||||||
Level.__super__.reset.apply(this, arguments);
|
Level.__super__.reset.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue