mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-10 22:54:24 +02:00
Resolves #764 -- disableLevelInstructions for global mode change
This commit is contained in:
parent
ddb3dc93ca
commit
6df4d93880
5 changed files with 37 additions and 0 deletions
|
@ -20,6 +20,12 @@ var GlobalStateActions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableLevelInstructions: function() {
|
||||||
|
AppDispatcher.handleViewAction({
|
||||||
|
type: ActionTypes.DISABLE_LEVEL_INSTRUCTIONS,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
changeFlipTreeY: function(flipTreeY) {
|
changeFlipTreeY: function(flipTreeY) {
|
||||||
AppDispatcher.handleViewAction({
|
AppDispatcher.handleViewAction({
|
||||||
type: ActionTypes.CHANGE_FLIP_TREE_Y,
|
type: ActionTypes.CHANGE_FLIP_TREE_Y,
|
||||||
|
|
|
@ -26,6 +26,7 @@ module.exports = {
|
||||||
SUBMIT_COMMAND: null,
|
SUBMIT_COMMAND: null,
|
||||||
CHANGE_LOCALE: null,
|
CHANGE_LOCALE: null,
|
||||||
CHANGE_LOCALE_FROM_HEADER: null,
|
CHANGE_LOCALE_FROM_HEADER: null,
|
||||||
|
DISABLE_LEVEL_INSTRUCTIONS: null,
|
||||||
/**
|
/**
|
||||||
* only dispatched when you actually
|
* only dispatched when you actually
|
||||||
* solve the level, not ask for solution
|
* solve the level, not ask for solution
|
||||||
|
|
|
@ -69,6 +69,13 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
// if there is a multiview in the beginning, open that
|
// if there is a multiview in the beginning, open that
|
||||||
// and let it resolve our deferred
|
// and let it resolve our deferred
|
||||||
|
if (GlobalStateStore.getShouldDisableLevelInstructions()) {
|
||||||
|
setTimeout(function() {
|
||||||
|
deferred.resolve();
|
||||||
|
}, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.level.startDialog && !this.testOption('noIntroDialog')) {
|
if (this.level.startDialog && !this.testOption('noIntroDialog')) {
|
||||||
new MultiView(Object.assign(
|
new MultiView(Object.assign(
|
||||||
{},
|
{},
|
||||||
|
@ -166,6 +173,14 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
startOffCommand: function() {
|
startOffCommand: function() {
|
||||||
var method = this.options.command.get('method');
|
var method = this.options.command.get('method');
|
||||||
|
if (GlobalStateStore.getShouldDisableLevelInstructions()) {
|
||||||
|
Main.getEventBaton().trigger(
|
||||||
|
'commandSubmitted',
|
||||||
|
'hint; show goal'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.testOption('noStartCommand') && method !== 'importLevelNow') {
|
if (!this.testOption('noStartCommand') && method !== 'importLevelNow') {
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
|
|
|
@ -84,6 +84,12 @@ var instantCommands = [
|
||||||
msg: intl.str('flip-tree-command')
|
msg: intl.str('flip-tree-command')
|
||||||
});
|
});
|
||||||
}],
|
}],
|
||||||
|
[/^disableLevelInstructions$/, function() {
|
||||||
|
GlobalStateActions.disableLevelInstructions();
|
||||||
|
throw new CommandResult({
|
||||||
|
msg: intl.todo('Level instructions disabled'),
|
||||||
|
});
|
||||||
|
}],
|
||||||
[/^refresh$/, function() {
|
[/^refresh$/, function() {
|
||||||
var events = require('../app').getEvents();
|
var events = require('../app').getEvents();
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ var ActionTypes = AppConstants.ActionTypes;
|
||||||
var _isAnimating = false;
|
var _isAnimating = false;
|
||||||
var _flipTreeY = false;
|
var _flipTreeY = false;
|
||||||
var _numLevelsSolved = 0;
|
var _numLevelsSolved = 0;
|
||||||
|
var _disableLevelInstructions = false;
|
||||||
|
|
||||||
var GlobalStateStore = Object.assign(
|
var GlobalStateStore = Object.assign(
|
||||||
{},
|
{},
|
||||||
|
@ -27,6 +28,10 @@ AppConstants.StoreSubscribePrototype,
|
||||||
return _numLevelsSolved;
|
return _numLevelsSolved;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getShouldDisableLevelInstructions: function() {
|
||||||
|
return _disableLevelInstructions;
|
||||||
|
},
|
||||||
|
|
||||||
dispatchToken: AppDispatcher.register(function(payload) {
|
dispatchToken: AppDispatcher.register(function(payload) {
|
||||||
var action = payload.action;
|
var action = payload.action;
|
||||||
var shouldInform = false;
|
var shouldInform = false;
|
||||||
|
@ -44,6 +49,10 @@ AppConstants.StoreSubscribePrototype,
|
||||||
_numLevelsSolved++;
|
_numLevelsSolved++;
|
||||||
shouldInform = true;
|
shouldInform = true;
|
||||||
break;
|
break;
|
||||||
|
case ActionTypes.DISABLE_LEVEL_INSTRUCTIONS:
|
||||||
|
_disableLevelInstructions = true;
|
||||||
|
shouldInform = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldInform) {
|
if (shouldInform) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue