mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Fixed an issue with thang type marks not handling sprite sheet build completion correctly.
This commit is contained in:
parent
e38f26a8d0
commit
49c85bce5f
1 changed files with 6 additions and 0 deletions
|
@ -34,6 +34,7 @@ module.exports = class Mark extends CocoClass
|
||||||
|
|
||||||
onLayerMadeSpriteSheet: ->
|
onLayerMadeSpriteSheet: ->
|
||||||
return unless @sprite
|
return unless @sprite
|
||||||
|
return @update() if @markLank
|
||||||
# rebuild sprite for new sprite sheet
|
# rebuild sprite for new sprite sheet
|
||||||
@layer.removeChild @sprite
|
@layer.removeChild @sprite
|
||||||
@sprite = null
|
@sprite = null
|
||||||
|
@ -236,12 +237,14 @@ module.exports = class Mark extends CocoClass
|
||||||
@sprite.scaleY = h / (@layer.resolutionFactor * DEBUG_SIZE)
|
@sprite.scaleY = h / (@layer.resolutionFactor * DEBUG_SIZE)
|
||||||
|
|
||||||
buildSprite: ->
|
buildSprite: ->
|
||||||
|
console.log 'build sprite?'
|
||||||
if _.isString @thangType
|
if _.isString @thangType
|
||||||
thangType = markThangTypes[@thangType]
|
thangType = markThangTypes[@thangType]
|
||||||
return @loadThangType() if not thangType
|
return @loadThangType() if not thangType
|
||||||
@thangType = thangType
|
@thangType = thangType
|
||||||
|
|
||||||
return @listenToOnce(@thangType, 'sync', @onLoadedThangType) if not @thangType.loaded
|
return @listenToOnce(@thangType, 'sync', @onLoadedThangType) if not @thangType.loaded
|
||||||
|
console.log 'loaded, so go ahead!'
|
||||||
Lank = require './Lank'
|
Lank = require './Lank'
|
||||||
# don't bother with making these render async for now, but maybe later for fun and more complexity of code
|
# don't bother with making these render async for now, but maybe later for fun and more complexity of code
|
||||||
markLank = new Lank @thangType
|
markLank = new Lank @thangType
|
||||||
|
@ -249,6 +252,7 @@ module.exports = class Mark extends CocoClass
|
||||||
@sprite = markLank.sprite
|
@sprite = markLank.sprite
|
||||||
@markLank = markLank
|
@markLank = markLank
|
||||||
@listenTo @markLank, 'new-sprite', (@sprite) ->
|
@listenTo @markLank, 'new-sprite', (@sprite) ->
|
||||||
|
console.log 'oh yes, all done', markLank, @markLank
|
||||||
|
|
||||||
loadThangType: ->
|
loadThangType: ->
|
||||||
name = @thangType
|
name = @thangType
|
||||||
|
@ -259,7 +263,9 @@ module.exports = class Mark extends CocoClass
|
||||||
markThangTypes[name] = @thangType
|
markThangTypes[name] = @thangType
|
||||||
|
|
||||||
onLoadedThangType: ->
|
onLoadedThangType: ->
|
||||||
|
console.log 'on loaded thang type...', @name
|
||||||
@build()
|
@build()
|
||||||
|
@update() if @markLank
|
||||||
@toggle(@toggleTo) if @toggleTo?
|
@toggle(@toggleTo) if @toggleTo?
|
||||||
Backbone.Mediator.publish 'sprite:loaded', {sprite: @}
|
Backbone.Mediator.publish 'sprite:loaded', {sprite: @}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue