mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-24 21:13:35 -04:00
buildTime stuff.
This commit is contained in:
parent
b5103aaa49
commit
5c352699b0
3 changed files with 11 additions and 0 deletions
app
server/levels
|
@ -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' }
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -56,6 +56,7 @@ LevelHandler = class LevelHandler extends Handler
|
|||
'helpVideos'
|
||||
'campaign'
|
||||
'replayable'
|
||||
'buildTime'
|
||||
]
|
||||
|
||||
postEditableProperties: ['name']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue