mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed the level preview view.
This commit is contained in:
parent
47effcd50e
commit
f230e8983c
1 changed files with 9 additions and 5 deletions
|
@ -71,20 +71,24 @@ module.exports = class PlayLevelView extends View
|
|||
window.tracker?.trackEvent 'Hour of Code Begin', {}
|
||||
|
||||
@isEditorPreview = @getQueryVariable "dev"
|
||||
sessionID = @getQueryVariable "session"
|
||||
@levelLoader = new LevelLoader(@levelID, @supermodel, sessionID)
|
||||
@levelLoader.once 'ready-to-init-world', @onReadyToInitWorld
|
||||
@levelLoader.once 'loaded-all', @onLevelLoaderLoaded
|
||||
@sessionID = @getQueryVariable "session"
|
||||
|
||||
$(window).on('resize', @onWindowResize)
|
||||
@supermodel.once 'error', =>
|
||||
msg = $.i18n.t('play_level.level_load_error', defaultValue: "Level could not be loaded.")
|
||||
@$el.html('<div class="alert">' + msg + '</div>')
|
||||
@saveScreenshot = _.throttle @saveScreenshot, 30000
|
||||
|
||||
@load() unless @isEditorPreview
|
||||
|
||||
setLevel: (@level, @supermodel) ->
|
||||
@god?.level = @level.serialize @supermodel
|
||||
@initWorld()
|
||||
@load()
|
||||
|
||||
load: ->
|
||||
@levelLoader = new LevelLoader(@levelID, @supermodel, @sessionID)
|
||||
@levelLoader.once 'ready-to-init-world', @onReadyToInitWorld
|
||||
@levelLoader.once 'loaded-all', @onLevelLoaderLoaded
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
|
|
Loading…
Reference in a new issue