parent
8500c8be25
commit
3b3b9b9109
13 changed files with 92 additions and 32 deletions
@ -1,6 +1,6 @@ |
|||||||
import * as GridActions from '../actions/board/grid.actions'; |
import * as GridActions from '../../actions/board/grid.actions'; |
||||||
import MultiplesModel from '../models/multiples.model'; |
import MultiplesModel from '../../models/multiples.model'; |
||||||
import SETTINGS from '../AppSettings'; |
import SETTINGS from '../../AppSettings'; |
||||||
|
|
||||||
let values; |
let values; |
||||||
let dispatch; |
let dispatch; |
@ -1,4 +1,4 @@ |
|||||||
import * as MessageActions from '../actions/board/message.actions'; |
import * as MessageActions from '../../actions/board/message.actions'; |
||||||
|
|
||||||
const positives = [ |
const positives = [ |
||||||
'All finished!', |
'All finished!', |
@ -1,6 +1,6 @@ |
|||||||
import * as MuncherActions from '../actions/board/muncher.actions'; |
import * as MuncherActions from '../../actions/board/muncher.actions'; |
||||||
import BoardCtrl from './board.controller'; |
import BoardCtrl from './board.controller'; |
||||||
import SETTINGS from '../AppSettings'; |
import SETTINGS from '../../AppSettings'; |
||||||
|
|
||||||
let x = 0; |
let x = 0; |
||||||
let y = 0; |
let y = 0; |
@ -1,5 +1,5 @@ |
|||||||
import * as ScorebarActions from '../actions/board/scorebar.actions'; |
import * as ScorebarActions from '../../actions/board/scorebar.actions'; |
||||||
import SETTINGS from '../AppSettings'; |
import SETTINGS from '../../AppSettings'; |
||||||
|
|
||||||
let dispatch; |
let dispatch; |
||||||
let lives = SETTINGS.LIVES; |
let lives = SETTINGS.LIVES; |
@ -1,5 +1,5 @@ |
|||||||
import * as TitlebarActions from '../actions/board/titlebar.actions'; |
import * as TitlebarActions from '../../actions/board/titlebar.actions'; |
||||||
import MultiplesModel from '../models/multiples.model'; |
import MultiplesModel from '../../models/multiples.model'; |
||||||
|
|
||||||
let dispatch; |
let dispatch; |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
import SETTINGS from '../AppSettings'; |
import SETTINGS from '../../AppSettings'; |
||||||
|
|
||||||
import * as TroggleActions from '../actions/board/troggle.actions'; |
import * as TroggleActions from '../../actions/board/troggle.actions'; |
||||||
import MuncherCtrl from './muncher.controller'; |
import MuncherCtrl from './muncher.controller'; |
||||||
import BoardCtrl from './board.controller'; |
import BoardCtrl from './board.controller'; |
||||||
|
|
@ -0,0 +1,42 @@ |
|||||||
|
import * as OptionsActions from '../../actions/options/options.actions'; |
||||||
|
import ModeCtrl from '../mode.controller'; |
||||||
|
|
||||||
|
let dispatch; |
||||||
|
const values = ['Multiples', 'Factors', 'Equality', 'Inequality']; |
||||||
|
let selected = 0; |
||||||
|
|
||||||
|
const OptionsCtrl = { |
||||||
|
setDispatch: d => dispatch = d, |
||||||
|
|
||||||
|
getValues: () => values, |
||||||
|
|
||||||
|
update() { |
||||||
|
dispatch(OptionsActions.update(selected)); |
||||||
|
}, |
||||||
|
|
||||||
|
keyListener(e) { |
||||||
|
if (e.keyCode === 32) { |
||||||
|
ModeCtrl.board(); |
||||||
|
} |
||||||
|
else if (e.keyCode === 38) { |
||||||
|
selected--; |
||||||
|
|
||||||
|
if (selected === -1) { |
||||||
|
selected = values.length - 1; |
||||||
|
} |
||||||
|
|
||||||
|
this.update(); |
||||||
|
} |
||||||
|
else if (e.keyCode === 40) { |
||||||
|
selected++; |
||||||
|
|
||||||
|
if (selected === values.length) { |
||||||
|
selected = 0; |
||||||
|
} |
||||||
|
|
||||||
|
this.update(); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export default OptionsCtrl; |
Loading…
Reference in new issue