More memory fixes.

This commit is contained in:
Scott Erickson 2014-02-11 12:32:12 -08:00
parent b0a74e5b1a
commit 7ddb97fa22
2 changed files with 8 additions and 5 deletions

View file

@ -89,7 +89,10 @@ module.exports = Surface = class Surface extends CocoClass
@dimmer?.destroy()
@stage.clear()
@musicPlayer?.destroy()
@stage.removeEventListener 'stagemousemove', @onMouseMove
@stage.removeEventListener 'stagemousedown', @onMouseDown
@stage.removeAllEventListeners()
setWorld: (@world) ->
@worldLoaded = true
@world.getFrame(Math.min(@getCurrentFrame(), @world.totalFrames - 1)).restoreState() unless @options.choosing

View file

@ -46,7 +46,7 @@ module.exports = class GoalManager extends CocoClass
'world:thang-collected-item': 'onThangCollectedItem'
'world:ended': 'onWorldEnded'
onLevelRestarted: =>
onLevelRestarted: ->
@goals = []
@goalStates = {}
@userCodeMap = {}
@ -55,12 +55,12 @@ module.exports = class GoalManager extends CocoClass
# INTERFACE AND LIFETIME OVERVIEW
# main instance receives goal updates from the script manager
onAddGoals: (e) =>
onAddGoals: (e) ->
return unless e.worldName is @world.name
goals = e.goals
@addGoal(goal) for goal in goals
onRemoveGoals: (e) =>
onRemoveGoals: (e) ->
if e.goal in @goals
@goals.remove(e.goal)
delete @goalStates[e.goal]
@ -88,7 +88,7 @@ module.exports = class GoalManager extends CocoClass
# main instance gets them and updates their existing goal states,
# passes the word along
onNewWorldCreated: (e) =>
onNewWorldCreated: (e) ->
@updateGoalStates(e.goalStates) if e.goalStates?
@world = e.world