mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -04:00
More memory fixes.
This commit is contained in:
parent
b0a74e5b1a
commit
7ddb97fa22
2 changed files with 8 additions and 5 deletions
app/lib
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue