mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Fix camera and spectate bugs with new loading intro behavior
This commit is contained in:
parent
18eef3b0ec
commit
42b53dff20
4 changed files with 16 additions and 4 deletions
|
@ -132,6 +132,16 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
setWorldLoading: (@worldLoading) ->
|
||||
@run() unless @worldLoading
|
||||
|
||||
initializeCamera: ->
|
||||
# Fire off the first bounds-setting script now, before we're actually running any other ones.
|
||||
for script in @scripts
|
||||
for note in script.noteChain or []
|
||||
if note.surface?.focus?
|
||||
surfaceModule = _.find note.modules or [], (module) -> module.surfaceCameraNote
|
||||
cameraNote = surfaceModule.surfaceCameraNote true
|
||||
@publishNote cameraNote
|
||||
return
|
||||
|
||||
destroy: ->
|
||||
@onEndAll()
|
||||
clearInterval @tickInterval
|
||||
|
|
|
@ -93,7 +93,7 @@ module.exports = class SpectateLevelView extends RootView
|
|||
|
||||
afterRender: ->
|
||||
window.onPlayLevelViewLoaded? @ # still a hack
|
||||
@insertSubView @loadingView = new LoadingView {}
|
||||
@insertSubView @loadingView = new LoadingView autoUnveil: true, level: @levelLoader?.level ? @level
|
||||
@$el.find('#level-done-button').hide()
|
||||
super()
|
||||
$('body').addClass('is-playing')
|
||||
|
@ -151,7 +151,7 @@ module.exports = class SpectateLevelView extends RootView
|
|||
onLevelStarted: (e) ->
|
||||
go = =>
|
||||
@loadingView?.startUnveiling()
|
||||
@loadingView?.unveil()
|
||||
@loadingView?.unveil true
|
||||
_.delay go, 1000
|
||||
|
||||
onLoadingViewUnveiled: (e) ->
|
||||
|
|
|
@ -45,14 +45,14 @@ module.exports = class LevelLoadingView extends CocoView
|
|||
|
||||
onLevelLoaded: (e) ->
|
||||
@level = e.level
|
||||
@prepareGoals()
|
||||
@prepareGoals e
|
||||
@prepareTip()
|
||||
@prepareIntro()
|
||||
|
||||
onSessionLoaded: (e) ->
|
||||
@session = e.session if e.session.get('creator') is me.id
|
||||
|
||||
prepareGoals: ->
|
||||
prepareGoals: (e) ->
|
||||
goalContainer = @$el.find('.level-loading-goals')
|
||||
goalList = goalContainer.find('ul')
|
||||
goalCount = 0
|
||||
|
|
|
@ -344,6 +344,8 @@ module.exports = class PlayLevelView extends RootView
|
|||
if (@isEditorPreview or @observing) and not @getQueryVariable('intro')
|
||||
@loadingView.startUnveiling()
|
||||
@loadingView.unveil true
|
||||
else
|
||||
@scriptManager.initializeCamera()
|
||||
|
||||
onLoadingViewUnveiling: (e) ->
|
||||
@selectHero()
|
||||
|
|
Loading…
Reference in a new issue