mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-29 23:43:51 -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()
|
@dimmer?.destroy()
|
||||||
@stage.clear()
|
@stage.clear()
|
||||||
@musicPlayer?.destroy()
|
@musicPlayer?.destroy()
|
||||||
|
@stage.removeEventListener 'stagemousemove', @onMouseMove
|
||||||
|
@stage.removeEventListener 'stagemousedown', @onMouseDown
|
||||||
|
@stage.removeAllEventListeners()
|
||||||
|
|
||||||
setWorld: (@world) ->
|
setWorld: (@world) ->
|
||||||
@worldLoaded = true
|
@worldLoaded = true
|
||||||
@world.getFrame(Math.min(@getCurrentFrame(), @world.totalFrames - 1)).restoreState() unless @options.choosing
|
@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:thang-collected-item': 'onThangCollectedItem'
|
||||||
'world:ended': 'onWorldEnded'
|
'world:ended': 'onWorldEnded'
|
||||||
|
|
||||||
onLevelRestarted: =>
|
onLevelRestarted: ->
|
||||||
@goals = []
|
@goals = []
|
||||||
@goalStates = {}
|
@goalStates = {}
|
||||||
@userCodeMap = {}
|
@userCodeMap = {}
|
||||||
|
@ -55,12 +55,12 @@ module.exports = class GoalManager extends CocoClass
|
||||||
# INTERFACE AND LIFETIME OVERVIEW
|
# INTERFACE AND LIFETIME OVERVIEW
|
||||||
|
|
||||||
# main instance receives goal updates from the script manager
|
# main instance receives goal updates from the script manager
|
||||||
onAddGoals: (e) =>
|
onAddGoals: (e) ->
|
||||||
return unless e.worldName is @world.name
|
return unless e.worldName is @world.name
|
||||||
goals = e.goals
|
goals = e.goals
|
||||||
@addGoal(goal) for goal in goals
|
@addGoal(goal) for goal in goals
|
||||||
|
|
||||||
onRemoveGoals: (e) =>
|
onRemoveGoals: (e) ->
|
||||||
if e.goal in @goals
|
if e.goal in @goals
|
||||||
@goals.remove(e.goal)
|
@goals.remove(e.goal)
|
||||||
delete @goalStates[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,
|
# main instance gets them and updates their existing goal states,
|
||||||
# passes the word along
|
# passes the word along
|
||||||
onNewWorldCreated: (e) =>
|
onNewWorldCreated: (e) ->
|
||||||
@updateGoalStates(e.goalStates) if e.goalStates?
|
@updateGoalStates(e.goalStates) if e.goalStates?
|
||||||
@world = e.world
|
@world = e.world
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue