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?()
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
return if @stillLoading
@updatePosition()
return unless frameChanged
@updateScale()
@updateAlpha()
@updateRotation()

View file

@ -158,7 +158,7 @@ module.exports = class SpriteBoss extends CocoClass
update: (frameChanged) ->
@adjustSpriteExistence() if frameChanged
sprite.update() for thangID, sprite of @sprites
sprite.update frameChanged for thangID, sprite of @sprites
@updateSelection()
@spriteLayers["Default"].updateLayerOrder()
@cache()
@ -181,7 +181,7 @@ module.exports = class SpriteBoss extends CocoClass
sprite.hasMoved = false
@removeSprite sprite if missing
@cache true if updateCache and @cached
# mainly for handling selecting thangs from session when the thang is not always in existence
if @willSelectThang and @sprites[@willSelectThang[0]]
@selectThang @willSelectThang...
@ -212,12 +212,12 @@ module.exports = class SpriteBoss extends CocoClass
@play()
onCastSpells: -> @stop()
play: ->
sprite.imageObject.play() for thangID, sprite of @sprites
@selectionMark?.play()
@targetMark?.play()
stop: ->
sprite.imageObject.stop() for thangID, sprite of @sprites
@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.
onTweenEnd()
return unless @loaded
@updateState true
@onFrameChanged()
onFramesScrubbed: (e) =>
return unless @loaded
if e
# Gotta play all the sounds when scrubbing (but not when doing an immediate transition).
rising = @currentFrame > @lastFrame

View file

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