mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Fix bug with slow-loading sessions never opening play button
This commit is contained in:
parent
80b72edff1
commit
6a82def75a
1 changed files with 12 additions and 12 deletions
|
@ -28,24 +28,24 @@ module.exports = class LevelSetupManager extends CocoClass
|
|||
@level = @supermodel.loadModel(@level, 'level').model
|
||||
if @level.loaded then @onLevelSync() else @listenToOnce @level, 'sync', @onLevelSync
|
||||
|
||||
loadSession: ->
|
||||
sessionURL = "/db/level/#{@options.levelID}/session"
|
||||
#sessionURL += "?team=#{@team}" if @options.team # TODO: figure out how to get the teams for multiplayer PVP hero style
|
||||
sessionURL += "?course=#{@options.courseID}" if @options.courseID
|
||||
@session = new LevelSession().setURL sessionURL
|
||||
@session = @supermodel.loadModel(@session, 'level_session').model
|
||||
if @session.loaded then @onSessionSync() else @listenToOnce @session, 'sync', @onSessionSync
|
||||
|
||||
onLevelSync: ->
|
||||
return if @destroyed
|
||||
if @waitingToLoadModals
|
||||
@waitingToLoadModals = false
|
||||
@loadModals()
|
||||
|
||||
loadSession: ->
|
||||
sessionURL = "/db/level/#{@options.levelID}/session"
|
||||
#sessionURL += "?team=#{@team}" if @options.team # TODO: figure out how to get the teams for multiplayer PVP hero style
|
||||
sessionURL += "?course=#{@options.courseID}" if @options.courseID
|
||||
@session = new LevelSession().setURL sessionURL
|
||||
onSessionSync = ->
|
||||
return if @destroyed
|
||||
@session.url = -> '/db/level.session/' + @id
|
||||
@fillSessionWithDefaults()
|
||||
@listenToOnce @session, 'sync', onSessionSync
|
||||
@session = @supermodel.loadModel(@session, 'level_session').model
|
||||
onSessionSync.call @ if @session.loaded
|
||||
onSessionSync: ->
|
||||
return if @destroyed
|
||||
@session.url = -> '/db/level.session/' + @id
|
||||
@fillSessionWithDefaults()
|
||||
|
||||
fillSessionWithDefaults: ->
|
||||
heroConfig = _.merge {}, me.get('heroConfig'), @session.get('heroConfig')
|
||||
|
|
Loading…
Reference in a new issue