Trying to stagger LevelSessions saves on wins on replayable levels to see if that might help #2108 at all.

This commit is contained in:
Nick Winter 2015-01-22 12:26:37 -08:00
parent e75e0791d0
commit e3bf8f74ab
2 changed files with 7 additions and 4 deletions

View file

@ -54,13 +54,13 @@ module.exports = class LevelSession extends CocoModel
return if @shouldAvoidCorruptData attrs
super attrs, options
increaseDifficulty: ->
increaseDifficulty: (callback) ->
state = @get('state') ? {}
state.difficulty = (state.difficulty ? 0) + 1
delete state.lastUnsuccessfulSubmissionTime
@set 'state', state
@save()
@trigger 'change-difficulty'
@save null, success: callback
timeUntilResubmit: ->
state = @get('state') ? {}

View file

@ -523,8 +523,11 @@ module.exports = class PlayLevelView extends RootView
return if @destroyed
# TODO: Show a victory dialog specific to hero-ladder level
if @goalManager.checkOverallStatus() is 'success' and not @options.realTimeMultiplayerSessionID?
@session.increaseDifficulty() if @level.get 'replayable'
Backbone.Mediator.publish 'level:show-victory', showModal: true
showModalFn = -> Backbone.Mediator.publish 'level:show-victory', showModal: true
if @level.get 'replayable'
@session.increaseDifficulty showModalFn
else
showModalFn()
destroy: ->
@levelLoader?.destroy()