Adds default scripts whenever a new level is created

This commit is contained in:
Jayant Jain 2014-08-13 11:57:04 +05:30
parent 1e52f237b7
commit 76c784b1de
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,25 @@
module.exports = [
{
channel: "god:new-world-created"
noteChain: []
id: "Introduction"
}
{
channel: "world:won"
noteChain: []
id: "Victory Playback"
scriptPrereqs: ["Introduction"]
}
{
channel: "level-set-playing"
noteChain: []
scriptPrereqs: ["Victory Playback"]
id: "Victory Playback Started"
}
{
channel: "surface:frame-changed"
noteChain: []
scriptPrereqs: ["Victory Playback Started"]
id: "Show Victory"
}
]

View file

@ -3,6 +3,7 @@ template = require 'templates/editor/level/scripts_tab'
Level = require 'models/Level'
Surface = require 'lib/surface/Surface'
nodes = require './../treema_nodes'
defaultScripts = require 'lib/DefaultScripts'
module.exports = class ScriptsTabView extends CocoView
id: 'editor-level-scripts-tab-view'
@ -22,6 +23,8 @@ module.exports = class ScriptsTabView extends CocoView
@level = e.level
@dimensions = @level.dimensions()
scripts = $.extend(true, [], @level.get('scripts') ? [])
if scripts.length is 0
scripts = $.extend(true, [], defaultScripts)
treemaOptions =
schema: Level.schema.properties.scripts
data: scripts