mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Fixed a bug where the jingle wouldn't play during level loading if the audio had been loaded previously.
This commit is contained in:
parent
74186b7772
commit
8d828939b6
2 changed files with 6 additions and 3 deletions
|
@ -74,7 +74,6 @@ class AudioPlayer extends CocoClass
|
|||
filename = "/file/interface/#{name}#{@ext}"
|
||||
if filename of cache and createjs.Sound.loadComplete filename
|
||||
@playSound name, volume
|
||||
createjs.Sound.play name
|
||||
else
|
||||
@preloadInterfaceSounds [name] unless filename of cache
|
||||
@soundsToPlayWhenLoaded[name] = volume
|
||||
|
|
|
@ -36,8 +36,12 @@ module.exports = class LevelLoader extends CocoClass
|
|||
|
||||
playJingle: ->
|
||||
return if @headless
|
||||
jingles = ["ident_1", "ident_2"]
|
||||
AudioPlayer.playInterfaceSound jingles[Math.floor Math.random() * jingles.length]
|
||||
# Apparently the jingle, when it tries to play immediately during all this loading, you can't hear it.
|
||||
# Add the timeout to fix this weird behavior.
|
||||
f = ->
|
||||
jingles = ["ident_1", "ident_2"]
|
||||
AudioPlayer.playInterfaceSound jingles[Math.floor Math.random() * jingles.length]
|
||||
setTimeout f, 500
|
||||
|
||||
# Session Loading
|
||||
|
||||
|
|
Loading…
Reference in a new issue