Fixed some memory leaks. Fixed a couple minor bugs.

This commit is contained in:
Nick Winter 2015-01-31 12:23:34 -08:00
parent b8214e8b3c
commit 4b388f2775
11 changed files with 13 additions and 17 deletions

View file

@ -813,4 +813,5 @@ module.exports = Lank = class Lank extends CocoClass
p.removeChild @healthBar if p = @healthBar?.parent
@sprite?.off 'animationend', @playNextAction
clearInterval @effectInterval if @effectInterval
@dialogueSoundInstance?.removeAllEventListeners()
super()

View file

@ -86,10 +86,10 @@ if campaign.loaded
h1#campaign-status
.campaign-status-background
- var fullName = i18n(campaign.attributes, 'fullName')
if me.get('preferredLanguage', true).split('-')[0] == 'en' || fullName != campaign.get('fullName')
if (me.get('preferredLanguage', true) || 'en-US').split('-')[0] == 'en' || fullName != campaign.get('fullName')
// We have a translation.
span.spr= fullName
| -
span= fullName
| :
span.spl.spr= levelsCompleted
| /
span.spl= levelsTotal

View file

@ -39,7 +39,6 @@ module.exports = class SubscribeModal extends ModalView
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb2') + "</p>"
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb3') + "</p>"
#popoverContent = popoverContent.replace /9[.,]99/g, '3.99' # Sale
window.popoverContent = popoverContent
@$el.find('#parents-info').popover(
animation: true
html: true

View file

@ -91,7 +91,7 @@ module.exports = class ScriptsTabView extends CocoView
newPath = selected.getPath()
return if newPath is @selectedScriptPath
#@scriptTreema?.destroy() # TODO: get this to work
#@scriptTreema?.destroy() # TODO: get this to work
@scriptTreema = @$el.find('#script-treema').treema treemaOptions
@scriptTreema.build()
@scriptTreema.childrenTreemas?.noteChain?.open()
@ -123,7 +123,7 @@ module.exports = class ScriptsTabView extends CocoView
onThangsEdited: (e) ->
# Update in-place so existing Treema nodes refer to the same array.
@thangIDs?.splice(0, @thangIDs.length, @getThangIDs()...)
onWindowResize: (e) =>
@$el.find('#scripts-treema').collapse('show') if $('body').width() > 800
@ -158,7 +158,6 @@ class ScriptNode extends TreemaObjectNode
tabToCurrentScript: ->
@settings.view.scriptTreema?.keepFocus()
window.v = @settings.view
firstRow = @settings.view.scriptTreema?.$el.find('.treema-node:visible').data('instance')
return unless firstRow?
firstRow.select()

View file

@ -57,7 +57,6 @@ module.exports = class LevelThangEditView extends CocoView
thangTypeName = thangType?.get('name') or 'None'
input.val(thangTypeName)
@$el.find('#thang-type-link span').text(thangTypeName)
window.input = input
@hideLoading()
navigateToAllThangs: ->

View file

@ -163,7 +163,6 @@ module.exports = class ThangTypeColorsTabView extends CocoView
colors = {}
@buttons.find('button').each (i, button) ->
return unless $(button).hasClass('selected')
window.button = button
colors[$(button).val()] = true
shapes = []

View file

@ -46,7 +46,7 @@ module.exports = class LevelLoadingView extends CocoView
goalContainer = @$el.find('.level-loading-goals')
goalList = goalContainer.find('ul')
goalCount = 0
for goalID, goal of @level.get('goals') when (not goal.team or goal.team is e.team) and not goal.hiddenGoal
for goalID, goal of @level.get('goals') when (not goal.team or goal.team is (e.team or 'humans')) and not goal.hiddenGoal
name = utils.i18n goal, 'name'
goalList.append $('<li>' + name + '</li>')
++goalCount

View file

@ -126,7 +126,9 @@ module.exports = class DocFormatter
replaceSpriteName: (s) ->
# Prefer type, and excluded the quotes we'd get with @formatValue
s.replace /#{spriteName}/g, @options.thang.type ? @options.thang.spriteName
name = @options.thang.type ? @options.thang.spriteName
name = 'hero' if /Hero Placeholder/.test @options.thang.id
s.replace /#{spriteName}/g, name
formatValue: (v) ->
return null if @doc.type is 'snippet'

View file

@ -439,7 +439,7 @@ module.exports = class SpellView extends CocoView
attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"'
snippetEntries.push attackEntry
# window.zatannaInstance = @zatanna
# window.zatannaInstance = @zatanna # For debugging. Make sure to not leave active when committing.
# window.snippetEntries = snippetEntries
lang = SpellView.editModes[e.language].substr 'ace/mode/'.length
@zatanna.addSnippets snippetEntries, lang

View file

@ -52,8 +52,6 @@ module.exports = class LevelGuideView extends CocoView
window.removeEventListener('message', @onMessageReceived, false)
else
window.detachEvent('onmessage', @onMessageReceived, false)
if window.onYouTubeIframeAPIReady
window.onYouTubeIframeAPIReady = null
super()
getRenderData: ->

View file

@ -158,7 +158,7 @@ module.exports = class PlayHeroesModal extends ModalView
@rerenderFooter()
return
canvas.show().prop width: @canvasWidth, height: @canvasHeight
layer = new LayerAdapter({webGL:true})
@layers.push layer
layer.resolutionFactor = 8 # hi res!
@ -166,7 +166,7 @@ module.exports = class PlayHeroesModal extends ModalView
multiplier = 7
layer.scaleX = layer.scaleY = multiplier
lank = new Lank(fullHero, {preloadSounds: false})
layer.addLank(lank)
layer.on 'new-spritesheet', ->
#- maybe put some more normalization here?
@ -179,7 +179,6 @@ module.exports = class PlayHeroesModal extends ModalView
stage = new createjs.SpriteStage(canvas[0])
@stages[heroIndex] = stage
stage.addChild layer.container
window.stage = stage
stage.update()
unless preloading
createjs.Ticker.addEventListener 'tick', stage