buildTime stuff.

This commit is contained in:
Nick Winter 2015-01-10 09:33:36 -08:00
parent b5103aaa49
commit 5c352699b0
3 changed files with 11 additions and 0 deletions
app
schemas/models
views/editor/level
server/levels

View file

@ -300,6 +300,7 @@ _.extend LevelSchema.properties,
free: {type: 'boolean', title: 'Free', description: 'Whether this video is freely available to all players without a subscription.'}
url: c.url {title: 'URL', description: 'Link to the video on Vimeo.'}
replayable: {type: 'boolean', title: 'Replayable', description: 'Whether this (hero) level infinitely scales up its difficulty and can be beaten over and over for greater rewards.'}
buildTime: {type: 'number', description: 'How long it has taken to build this level.'}
# Admin flags
adventurer: { type: 'boolean' }

View file

@ -63,6 +63,10 @@ module.exports = class LevelEditView extends RootView
@files = new DocumentFiles(@levelLoader.level)
@supermodel.loadCollection(@files, 'file_names')
destroy: ->
clearInterval @timerIntervalID
super()
showLoading: ($el) ->
$el ?= @$el.find('.outer-content')
super($el)
@ -73,6 +77,7 @@ module.exports = class LevelEditView extends RootView
_.defer =>
@world = @levelLoader.world
@render()
@timerIntervalID = setInterval @incrementBuildTime, 1000
getRenderData: (context={}) ->
context = super(context)
@ -192,3 +197,7 @@ module.exports = class LevelEditView extends RootView
return if @initializedDocs
@initializedDocs = true
@$el.find('a[href="#components-documentation-view"]').click()
incrementBuildTime: =>
return if application.userIsIdle
@level.set('buildTime', (@level.get('buildTime') ? 0) + 1)

View file

@ -56,6 +56,7 @@ LevelHandler = class LevelHandler extends Handler
'helpVideos'
'campaign'
'replayable'
'buildTime'
]
postEditableProperties: ['name']