Fix bug with slow-loading sessions never opening play button

This commit is contained in:
Nick Winter 2015-12-07 04:39:33 -08:00
parent 80b72edff1
commit 6a82def75a

View file

@ -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')