mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-16 00:19:50 -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
|
@level = @supermodel.loadModel(@level, 'level').model
|
||||||
if @level.loaded then @onLevelSync() else @listenToOnce @level, 'sync', @onLevelSync
|
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: ->
|
onLevelSync: ->
|
||||||
return if @destroyed
|
return if @destroyed
|
||||||
if @waitingToLoadModals
|
if @waitingToLoadModals
|
||||||
@waitingToLoadModals = false
|
@waitingToLoadModals = false
|
||||||
@loadModals()
|
@loadModals()
|
||||||
|
|
||||||
loadSession: ->
|
onSessionSync: ->
|
||||||
sessionURL = "/db/level/#{@options.levelID}/session"
|
return if @destroyed
|
||||||
#sessionURL += "?team=#{@team}" if @options.team # TODO: figure out how to get the teams for multiplayer PVP hero style
|
@session.url = -> '/db/level.session/' + @id
|
||||||
sessionURL += "?course=#{@options.courseID}" if @options.courseID
|
@fillSessionWithDefaults()
|
||||||
@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
|
|
||||||
|
|
||||||
fillSessionWithDefaults: ->
|
fillSessionWithDefaults: ->
|
||||||
heroConfig = _.merge {}, me.get('heroConfig'), @session.get('heroConfig')
|
heroConfig = _.merge {}, me.get('heroConfig'), @session.get('heroConfig')
|
||||||
|
|
Loading…
Reference in a new issue