mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
awesome hooking everything up
This commit is contained in:
parent
378fcc0377
commit
0735eb3d64
11 changed files with 266 additions and 139 deletions
345
build/bundle.js
345
build/bundle.js
|
@ -4617,6 +4617,14 @@ var Sandbox = Backbone.View.extend({
|
|||
deferred.resolve();
|
||||
},
|
||||
|
||||
showLevels: function(command, deferred) {
|
||||
var whenClosed = Q.defer();
|
||||
Main.getLevelDropdown().show(whenClosed);
|
||||
whenClosed.promise.done(function() {
|
||||
command.finishWith(deferred);
|
||||
});
|
||||
},
|
||||
|
||||
processSandboxCommand: function(command, deferred) {
|
||||
var commandMap = {
|
||||
'help': this.helpDialog,
|
||||
|
@ -4625,7 +4633,8 @@ var Sandbox = Backbone.View.extend({
|
|||
'clear': this.clear,
|
||||
'exit level': this.exitLevel,
|
||||
'level': this.startLevel,
|
||||
'sandbox': this.exitLevel
|
||||
'sandbox': this.exitLevel,
|
||||
'levels': this.showLevels
|
||||
};
|
||||
var method = commandMap[command.get('method')];
|
||||
if (!method) { throw new Error('no method for that wut'); }
|
||||
|
@ -6268,6 +6277,7 @@ var commandUI;
|
|||
var sandbox;
|
||||
var eventBaton;
|
||||
var levelArbiter;
|
||||
var levelDropdown;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -6285,11 +6295,15 @@ var init = function() {
|
|||
var Level = require('../level').Level;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
var LevelArbiter = require('../level/arbiter').LevelArbiter;
|
||||
var LevelDropdownView = require('../views/levelDropdownView').LevelDropdownView;
|
||||
|
||||
eventBaton = new EventBaton();
|
||||
commandUI = new CommandUI();
|
||||
sandbox = new Sandbox();
|
||||
levelArbiter = new LevelArbiter();
|
||||
levelDropdown = new LevelDropdownView({
|
||||
wait: true
|
||||
});
|
||||
|
||||
// we always want to focus the text area to collect input
|
||||
var focusTextArea = function() {
|
||||
|
@ -6403,6 +6417,10 @@ exports.getLevelArbiter = function() {
|
|||
return levelArbiter;
|
||||
};
|
||||
|
||||
exports.getLevelDropdown = function() {
|
||||
return levelDropdown;
|
||||
};
|
||||
|
||||
exports.init = init;
|
||||
|
||||
|
||||
|
@ -6668,6 +6686,7 @@ var Level = Sandbox.extend({
|
|||
|
||||
levelSolved: function(defer) {
|
||||
this.solved = true;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
this.hideGoal();
|
||||
|
||||
var nextLevel = Main.getLevelArbiter().getNextLevel(this.level.id);
|
||||
|
@ -12784,7 +12803,8 @@ var regexMap = {
|
|||
'clear': /^clear($|\s)/,
|
||||
'exit level': /^exit level($|\s)/,
|
||||
'sandbox': /^sandbox($|\s)/,
|
||||
'level': /^level\s?([a-zA-Z0-9]*)/
|
||||
'level': /^level\s?([a-zA-Z0-9]*)/,
|
||||
'levels': /^levels($|\s)/
|
||||
};
|
||||
|
||||
var parse = function(str) {
|
||||
|
@ -15390,11 +15410,15 @@ var Backbone = require('backbone');
|
|||
var levelSequences = require('../levels').levelSequences;
|
||||
var sequenceInfo = require('../levels').sequenceInfo;
|
||||
|
||||
var Main = require('../app');
|
||||
|
||||
function LevelArbiter() {
|
||||
this.levelMap = {};
|
||||
this.init();
|
||||
// TODO -- local storage sync
|
||||
this.solvedMap = {};
|
||||
|
||||
Main.getEvents().on('levelSolved', this.levelSolved, this);
|
||||
}
|
||||
|
||||
LevelArbiter.prototype.init = function() {
|
||||
|
@ -15426,10 +15450,13 @@ LevelArbiter.prototype.isLevelSolved = function(id) {
|
|||
if (!this.levelMap[id]) {
|
||||
throw new Error('that level doesnt exist!');
|
||||
}
|
||||
console.log('is it solved', id);
|
||||
return Boolean(this.solvedMap[id]);
|
||||
};
|
||||
|
||||
LevelArbiter.prototype.levelSolved = function(id) {
|
||||
this.solvedMap[id] = true;
|
||||
};
|
||||
|
||||
LevelArbiter.prototype.validateLevel = function(level) {
|
||||
level = level || {};
|
||||
var requiredFields = [
|
||||
|
@ -15557,6 +15584,143 @@ require.define("/src/levels/rebase/2.js",function(require,module,exports,__dirna
|
|||
};
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/views/levelDropdownView.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
var Q = require('q');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone;
|
||||
|
||||
var util = require('../util');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
var Main = require('../app');
|
||||
|
||||
var ModalTerminal = require('../views').ModalTerminal;
|
||||
var ContainedBase = require('../views').ContainedBase;
|
||||
var BaseView = require('../views').BaseView;
|
||||
|
||||
var LevelDropdownView = ContainedBase.extend({
|
||||
tagName: 'div',
|
||||
className: 'levelDropdownView box vertical',
|
||||
template: _.template($('#level-dropdown-view').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.JSON = {};
|
||||
|
||||
Main.getEvents().on('levelSolved', this.updateSolvedStatus, this);
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents.on('clickedID', _.debounce(
|
||||
_.bind(this.loadLevelID, this),
|
||||
300,
|
||||
true
|
||||
));
|
||||
|
||||
this.sequences = Main.getLevelArbiter().getSequences();
|
||||
this.container = new ModalTerminal({
|
||||
title: 'Select a Level'
|
||||
});
|
||||
this.render();
|
||||
this.buildSequences();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
show: function(deferred) {
|
||||
this.showDeferred = deferred;
|
||||
LevelDropdownView.__super__.show.apply(this);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.showDeferred) {
|
||||
this.showDeferred.resolve();
|
||||
}
|
||||
this.showDeferred = undefined;
|
||||
|
||||
LevelDropdownView.__super__.hide.apply(this);
|
||||
},
|
||||
|
||||
loadLevelID: function(id) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'level ' + id
|
||||
);
|
||||
this.hide();
|
||||
},
|
||||
|
||||
updateSolvedStatus: function() {
|
||||
_.each(this.seriesViews, function(view) {
|
||||
view.updateSolvedStatus();
|
||||
}, this);
|
||||
},
|
||||
|
||||
buildSequences: function() {
|
||||
this.seriesViews = [];
|
||||
_.each(this.sequences, function(sequenceName) {
|
||||
this.seriesViews.push(new SeriesView({
|
||||
destination: this.$el,
|
||||
name: sequenceName,
|
||||
navEvents: this.navEvents
|
||||
}));
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
var SeriesView = BaseView.extend({
|
||||
tagName: 'div',
|
||||
className: 'seriesView box flex1 vertical',
|
||||
template: _.template($('#series-view').html()),
|
||||
events: {
|
||||
'click div.levelIcon': 'click'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
this.name = options.name || 'intro';
|
||||
this.navEvents = options.navEvents;
|
||||
this.info = Main.getLevelArbiter().getSequenceInfo(this.name);
|
||||
this.levels = Main.getLevelArbiter().getLevelsInSequence(this.name);
|
||||
|
||||
this.levelIDs = [];
|
||||
_.each(this.levels, function(level) {
|
||||
this.levelIDs.push(level.id);
|
||||
}, this);
|
||||
|
||||
this.destination = options.destination;
|
||||
this.JSON = {
|
||||
displayName: this.info.displayName,
|
||||
about: this.info.about,
|
||||
ids: this.levelIDs
|
||||
};
|
||||
|
||||
this.render();
|
||||
this.updateSolvedStatus();
|
||||
},
|
||||
|
||||
updateSolvedStatus: function() {
|
||||
// this is a bit hacky, it really should be some nice model
|
||||
// property changing but it's the 11th hour...
|
||||
var toLoop = this.$('div.levelIcon').each(function(index, el) {
|
||||
var id = el.id;
|
||||
$(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id));
|
||||
});
|
||||
},
|
||||
|
||||
click: function(ev) {
|
||||
if (!ev || !ev.srcElement || !ev.srcElement.id) {
|
||||
console.warn('wut, no id'); return;
|
||||
}
|
||||
|
||||
var id = ev.srcElement.id;
|
||||
this.navEvents.trigger('clickedID', id);
|
||||
}
|
||||
});
|
||||
|
||||
exports.LevelDropdownView = LevelDropdownView;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/util/zoomLevel.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
@ -16083,129 +16247,6 @@ HeadlessGit.prototype.sendCommand = function(value) {
|
|||
exports.HeadlessGit = HeadlessGit;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/views/levelDropdownView.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
var Q = require('q');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone;
|
||||
|
||||
var util = require('../util');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
var Main = require('../app');
|
||||
|
||||
var ModalTerminal = require('../views').ModalTerminal;
|
||||
var ContainedBase = require('../views').ContainedBase;
|
||||
var BaseView = require('../views').BaseView;
|
||||
|
||||
var LevelDropdownView = ContainedBase.extend({
|
||||
tagName: 'div',
|
||||
className: 'levelDropdownView box vertical',
|
||||
template: _.template($('#level-dropdown-view').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.JSON = {};
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents.on('clickedID', _.debounce(
|
||||
_.bind(this.loadLevelID, this),
|
||||
300,
|
||||
true
|
||||
));
|
||||
|
||||
this.sequences = Main.getLevelArbiter().getSequences();
|
||||
this.container = new ModalTerminal({
|
||||
title: 'Select a Level'
|
||||
});
|
||||
this.render();
|
||||
this.buildSequences();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
loadLevelID: function(id) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'level ' + id
|
||||
);
|
||||
this.hide();
|
||||
},
|
||||
|
||||
updateSolvedStatus: function() {
|
||||
_.each(this.seriesViews, function(view) {
|
||||
view.updateSolvedStatus();
|
||||
}, this);
|
||||
},
|
||||
|
||||
buildSequences: function() {
|
||||
this.seriesViews = [];
|
||||
_.each(this.sequences, function(sequenceName) {
|
||||
this.seriesViews.push(new SeriesView({
|
||||
destination: this.$el,
|
||||
name: sequenceName,
|
||||
navEvents: this.navEvents
|
||||
}));
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
var SeriesView = BaseView.extend({
|
||||
tagName: 'div',
|
||||
className: 'seriesView box flex1 vertical',
|
||||
template: _.template($('#series-view').html()),
|
||||
events: {
|
||||
'click div.levelIcon': 'click'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
this.name = options.name || 'intro';
|
||||
this.navEvents = options.navEvents;
|
||||
this.info = Main.getLevelArbiter().getSequenceInfo(this.name);
|
||||
this.levels = Main.getLevelArbiter().getLevelsInSequence(this.name);
|
||||
|
||||
this.levelIDs = [];
|
||||
_.each(this.levels, function(level) {
|
||||
this.levelIDs.push(level.id);
|
||||
}, this);
|
||||
|
||||
this.destination = options.destination;
|
||||
this.JSON = {
|
||||
displayName: this.info.displayName,
|
||||
about: this.info.about,
|
||||
ids: this.levelIDs
|
||||
};
|
||||
|
||||
this.render();
|
||||
this.updateSolvedStatus();
|
||||
},
|
||||
|
||||
updateSolvedStatus: function() {
|
||||
// this is a bit hacky, it really should be some nice model
|
||||
// property changing but it's the 11th hour...
|
||||
var toLoop = this.$('div.levelIcon').each(function(index, el) {
|
||||
var id = el.id;
|
||||
$(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id));
|
||||
});
|
||||
},
|
||||
|
||||
click: function(ev) {
|
||||
console.log(ev.srcElement);
|
||||
console.log(ev.srcElement.id);
|
||||
if (!ev || !ev.srcElement || !ev.srcElement.id) {
|
||||
console.warn('wut, no id'); return;
|
||||
}
|
||||
|
||||
var id = ev.srcElement.id;
|
||||
this.navEvents.trigger('clickedID', id);
|
||||
}
|
||||
});
|
||||
|
||||
exports.LevelDropdownView = LevelDropdownView;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/app/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
@ -16222,6 +16263,7 @@ var commandUI;
|
|||
var sandbox;
|
||||
var eventBaton;
|
||||
var levelArbiter;
|
||||
var levelDropdown;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -16239,11 +16281,15 @@ var init = function() {
|
|||
var Level = require('../level').Level;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
var LevelArbiter = require('../level/arbiter').LevelArbiter;
|
||||
var LevelDropdownView = require('../views/levelDropdownView').LevelDropdownView;
|
||||
|
||||
eventBaton = new EventBaton();
|
||||
commandUI = new CommandUI();
|
||||
sandbox = new Sandbox();
|
||||
levelArbiter = new LevelArbiter();
|
||||
levelDropdown = new LevelDropdownView({
|
||||
wait: true
|
||||
});
|
||||
|
||||
// we always want to focus the text area to collect input
|
||||
var focusTextArea = function() {
|
||||
|
@ -16357,6 +16403,10 @@ exports.getLevelArbiter = function() {
|
|||
return levelArbiter;
|
||||
};
|
||||
|
||||
exports.getLevelDropdown = function() {
|
||||
return levelDropdown;
|
||||
};
|
||||
|
||||
exports.init = init;
|
||||
|
||||
|
||||
|
@ -18569,11 +18619,15 @@ var Backbone = require('backbone');
|
|||
var levelSequences = require('../levels').levelSequences;
|
||||
var sequenceInfo = require('../levels').sequenceInfo;
|
||||
|
||||
var Main = require('../app');
|
||||
|
||||
function LevelArbiter() {
|
||||
this.levelMap = {};
|
||||
this.init();
|
||||
// TODO -- local storage sync
|
||||
this.solvedMap = {};
|
||||
|
||||
Main.getEvents().on('levelSolved', this.levelSolved, this);
|
||||
}
|
||||
|
||||
LevelArbiter.prototype.init = function() {
|
||||
|
@ -18605,10 +18659,13 @@ LevelArbiter.prototype.isLevelSolved = function(id) {
|
|||
if (!this.levelMap[id]) {
|
||||
throw new Error('that level doesnt exist!');
|
||||
}
|
||||
console.log('is it solved', id);
|
||||
return Boolean(this.solvedMap[id]);
|
||||
};
|
||||
|
||||
LevelArbiter.prototype.levelSolved = function(id) {
|
||||
this.solvedMap[id] = true;
|
||||
};
|
||||
|
||||
LevelArbiter.prototype.validateLevel = function(level) {
|
||||
level = level || {};
|
||||
var requiredFields = [
|
||||
|
@ -19001,6 +19058,7 @@ var Level = Sandbox.extend({
|
|||
|
||||
levelSolved: function(defer) {
|
||||
this.solved = true;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
this.hideGoal();
|
||||
|
||||
var nextLevel = Main.getLevelArbiter().getNextLevel(this.level.id);
|
||||
|
@ -19377,6 +19435,14 @@ var Sandbox = Backbone.View.extend({
|
|||
deferred.resolve();
|
||||
},
|
||||
|
||||
showLevels: function(command, deferred) {
|
||||
var whenClosed = Q.defer();
|
||||
Main.getLevelDropdown().show(whenClosed);
|
||||
whenClosed.promise.done(function() {
|
||||
command.finishWith(deferred);
|
||||
});
|
||||
},
|
||||
|
||||
processSandboxCommand: function(command, deferred) {
|
||||
var commandMap = {
|
||||
'help': this.helpDialog,
|
||||
|
@ -19385,7 +19451,8 @@ var Sandbox = Backbone.View.extend({
|
|||
'clear': this.clear,
|
||||
'exit level': this.exitLevel,
|
||||
'level': this.startLevel,
|
||||
'sandbox': this.exitLevel
|
||||
'sandbox': this.exitLevel,
|
||||
'levels': this.showLevels
|
||||
};
|
||||
var method = commandMap[command.get('method')];
|
||||
if (!method) { throw new Error('no method for that wut'); }
|
||||
|
@ -19489,7 +19556,8 @@ var regexMap = {
|
|||
'clear': /^clear($|\s)/,
|
||||
'exit level': /^exit level($|\s)/,
|
||||
'sandbox': /^sandbox($|\s)/,
|
||||
'level': /^level\s?([a-zA-Z0-9]*)/
|
||||
'level': /^level\s?([a-zA-Z0-9]*)/,
|
||||
'levels': /^levels($|\s)/
|
||||
};
|
||||
|
||||
var parse = function(str) {
|
||||
|
@ -19909,6 +19977,7 @@ $(document).ready(function() {
|
|||
window.eventBaton = toGlobalize.Main.getEventBaton();
|
||||
window.sandbox = toGlobalize.Main.getSandbox();
|
||||
window.modules = toGlobalize;
|
||||
window.levelDropdown = toGlobalize.Main.getLevelDropdown();
|
||||
});
|
||||
|
||||
|
||||
|
@ -21403,6 +21472,8 @@ var LevelDropdownView = ContainedBase.extend({
|
|||
options = options || {};
|
||||
this.JSON = {};
|
||||
|
||||
Main.getEvents().on('levelSolved', this.updateSolvedStatus, this);
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents.on('clickedID', _.debounce(
|
||||
_.bind(this.loadLevelID, this),
|
||||
|
@ -21422,6 +21493,20 @@ var LevelDropdownView = ContainedBase.extend({
|
|||
}
|
||||
},
|
||||
|
||||
show: function(deferred) {
|
||||
this.showDeferred = deferred;
|
||||
LevelDropdownView.__super__.show.apply(this);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.showDeferred) {
|
||||
this.showDeferred.resolve();
|
||||
}
|
||||
this.showDeferred = undefined;
|
||||
|
||||
LevelDropdownView.__super__.hide.apply(this);
|
||||
},
|
||||
|
||||
loadLevelID: function(id) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
|
@ -21488,8 +21573,6 @@ var SeriesView = BaseView.extend({
|
|||
},
|
||||
|
||||
click: function(ev) {
|
||||
console.log(ev.srcElement);
|
||||
console.log(ev.srcElement.id);
|
||||
if (!ev || !ev.srcElement || !ev.srcElement.id) {
|
||||
console.warn('wut, no id'); return;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
<div class="index box" id="<%=ids[i]%>">
|
||||
<i class="icon-ok-circle"></i>
|
||||
<div class="indexNum">
|
||||
<%= i %>
|
||||
<%= i + 1 %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,6 +12,7 @@ var commandUI;
|
|||
var sandbox;
|
||||
var eventBaton;
|
||||
var levelArbiter;
|
||||
var levelDropdown;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -29,11 +30,15 @@ var init = function() {
|
|||
var Level = require('../level').Level;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
var LevelArbiter = require('../level/arbiter').LevelArbiter;
|
||||
var LevelDropdownView = require('../views/levelDropdownView').LevelDropdownView;
|
||||
|
||||
eventBaton = new EventBaton();
|
||||
commandUI = new CommandUI();
|
||||
sandbox = new Sandbox();
|
||||
levelArbiter = new LevelArbiter();
|
||||
levelDropdown = new LevelDropdownView({
|
||||
wait: true
|
||||
});
|
||||
|
||||
// we always want to focus the text area to collect input
|
||||
var focusTextArea = function() {
|
||||
|
@ -147,5 +152,9 @@ exports.getLevelArbiter = function() {
|
|||
return levelArbiter;
|
||||
};
|
||||
|
||||
exports.getLevelDropdown = function() {
|
||||
return levelDropdown;
|
||||
};
|
||||
|
||||
exports.init = init;
|
||||
|
||||
|
|
|
@ -6,11 +6,15 @@ var Backbone = require('backbone');
|
|||
var levelSequences = require('../levels').levelSequences;
|
||||
var sequenceInfo = require('../levels').sequenceInfo;
|
||||
|
||||
var Main = require('../app');
|
||||
|
||||
function LevelArbiter() {
|
||||
this.levelMap = {};
|
||||
this.init();
|
||||
// TODO -- local storage sync
|
||||
this.solvedMap = {};
|
||||
|
||||
Main.getEvents().on('levelSolved', this.levelSolved, this);
|
||||
}
|
||||
|
||||
LevelArbiter.prototype.init = function() {
|
||||
|
@ -42,10 +46,13 @@ LevelArbiter.prototype.isLevelSolved = function(id) {
|
|||
if (!this.levelMap[id]) {
|
||||
throw new Error('that level doesnt exist!');
|
||||
}
|
||||
console.log('is it solved', id);
|
||||
return Boolean(this.solvedMap[id]);
|
||||
};
|
||||
|
||||
LevelArbiter.prototype.levelSolved = function(id) {
|
||||
this.solvedMap[id] = true;
|
||||
};
|
||||
|
||||
LevelArbiter.prototype.validateLevel = function(level) {
|
||||
level = level || {};
|
||||
var requiredFields = [
|
||||
|
|
|
@ -258,6 +258,7 @@ var Level = Sandbox.extend({
|
|||
|
||||
levelSolved: function(defer) {
|
||||
this.solved = true;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
this.hideGoal();
|
||||
|
||||
var nextLevel = Main.getLevelArbiter().getNextLevel(this.level.id);
|
||||
|
|
|
@ -149,6 +149,14 @@ var Sandbox = Backbone.View.extend({
|
|||
deferred.resolve();
|
||||
},
|
||||
|
||||
showLevels: function(command, deferred) {
|
||||
var whenClosed = Q.defer();
|
||||
Main.getLevelDropdown().show(whenClosed);
|
||||
whenClosed.promise.done(function() {
|
||||
command.finishWith(deferred);
|
||||
});
|
||||
},
|
||||
|
||||
processSandboxCommand: function(command, deferred) {
|
||||
var commandMap = {
|
||||
'help': this.helpDialog,
|
||||
|
@ -157,7 +165,8 @@ var Sandbox = Backbone.View.extend({
|
|||
'clear': this.clear,
|
||||
'exit level': this.exitLevel,
|
||||
'level': this.startLevel,
|
||||
'sandbox': this.exitLevel
|
||||
'sandbox': this.exitLevel,
|
||||
'levels': this.showLevels
|
||||
};
|
||||
var method = commandMap[command.get('method')];
|
||||
if (!method) { throw new Error('no method for that wut'); }
|
||||
|
|
|
@ -43,7 +43,8 @@ var regexMap = {
|
|||
'clear': /^clear($|\s)/,
|
||||
'exit level': /^exit level($|\s)/,
|
||||
'sandbox': /^sandbox($|\s)/,
|
||||
'level': /^level\s?([a-zA-Z0-9]*)/
|
||||
'level': /^level\s?([a-zA-Z0-9]*)/,
|
||||
'levels': /^levels($|\s)/
|
||||
};
|
||||
|
||||
var parse = function(str) {
|
||||
|
|
|
@ -34,5 +34,6 @@ $(document).ready(function() {
|
|||
window.eventBaton = toGlobalize.Main.getEventBaton();
|
||||
window.sandbox = toGlobalize.Main.getSandbox();
|
||||
window.modules = toGlobalize;
|
||||
window.levelDropdown = toGlobalize.Main.getLevelDropdown();
|
||||
});
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ var LevelDropdownView = ContainedBase.extend({
|
|||
options = options || {};
|
||||
this.JSON = {};
|
||||
|
||||
Main.getEvents().on('levelSolved', this.updateSolvedStatus, this);
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents.on('clickedID', _.debounce(
|
||||
_.bind(this.loadLevelID, this),
|
||||
|
@ -39,6 +41,20 @@ var LevelDropdownView = ContainedBase.extend({
|
|||
}
|
||||
},
|
||||
|
||||
show: function(deferred) {
|
||||
this.showDeferred = deferred;
|
||||
LevelDropdownView.__super__.show.apply(this);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.showDeferred) {
|
||||
this.showDeferred.resolve();
|
||||
}
|
||||
this.showDeferred = undefined;
|
||||
|
||||
LevelDropdownView.__super__.hide.apply(this);
|
||||
},
|
||||
|
||||
loadLevelID: function(id) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
|
@ -105,8 +121,6 @@ var SeriesView = BaseView.extend({
|
|||
},
|
||||
|
||||
click: function(ev) {
|
||||
console.log(ev.srcElement);
|
||||
console.log(ev.srcElement.id);
|
||||
if (!ev || !ev.srcElement || !ev.srcElement.id) {
|
||||
console.warn('wut, no id'); return;
|
||||
}
|
||||
|
|
|
@ -575,7 +575,7 @@ div.iconHolder {
|
|||
div.seriesView p.about {
|
||||
margin: 0px;
|
||||
padding: 4px;
|
||||
font-size: 10px;
|
||||
font-size: 12px;
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
|
|
4
todo.txt
4
todo.txt
|
@ -1,6 +1,7 @@
|
|||
Big Things
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[ ] levels dropdown selection?
|
||||
[ ] local storage for solved map
|
||||
[ ] hookup for when solving happens
|
||||
[ ] 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
|
||||
|
@ -34,6 +35,7 @@ Big Bugs to fix:
|
|||
Done things:
|
||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[x] levels dropdown selection?
|
||||
[x] git demonstration view -- shouldnt be too bad. LOL WHAT A FUCKING JOKE like 4 hours
|
||||
[x] gotoSandbox command
|
||||
[x] "next level?" dialog after beating level
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue