mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Save autocastDelay as a setting on User re #627
This commit is contained in:
parent
5a2b5667cf
commit
b1b0579cb3
3 changed files with 5 additions and 5 deletions
|
@ -32,8 +32,7 @@ module.exports = class CastButtonView extends View
|
||||||
@castOptions = $('.autocast-delays', @$el)
|
@castOptions = $('.autocast-delays', @$el)
|
||||||
@castButton.on 'click', @onCastButtonClick
|
@castButton.on 'click', @onCastButtonClick
|
||||||
@castOptions.find('a').on 'click', @onCastOptionsClick
|
@castOptions.find('a').on 'click', @onCastOptionsClick
|
||||||
# TODO: use a User setting instead of localStorage
|
delay = me.get('autocastDelay')
|
||||||
delay = localStorage.getItem 'autocastDelay'
|
|
||||||
delay ?= 5000
|
delay ?= 5000
|
||||||
if @levelID in ['brawlwood', 'brawlwood-tutorial', 'dungeon-arena', 'dungeon-arena-tutorial']
|
if @levelID in ['brawlwood', 'brawlwood-tutorial', 'dungeon-arena', 'dungeon-arena-tutorial']
|
||||||
delay = 90019001
|
delay = 90019001
|
||||||
|
@ -88,7 +87,8 @@ module.exports = class CastButtonView extends View
|
||||||
#console.log "Set autocast delay to", delay
|
#console.log "Set autocast delay to", delay
|
||||||
return unless delay
|
return unless delay
|
||||||
@autocastDelay = delay = parseInt delay
|
@autocastDelay = delay = parseInt delay
|
||||||
localStorage.setItem 'autocastDelay', delay
|
me.set('autocastDelay', delay)
|
||||||
|
me.save()
|
||||||
spell.view.setAutocastDelay delay for spellKey, spell of @spells
|
spell.view.setAutocastDelay delay for spellKey, spell of @spells
|
||||||
@castOptions.find('a').each ->
|
@castOptions.find('a').each ->
|
||||||
$(@).toggleClass('selected', parseInt($(@).attr('data-delay')) is delay)
|
$(@).toggleClass('selected', parseInt($(@).attr('data-delay')) is delay)
|
||||||
|
|
|
@ -18,7 +18,7 @@ UserHandler = class UserHandler extends Handler
|
||||||
'name', 'photoURL', 'password', 'anonymous', 'wizardColor1', 'volume',
|
'name', 'photoURL', 'password', 'anonymous', 'wizardColor1', 'volume',
|
||||||
'firstName', 'lastName', 'gender', 'facebookID', 'emailSubscriptions',
|
'firstName', 'lastName', 'gender', 'facebookID', 'emailSubscriptions',
|
||||||
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
|
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
|
||||||
'wizard', 'aceConfig', 'simulatedBy', 'simulatedFor'
|
'wizard', 'aceConfig', 'simulatedBy', 'simulatedFor', 'autocastDelay'
|
||||||
]
|
]
|
||||||
|
|
||||||
jsonSchema: schema
|
jsonSchema: schema
|
||||||
|
|
|
@ -17,7 +17,7 @@ UserSchema = c.object {},
|
||||||
wizardColor1: c.pct({title: 'Wizard Clothes Color'})
|
wizardColor1: c.pct({title: 'Wizard Clothes Color'})
|
||||||
volume: c.pct({title: 'Volume'})
|
volume: c.pct({title: 'Volume'})
|
||||||
music: {type: 'boolean', default: true}
|
music: {type: 'boolean', default: true}
|
||||||
#autocastDelay, or more complex autocast options? I guess I'll see what I need when trying to hook up Scott's suggested autocast behavior
|
autocastDelay: {type: 'integer', 'default': 5000 }
|
||||||
|
|
||||||
emailSubscriptions: c.array {uniqueItems: true, 'default': ['announcement', 'notification']}, {'enum': emailSubscriptions}
|
emailSubscriptions: c.array {uniqueItems: true, 'default': ['announcement', 'notification']}, {'enum': emailSubscriptions}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue