Added support for test campaigns that don't save their levels/achievements

This commit is contained in:
Nick Winter 2015-10-16 16:06:53 -07:00
parent d5288a254b
commit 5f8ab8a212
2 changed files with 14 additions and 12 deletions

View file

@ -133,6 +133,7 @@ module.exports = class CampaignEditorView extends RootView
@campaign.set('levels', campaignLevels)
for level in _.values campaignLevels
continue if /test/.test @campaign.get('slug') # Don't overwrite level stuff for testing Campaigns
model = @levels.findWhere {original: level.original}
model.set key, level[key] for key in Campaign.denormalizedLevelProperties
@toSave.add model if model.hasLocalChanges()
@ -201,6 +202,7 @@ module.exports = class CampaignEditorView extends RootView
@insertSubView @campaignView
onTreemaChanged: (e, nodes) =>
unless /test/.test @campaign.get('slug') # Don't overwrite level stuff for testing Campaigns
for node in nodes
path = node.getPath()
if _.string.startsWith path, '/levels/'
@ -329,6 +331,7 @@ class LevelNode extends TreemaObjectNode
populateData: ->
return if @data.name?
data = _.pick LevelsNode.levels[@keyForParent].attributes, Campaign.denormalizedLevelProperties
console.log 'got the data', data
_.extend @data, data
class CampaignsNode extends TreemaObjectNode

View file

@ -184,7 +184,6 @@ module.exports = class CampaignView extends RootView
context.levelDifficultyMap = @levelDifficultyMap
context.levelPlayCountMap = @levelPlayCountMap
context.isIPadApp = application.isIPadApp
context.mapType = _.string.slugify @terrain
context.requiresSubscription = @requiresSubscription
context.editorMode = @editorMode
context.adjacentCampaigns = _.filter _.values(_.cloneDeep(@campaign?.get('adjacentCampaigns') or {})), (ac) =>
@ -378,7 +377,7 @@ module.exports = class CampaignView extends RootView
@particleMan.removeEmitters()
@particleMan.attach @$el.find('.map')
for level in @campaign.renderedLevels ? {}
particleKey = ['level', @terrain]
particleKey = ['level', @terrain.replace('-branching-test', '')]
particleKey.push level.type if level.type and not (level.type in ['hero', 'course'])
particleKey.push 'replayable' if level.replayable
particleKey.push 'premium' if level.requiresSubscription