Fixed , pressing esc while loading level, and CocoSprites updating actions and other things unnecessarily while paused. Watch for bugs with that last one.

This commit is contained in:
Nick Winter 2014-03-12 09:10:36 -07:00
parent da762fbc4f
commit 2e354a7f11
4 changed files with 9 additions and 5 deletions

View file

@ -167,10 +167,11 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
@imageObject?.play?() @imageObject?.play?()
mark.play() for name, mark of @marks mark.play() for name, mark of @marks
update: -> update: (frameChanged) ->
# Gets the sprite to reflect what the current state of the thangs and surface are # Gets the sprite to reflect what the current state of the thangs and surface are
return if @stillLoading return if @stillLoading
@updatePosition() @updatePosition()
return unless frameChanged
@updateScale() @updateScale()
@updateAlpha() @updateAlpha()
@updateRotation() @updateRotation()

View file

@ -158,7 +158,7 @@ module.exports = class SpriteBoss extends CocoClass
update: (frameChanged) -> update: (frameChanged) ->
@adjustSpriteExistence() if frameChanged @adjustSpriteExistence() if frameChanged
sprite.update() for thangID, sprite of @sprites sprite.update frameChanged for thangID, sprite of @sprites
@updateSelection() @updateSelection()
@spriteLayers["Default"].updateLayerOrder() @spriteLayers["Default"].updateLayerOrder()
@cache() @cache()
@ -181,7 +181,7 @@ module.exports = class SpriteBoss extends CocoClass
sprite.hasMoved = false sprite.hasMoved = false
@removeSprite sprite if missing @removeSprite sprite if missing
@cache true if updateCache and @cached @cache true if updateCache and @cached
# mainly for handling selecting thangs from session when the thang is not always in existence # mainly for handling selecting thangs from session when the thang is not always in existence
if @willSelectThang and @sprites[@willSelectThang[0]] if @willSelectThang and @sprites[@willSelectThang[0]]
@selectThang @willSelectThang... @selectThang @willSelectThang...
@ -212,12 +212,12 @@ module.exports = class SpriteBoss extends CocoClass
@play() @play()
onCastSpells: -> @stop() onCastSpells: -> @stop()
play: -> play: ->
sprite.imageObject.play() for thangID, sprite of @sprites sprite.imageObject.play() for thangID, sprite of @sprites
@selectionMark?.play() @selectionMark?.play()
@targetMark?.play() @targetMark?.play()
stop: -> stop: ->
sprite.imageObject.stop() for thangID, sprite of @sprites sprite.imageObject.stop() for thangID, sprite of @sprites
@selectionMark?.stop() @selectionMark?.stop()

View file

@ -208,10 +208,12 @@ module.exports = Surface = class Surface extends CocoClass
@onFramesScrubbed() # For performance, don't play these for instant transitions. @onFramesScrubbed() # For performance, don't play these for instant transitions.
onTweenEnd() onTweenEnd()
return unless @loaded
@updateState true @updateState true
@onFrameChanged() @onFrameChanged()
onFramesScrubbed: (e) => onFramesScrubbed: (e) =>
return unless @loaded
if e if e
# Gotta play all the sounds when scrubbing (but not when doing an immediate transition). # Gotta play all the sounds when scrubbing (but not when doing an immediate transition).
rising = @currentFrame > @lastFrame rising = @currentFrame > @lastFrame

View file

@ -44,6 +44,7 @@ module.exports = class SpellPaletteView extends View
allDocs = {} allDocs = {}
for lc in lcs for lc in lcs
for doc in (lc.get('propertyDocumentation') ? []) for doc in (lc.get('propertyDocumentation') ? [])
doc = _.clone doc
allDocs['__' + doc.name] ?= [] allDocs['__' + doc.name] ?= []
allDocs['__' + doc.name].push doc allDocs['__' + doc.name].push doc
if doc.type is 'snippet' then doc.owner = 'snippets' if doc.type is 'snippet' then doc.owner = 'snippets'