mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Figured out how to get the world to properly get shown if the world is created before the level loader is completely finished.
This commit is contained in:
parent
cab1adf8fc
commit
0be813e424
2 changed files with 5 additions and 7 deletions
|
@ -84,6 +84,8 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@initAudio()
|
||||
@onResize = _.debounce @onResize, 500
|
||||
$(window).on 'resize', @onResize
|
||||
if @world.ended
|
||||
_.defer => @setWorld @world
|
||||
|
||||
destroy: ->
|
||||
@dead = true
|
||||
|
|
|
@ -60,7 +60,6 @@ module.exports = class PlayLevelView extends View
|
|||
'surface:world-set-up': 'onSurfaceSetUpNewWorld'
|
||||
'level:session-will-save': 'onSessionWillSave'
|
||||
'level:set-team': 'setTeam'
|
||||
'god:new-world-created': 'loadSoundsForWorld'
|
||||
'level:started': 'onLevelStarted'
|
||||
'level:loading-view-unveiled': 'onLoadingViewUnveiled'
|
||||
|
||||
|
@ -309,9 +308,6 @@ module.exports = class PlayLevelView extends View
|
|||
$('#level-done-button', @$el).hide()
|
||||
application.tracker?.trackEvent 'Confirmed Restart', level: @world.name, label: @world.name
|
||||
|
||||
onNewWorld: (e) ->
|
||||
@world = e.world
|
||||
|
||||
onInfiniteLoop: (e) ->
|
||||
return unless e.firstWorld
|
||||
@openModalView new InfiniteLoopModal()
|
||||
|
@ -484,11 +480,11 @@ module.exports = class PlayLevelView extends View
|
|||
|
||||
# Dynamic sound loading
|
||||
|
||||
loadSoundsForWorld: (e) ->
|
||||
onNewWorld: (e) ->
|
||||
return if @headless
|
||||
world = e.world
|
||||
@world = e.world
|
||||
thangTypes = @supermodel.getModels(ThangType)
|
||||
for [spriteName, message] in world.thangDialogueSounds()
|
||||
for [spriteName, message] in @world.thangDialogueSounds()
|
||||
continue unless thangType = _.find thangTypes, (m) -> m.get('name') is spriteName
|
||||
continue unless sound = AudioPlayer.soundForDialogue message, thangType.get('soundTriggers')
|
||||
AudioPlayer.preloadSoundReference sound
|
||||
|
|
Loading…
Reference in a new issue