mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-10 06:34:26 +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) {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.CHANGE_FLIP_TREE_Y,
|
||||
|
|
|
@ -26,6 +26,7 @@ module.exports = {
|
|||
SUBMIT_COMMAND: null,
|
||||
CHANGE_LOCALE: null,
|
||||
CHANGE_LOCALE_FROM_HEADER: null,
|
||||
DISABLE_LEVEL_INSTRUCTIONS: null,
|
||||
/**
|
||||
* only dispatched when you actually
|
||||
* 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
|
||||
// and let it resolve our deferred
|
||||
if (GlobalStateStore.getShouldDisableLevelInstructions()) {
|
||||
setTimeout(function() {
|
||||
deferred.resolve();
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.level.startDialog && !this.testOption('noIntroDialog')) {
|
||||
new MultiView(Object.assign(
|
||||
{},
|
||||
|
@ -166,6 +173,14 @@ var Level = Sandbox.extend({
|
|||
|
||||
startOffCommand: function() {
|
||||
var method = this.options.command.get('method');
|
||||
if (GlobalStateStore.getShouldDisableLevelInstructions()) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'hint; show goal'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.testOption('noStartCommand') && method !== 'importLevelNow') {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
|
|
|
@ -84,6 +84,12 @@ var instantCommands = [
|
|||
msg: intl.str('flip-tree-command')
|
||||
});
|
||||
}],
|
||||
[/^disableLevelInstructions$/, function() {
|
||||
GlobalStateActions.disableLevelInstructions();
|
||||
throw new CommandResult({
|
||||
msg: intl.todo('Level instructions disabled'),
|
||||
});
|
||||
}],
|
||||
[/^refresh$/, function() {
|
||||
var events = require('../app').getEvents();
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ var ActionTypes = AppConstants.ActionTypes;
|
|||
var _isAnimating = false;
|
||||
var _flipTreeY = false;
|
||||
var _numLevelsSolved = 0;
|
||||
var _disableLevelInstructions = false;
|
||||
|
||||
var GlobalStateStore = Object.assign(
|
||||
{},
|
||||
|
@ -27,6 +28,10 @@ AppConstants.StoreSubscribePrototype,
|
|||
return _numLevelsSolved;
|
||||
},
|
||||
|
||||
getShouldDisableLevelInstructions: function() {
|
||||
return _disableLevelInstructions;
|
||||
},
|
||||
|
||||
dispatchToken: AppDispatcher.register(function(payload) {
|
||||
var action = payload.action;
|
||||
var shouldInform = false;
|
||||
|
@ -44,6 +49,10 @@ AppConstants.StoreSubscribePrototype,
|
|||
_numLevelsSolved++;
|
||||
shouldInform = true;
|
||||
break;
|
||||
case ActionTypes.DISABLE_LEVEL_INSTRUCTIONS:
|
||||
_disableLevelInstructions = true;
|
||||
shouldInform = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shouldInform) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue