mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +02:00
die for levels
This commit is contained in:
parent
5d981a1268
commit
953bd49ee2
11 changed files with 270 additions and 14 deletions
|
@ -18,6 +18,7 @@ var ModalAlert = require('../views').ModalAlert;
|
|||
var MultiView = require('../views/multiView').MultiView;
|
||||
var CanvasTerminalHolder = require('../views').CanvasTerminalHolder;
|
||||
var ConfirmCancelTerminal = require('../views').ConfirmCancelTerminal;
|
||||
var LevelToolbar = require('../views').LevelToolbar;
|
||||
|
||||
var TreeCompare = require('../git/treeCompare').TreeCompare;
|
||||
|
||||
|
@ -35,10 +36,25 @@ var Level = Sandbox.extend({
|
|||
this.treeCompare = new TreeCompare();
|
||||
|
||||
this.initGoalData(options);
|
||||
this.initName(options);
|
||||
|
||||
Sandbox.prototype.initialize.apply(this, [options]);
|
||||
this.startOffCommand();
|
||||
},
|
||||
|
||||
initName: function(options) {
|
||||
this.levelName = options.levelName;
|
||||
this.levelID = options.levelID;
|
||||
if (!this.levelName || !this.levelID) {
|
||||
this.levelName = 'Rebase Classic';
|
||||
console.warn('REALLY BAD FORM need ids and names');
|
||||
}
|
||||
|
||||
this.levelToolbar = new LevelToolbar({
|
||||
levelName: this.levelName
|
||||
});
|
||||
},
|
||||
|
||||
initGoalData: function(options) {
|
||||
this.goalTreeString = options.level.goalTree;
|
||||
this.solutionCommand = options.level.solutionCommand;
|
||||
|
@ -59,6 +75,12 @@ var Level = Sandbox.extend({
|
|||
Sandbox.prototype.takeControl.apply(this);
|
||||
},
|
||||
|
||||
releaseControl: function() {
|
||||
Main.getEventBaton().releaseBaton('processLevelCommand', this.processLevelCommand, this);
|
||||
|
||||
Sandbox.prototype.releaseControl.apply(this);
|
||||
},
|
||||
|
||||
startOffCommand: function() {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
|
@ -270,6 +292,22 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
},
|
||||
|
||||
die: function() {
|
||||
this.levelToolbar.die();
|
||||
this.goalCanvasHolder.die();
|
||||
|
||||
this.mainVis.die();
|
||||
this.goalVis.die();
|
||||
this.releaseControl();
|
||||
|
||||
this.clear();
|
||||
|
||||
delete this.commandCollection;
|
||||
delete this.mainVis;
|
||||
delete this.goalVis;
|
||||
delete this.goalCanvasHolder;
|
||||
},
|
||||
|
||||
getInstantCommands: function() {
|
||||
var hintMsg = (this.level.hint) ?
|
||||
this.level.hint :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue