Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-08-27 12:27:10 -07:00
commit 4d3c5524a8
136 changed files with 1915 additions and 2342 deletions

View file

@ -10,7 +10,7 @@ module.exports = class CocoRouter extends Backbone.Router
initialize: ->
# http://nerds.airbnb.com/how-to-add-google-analytics-page-tracking-to-57536
@bind 'route', @_trackPageView
Backbone.Mediator.subscribe 'gapi-loaded', @onGPlusAPILoaded, @
Backbone.Mediator.subscribe 'auth:gplus-api-loaded', @onGPlusAPILoaded, @
Backbone.Mediator.subscribe 'router:navigate', @onNavigate, @
routes:
@ -49,7 +49,7 @@ module.exports = class CocoRouter extends Backbone.Router
'demo(/*subpath)': go('DemoView')
'docs/components': go('docs/ComponentDocumentationView')
'editor': go('editor/MainEditorView')
'editor': go('CommunityView')
'editor/achievement': go('editor/achievement/AchievementSearchView')
'editor/achievement/:articleID': go('editor/achievement/AchievementEditView')

View file

@ -2,7 +2,7 @@ Backbone.Mediator.setValidationEnabled false
app = require 'application'
channelSchemas =
'app': require './schemas/subscriptions/app'
'auth': require './schemas/subscriptions/auth'
'bus': require './schemas/subscriptions/bus'
'editor': require './schemas/subscriptions/editor'
'errors': require './schemas/subscriptions/errors'
@ -10,8 +10,8 @@ channelSchemas =
'play': require './schemas/subscriptions/play'
'surface': require './schemas/subscriptions/surface'
'tome': require './schemas/subscriptions/tome'
'user': require './schemas/subscriptions/user'
'world': require './schemas/subscriptions/world'
'god': require './schemas/subscriptions/god'
'scripts': require './schemas/subscriptions/scripts'
definitionSchemas =
'bus': require './schemas/definitions/bus'

View file

@ -91,7 +91,7 @@ module.exports = class Angel extends CocoClass
when 'user-code-problem'
Backbone.Mediator.publish 'god:user-code-problem', problem: event.data.problem
when 'world-load-progress-changed'
Backbone.Mediator.publish 'god:world-load-progress-changed', event.data
Backbone.Mediator.publish 'god:world-load-progress-changed', progress: event.data.progress
unless event.data.progress is 1 or @work.preload or @work.headless or @work.synchronous or @deserializationQueue.length or @shared.firstWorld
@worker.postMessage func: 'serializeFramesSoFar' # Stream it!

View file

@ -33,7 +33,7 @@ class Media
class AudioPlayer extends CocoClass
subscriptions:
'play-sound': (e) -> @playInterfaceSound e.trigger, e.volume
'audio-player:play-sound': (e) -> @playInterfaceSound e.trigger, e.volume
constructor: () ->
super()
@ -89,8 +89,10 @@ class AudioPlayer extends CocoClass
playSound: (name, volume=1, delay=0, pos=null) ->
audioOptions = {volume: (me.get('volume') ? 1) * volume, delay: delay}
unless @camera is null or pos is null
audioOptions = @applyPanning audioOptions, pos
filename = if _.string.startsWith(name, '/file/') then name else '/file/' + name
unless (filename of cache) and createjs.Sound.loadComplete filename
@soundsToPlayWhenLoaded[name] = audioOptions.volume
audioOptions = @applyPanning audioOptions, pos if @camera and pos
instance = createjs.Sound.play name, audioOptions
instance

View file

@ -19,11 +19,7 @@ module.exports = Bus = class Bus extends CocoClass
Bus.activeBuses[@docName] = @
subscriptions:
'level-bus-echo-states': 'onEchoStates'
'me:synced': 'onMeSynced'
onEchoStates: ->
@notifyStateChanges()
'auth:me-synced': 'onMeSynced'
connect: ->
Backbone.Mediator.publish 'bus:connecting', {bus: @}
@ -99,7 +95,7 @@ module.exports = Bus = class Bus extends CocoClass
@onPlayerJoined(snapshot) if player.connected and not wasConnected
Backbone.Mediator.publish('bus:player-states-changed', {states: @players, bus: @})
onMeSynced: =>
onMeSynced: ->
@myConnection?.child('name').set(me.get('name'))
countPlayers: -> _.size(@players)

View file

@ -11,7 +11,7 @@ module.exports = [
scriptPrereqs: ["Introduction"]
}
{
channel: "level-set-playing"
channel: "level:set-playing"
noteChain: []
scriptPrereqs: ["Victory Playback"]
id: "Victory Playback Started"

View file

@ -14,10 +14,9 @@ userPropsToSave =
module.exports = FacebookHandler = class FacebookHandler extends CocoClass
subscriptions:
'facebook-logged-in':'onFacebookLogin'
'facebook-logged-out': 'onFacebookLogout'
'auth:logged-in-with-facebook': 'onFacebookLoggedIn'
onFacebookLogin: (e) =>
onFacebookLoggedIn: (e) ->
# user is logged in also when the page first loads, so check to see
# if we really need to do the lookup
return if not me
@ -30,9 +29,6 @@ module.exports = FacebookHandler = class FacebookHandler extends CocoClass
break
FB.api('/me', @onReceiveMeInfo) if doIt
onFacebookLogout: (e) =>
console.warn('On facebook logout not implemented.')
onReceiveMeInfo: (r) =>
unless r.email
console.error('could not get data, since no email provided')
@ -45,7 +41,7 @@ module.exports = FacebookHandler = class FacebookHandler extends CocoClass
me.set('email', r.email) if r.email
me.set('facebookID', r.id) if r.id
Backbone.Mediator.publish('logging-in-with-facebook')
Backbone.Mediator.publish 'auth:logging-in-with-facebook', {}
window.tracker?.trackEvent 'Facebook Login'
window.tracker?.identify()
me.patch({

View file

@ -23,8 +23,8 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass
super()
subscriptions:
'gplus-logged-in':'onGPlusLogin'
'gapi-loaded':'onGPlusLoaded'
'auth:logged-in-with-gplus':'onGPlusLogin'
'auth:gplus-api-loaded':'onGPlusLoaded'
onGPlusLoaded: ->
session_state = null
@ -88,7 +88,7 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass
return unless @responsesComplete is 2
return unless me.get('email') and me.get('gplusID')
Backbone.Mediator.publish('logging-in-with-gplus')
Backbone.Mediator.publish 'auth:logging-in-with-gplus', {}
gplusID = me.get('gplusID')
window.tracker?.trackEvent 'Google Login'
window.tracker?.identify()

View file

@ -6,14 +6,14 @@ module.exports = class GitHubHandler extends CocoClass
scopes: 'user:email'
subscriptions:
'github-login': 'commenceGitHubLogin'
'auth:log-in-with-github': 'commenceGitHubLogin'
constructor: ->
super arguments...
@clientID = if application.isProduction() then '9b405bf5fb84590d1f02' else 'fd5c9d34eb171131bc87'
@redirectURI = if application.isProduction() then 'http://codecombat.com/github/auth_callback' else 'http://localhost:3000/github/auth_callback'
commenceGitHubLogin: ->
commenceGitHubLogin: (e) ->
request =
scope: @scopes
client_id: @clientID

View file

@ -127,7 +127,7 @@ module.exports = class God extends CocoClass
when 'debug-value-return'
Backbone.Mediator.publish 'god:debug-value-return', event.data.serialized
when 'debug-world-load-progress-changed'
Backbone.Mediator.publish 'god:debug-world-load-progress-changed', event.data
Backbone.Mediator.publish 'god:debug-world-load-progress-changed', progress: event.data.progress
onNewWorldCreated: (e) ->
@currentUserCodeMap = @filterUserCodeMapWhenFromWorld e.world.userCodeMap

View file

@ -11,6 +11,7 @@ module.exports = class LevelBus extends Bus
subscriptions:
'self-wizard:target-changed': 'onSelfWizardTargetChanged'
'self-wizard:created': 'onSelfWizardCreated'
'tome:editing-began': 'onEditingBegan'
'tome:editing-ended': 'onEditingEnded'
'script:state-changed': 'onScriptStateChanged'
@ -18,8 +19,8 @@ module.exports = class LevelBus extends Bus
'script:reset': 'onScriptReset'
'surface:frame-changed': 'onFrameChanged'
'surface:sprite-selected': 'onSpriteSelected'
'level-set-playing': 'onSetPlaying'
'level-show-victory': 'onVictory'
'level:set-playing': 'onSetPlaying'
'level:show-victory': 'onVictory'
'tome:spell-changed': 'onSpellChanged'
'tome:spell-created': 'onSpellCreated'
'application:idle-changed': 'onIdleChanged'
@ -51,10 +52,12 @@ module.exports = class LevelBus extends Bus
return true unless @session?.get('multiplayer')
super()
onSelfWizardTargetChanged: =>
wizardSprite = @getSelfWizard()
@wizardRef?.child('targetPos').set(wizardSprite?.targetPos or null)
@wizardRef?.child('targetSprite').set(wizardSprite?.targetSprite?.thang.id or null)
onSelfWizardCreated: (e) ->
@selfWizardSprite = e.sprite
onSelfWizardTargetChanged: (e) ->
@wizardRef?.child('targetPos').set(@selfWizardSprite?.targetPos or null)
@wizardRef?.child('targetSprite').set(@selfWizardSprite?.targetSprite?.thang.id or null)
onMeSynced: =>
super()
@ -63,9 +66,8 @@ module.exports = class LevelBus extends Bus
join: ->
super()
@wizardRef = @myConnection.child('wizard')
wizardSprite = @getSelfWizard()
@wizardRef?.child('targetPos').set(wizardSprite?.targetPos or null)
@wizardRef?.child('targetSprite').set(wizardSprite?.targetSprite?.thang.id or null)
@wizardRef?.child('targetPos').set(@selfWizardSprite?.targetPos or null)
@wizardRef?.child('targetSprite').set(@selfWizardSprite?.targetSprite?.thang.id or null)
@wizardRef?.child('wizardColor1').set(me.get('wizardColor1') or 0.0)
disconnect: ->
@ -81,11 +83,6 @@ module.exports = class LevelBus extends Bus
@fireRef.remove()
@onDisconnect.cancel(-> callback?())
getSelfWizard: ->
e = {}
Backbone.Mediator.publish('echo-self-wizard-sprite', e)
return e.payload
# UPDATING FIREBASE AND SESSION
onEditingBegan: -> @wizardRef?.child('editing').set(true)
@ -125,7 +122,8 @@ module.exports = class LevelBus extends Bus
@changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap})
@saveSession()
if spellTeam is me.team or spellTeam is 'common'
if spellTeam is me.team or (e.spell.otherSession and spellTeam isnt e.spell.otherSession.get('team'))
# https://github.com/codecombat/codecombat/issues/81
@onSpellChanged e # Save the new spell to the session, too.
onScriptStateChanged: (e) ->

View file

@ -9,7 +9,7 @@ module.exports = LinkedInHandler = class LinkedInHandler extends CocoClass
super()
subscriptions:
'linkedin-loaded': 'onLinkedInLoaded'
'auth:linkedin-api-loaded': 'onLinkedInLoaded'
onLinkedInLoaded: (e) ->
IN.Event.on IN, 'auth', @onLinkedInAuth

View file

@ -12,7 +12,7 @@ init = ->
me.set 'testGroupNumber', Math.floor(Math.random() * 256)
me.patch()
Backbone.listenTo(me, 'sync', -> Backbone.Mediator.publish('me:synced', {me: me}))
Backbone.listenTo me, 'sync', -> Backbone.Mediator.publish('auth:me-synced', me: me)
module.exports.createUser = (userObject, failure=backboneFailure, nextURL=null) ->
user = new User(userObject)
@ -57,7 +57,7 @@ onSetVolume = (e) ->
me.set('volume', e.volume)
me.save()
Backbone.Mediator.subscribe('level-set-volume', onSetVolume, module.exports)
Backbone.Mediator.subscribe('level:set-volume', onSetVolume, module.exports)
trackFirstArrival = ->
# will have to filter out users who log in with existing accounts separately

View file

@ -15,8 +15,8 @@ module.exports = class DOMScriptModule extends ScriptModule
endNotes: ->
notes = []
notes.push({'channel': 'end-level-highlight-dom'}) if @noteGroup.dom.highlight?
notes.push({'channel': 'level-enable-controls'}) if @noteGroup.dom.lock?
notes.push({'channel': 'level:end-highlight-dom'}) if @noteGroup.dom.highlight?
notes.push({'channel': 'level:enable-controls'}) if @noteGroup.dom.lock?
return notes
skipNotes: ->
@ -28,7 +28,7 @@ module.exports = class DOMScriptModule extends ScriptModule
highlightNote: ->
dom = @noteGroup.dom
note =
channel: 'level-highlight-dom'
channel: 'level:highlight-dom'
event:
selector: dom.highlight.target
delay: dom.highlight.delay
@ -41,7 +41,7 @@ module.exports = class DOMScriptModule extends ScriptModule
focusNote: ->
note =
channel: 'level-focus-dom'
channel: 'level:focus-dom'
event:
selector: @noteGroup.dom.focus
note
@ -51,7 +51,7 @@ module.exports = class DOMScriptModule extends ScriptModule
e.showModal = @noteGroup.dom.showVictory in [true, 'Done Button And Modal']
e.showModal = showModal if showModal?
note =
channel: 'level-show-victory'
channel: 'level:show-victory'
event: e
note
@ -59,8 +59,8 @@ module.exports = class DOMScriptModule extends ScriptModule
event = {}
lock = @noteGroup.dom.lock
event.controls = lock if _.isArray lock # array: subset of controls
channel = if lock then 'level-disable-controls' else 'level-enable-controls'
channel = if lock then 'level:disable-controls' else 'level:enable-controls'
return {channel: channel, event: event}
letterboxNote: ->
return {channel: 'level-set-letterbox', event: {on: @noteGroup.dom.letterbox}}
return {channel: 'level:set-letterbox', event: {on: @noteGroup.dom.letterbox}}

View file

@ -1,31 +0,0 @@
ScriptModule = require './ScriptModule'
module.exports = class GoalsScriptModule extends ScriptModule
@neededFor: (noteGroup) ->
return noteGroup.goals?
startNotes: ->
notes = []
notes.push(@addNote()) if @noteGroup.goals.add?
notes.push(@removeNote()) if @noteGroup.goals.remove?
return notes
endNotes: ->
return []
skipNotes: ->
return @startNotes()
addNote: ->
note =
channel: 'level-add-goals'
event:
goals: @noteGroup.goals.add
return note
removeNote: ->
note =
channel: 'level-remove-goals'
event:
goals: @noteGroup.goals.remove
return note

View file

@ -25,18 +25,17 @@ module.exports = class PlaybackScriptModule extends ScriptModule
playingNote: ->
note =
channel: 'level-set-playing'
channel: 'level:set-playing'
event: {playing: @noteGroup.playback.playing}
return note
scrubNote: (instant=false) ->
scrub = @noteGroup.playback.scrub
note =
channel: 'level-set-time'
channel: 'level:set-time'
event:
frameOffset: scrub.frameOffset or 2
scrubDuration: if instant then 0 else scrub.duration
note.event.time = scrub.toTime if scrub.toTime?
note.event.ratio = scrub.toRatio if scrub.toRatio?
return note

View file

@ -1,6 +1,3 @@
# * search for how various places handle or call 'end-current-script' event
CocoClass = require 'lib/CocoClass'
CocoView = require 'views/kinds/CocoView'
{scriptMatchesEventPrereqs} = require './../world/script_event_prereqs'
@ -10,8 +7,6 @@ allScriptModules.push(require './SpriteScriptModule')
allScriptModules.push(require './DOMScriptModule')
allScriptModules.push(require './SurfaceScriptModule')
allScriptModules.push(require './PlaybackScriptModule')
GoalScriptsModule = require './GoalsScriptModule'
allScriptModules.push(GoalScriptsModule)
allScriptModules.push(require './SoundScriptModule')
@ -32,16 +27,15 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
originalScripts: [] # use these later when you want to revert to an original state
subscriptions:
'end-current-script': 'onEndNoteGroup'
'end-all-scripts': 'onEndAll'
'script:end-current-script': 'onEndNoteGroup'
'level:started': -> @setWorldLoading(false)
'level:restarted': 'onLevelRestarted'
'level:shift-space-pressed': 'onEndNoteGroup'
'level:escape-pressed': 'onEndAll'
shortcuts:
'⇧+space, space, enter': -> Backbone.Mediator.publish 'level:shift-space-pressed'
'escape': -> Backbone.Mediator.publish 'level:escape-pressed'
'⇧+space, space, enter': -> Backbone.Mediator.publish 'level:shift-space-pressed', {}
'escape': -> Backbone.Mediator.publish 'level:escape-pressed', {}
# SETUP / TEARDOWN
@ -94,13 +88,14 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
scriptStates: scriptStates
timeSinceLastScriptEnded: (if @lastScriptEnded then now - @lastScriptEnded else 0) / 1000
Backbone.Mediator.publish 'script-manager:tick', stateEvent
Backbone.Mediator.publish 'script:tick', stateEvent # Is this even needed?
loadFromSession: ->
# load the queue with note groups to skip through
@addEndedScriptsFromSession()
@addPartiallyEndedScriptFromSession()
@fireGoalNotesEarly()
for noteGroup in @noteGroupQueue
@processNoteGroup(noteGroup)
addPartiallyEndedScriptFromSession: ->
scripts = @session.get('state').scripts
@ -133,14 +128,6 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
noteGroup.skipMe = true for noteGroup in noteChain
@addNoteChain(noteChain, false)
fireGoalNotesEarly: ->
for noteGroup in @noteGroupQueue
@processNoteGroup(noteGroup)
for module in noteGroup.modules
if module instanceof GoalScriptsModule
notes = module.skipNotes()
@processNote(note, noteGroup) for note in notes
setWorldLoading: (@worldLoading) ->
@run() unless @worldLoading
@ -238,7 +225,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
if nextNoteGroup.script.duration
f = => @onNoteGroupTimeout? nextNoteGroup
setTimeout(f, nextNoteGroup.script.duration)
Backbone.Mediator.publish('note-group-started')
Backbone.Mediator.publish 'script:note-group-started', {}
skipAhead: ->
return if @worldLoading
@ -270,7 +257,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
publishNote: (note) ->
Backbone.Mediator.publish 'playback:real-time-playback-ended', {}
Backbone.Mediator.publish(note.channel, note.event)
Backbone.Mediator.publish note.channel, note.event ? {}
# ENDING NOTES
@ -279,7 +266,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
@endAll({force:true})
@initProperties()
@resetThings()
Backbone.Mediator.publish 'script:reset'
Backbone.Mediator.publish 'script:reset', {}
@quiet = false
@run()
@ -298,7 +285,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
clearTimeout(timeout) for timeout in @currentTimeouts
for module in @currentNoteGroup.modules
@processNote(note, @currentNoteGroup) for note in module.endNotes()
Backbone.Mediator.publish 'note-group-ended' unless @quiet
Backbone.Mediator.publish 'script:note-group-ended' unless @quiet
@scriptInProgress = false
@trackScriptCompletionsFromNoteGroup(@currentNoteGroup)
@currentNoteGroup = null
@ -307,8 +294,8 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
@resetThings()
@ending = false
onEndAll: ->
# press escape
onEndAll: (e) ->
# Escape was pressed.
@endAll()
endAll: (options) ->
@ -341,8 +328,8 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
@run()
resetThings: ->
Backbone.Mediator.publish 'level-enable-controls', {}
Backbone.Mediator.publish 'level-set-letterbox', { on: false }
Backbone.Mediator.publish 'level:enable-controls', {}
Backbone.Mediator.publish 'level:set-letterbox', { on: false }
trackScriptCompletionsFromNoteGroup: (noteGroup) ->
return unless noteGroup.isLast

View file

@ -23,12 +23,12 @@ module.exports = class SoundScriptModule extends ScriptModule
addSuppressSelectionSoundsNote: ->
note =
channel: 'level-suppress-selection-sounds'
channel: 'level:suppress-selection-sounds'
event: {suppress: @noteGroup.sound.suppressSelectionSounds}
return note
addMusicNote: ->
note =
channel: 'level-play-music'
channel: 'music-player:play-music'
event: @noteGroup.sound.music
return note

View file

@ -20,7 +20,7 @@ module.exports = class SpritesScriptModule extends ScriptModule
spriteMoveNote: (sprite, instant=false) ->
duration = if instant then 0 else sprite.move.duration
note =
channel: 'level-sprite-move'
channel: 'sprite:move'
event:
pos: sprite.move.target
duration: duration
@ -41,7 +41,7 @@ module.exports = class SpritesScriptModule extends ScriptModule
blurb = utils.i18n sprite.say, 'blurb'
sound = sprite.say.sound # TODO support sound i18n
note =
channel: 'level-sprite-dialogue'
channel: 'level:sprite-dialogue'
event:
message: text
blurb: blurb
@ -54,7 +54,7 @@ module.exports = class SpritesScriptModule extends ScriptModule
spriteSelectNote: (sprite) ->
note =
channel: 'level-select-sprite'
channel: 'level:select-sprite'
event:
thangID: if sprite.select then sprite.id else null
return note
@ -64,7 +64,7 @@ module.exports = class SpritesScriptModule extends ScriptModule
for sprite in @noteGroup.sprites or []
notes[sprite.id] ?= {}
notes[sprite.id]['move'] = (@spriteMoveNote sprite, true) if sprite.move?
notes[sprite.id]['say'] = { channel: 'level-sprite-clear-dialogue' } if sprite.say?
notes[sprite.id]['say'] = { channel: 'level:sprite-clear-dialogue' } if sprite.say?
noteArray = []
for spriteID of notes
for type of notes[spriteID]

View file

@ -13,7 +13,7 @@ module.exports = class SurfaceScriptModule extends ScriptModule
endNotes: ->
notes = []
notes.push({channel:'level-highlight-sprites', event: {thangIDs: []}}) if @noteGroup.surface.highlight?
notes.push({channel:'sprite:highlight-sprites', event: {thangIDs: []}}) if @noteGroup.surface.highlight?
notes.push(@surfaceCameraNote(true)) if @noteGroup.surface.focus?
notes.push(@surfaceLockSelectNote()) if @noteGroup.surface.lockSelect?
return notes
@ -33,12 +33,12 @@ module.exports = class SurfaceScriptModule extends ScriptModule
e.duration = if focus.duration? then focus.duration else 1500
e.duration = 0 if instant
e.bounds = focus.bounds if focus.bounds?
return { channel: 'level-set-surface-camera', event: e }
return { channel: 'camera:set-camera', event: e }
surfaceHighlightNote: ->
highlight = @noteGroup.surface.highlight
note =
channel: 'level-highlight-sprites'
channel: 'sprite:highlight-sprites'
event:
thangIDs: highlight.targets
delay: highlight.delay
@ -46,4 +46,4 @@ module.exports = class SurfaceScriptModule extends ScriptModule
return note
surfaceLockSelectNote: ->
return { channel: 'level-lock-select', event: {lock: @noteGroup.surface.lockSelect} }
return { channel: 'level:lock-select', event: {lock: @noteGroup.surface.lockSelect} }

View file

@ -8,7 +8,7 @@ module.exports = initializeFacebook = ->
cookie: true # enable cookies to allow the server to access the session
xfbml: true # parse XFBML
Backbone.Mediator.publish 'fbapi-loaded'
Backbone.Mediator.publish 'auth:facebook-api-loaded', {}
# This is fired for any auth related change, such as login, logout or session refresh.
FB.Event.subscribe 'auth.authResponseChange', (response) ->
@ -17,13 +17,12 @@ module.exports = initializeFacebook = ->
if response.status is 'connected'
# They have logged in to the app.
Backbone.Mediator.publish 'facebook-logged-in',
response: response
Backbone.Mediator.publish 'facebook-logged-in', response: response
else if response.status is 'not_authorized'
#
else
#
#
# Load the SDK asynchronously
((d) ->

View file

@ -1,9 +1,9 @@
module.exports = initializeGoogle = ->
window.onGPlusLoaded = ->
Backbone.Mediator.publish 'gapi-loaded'
Backbone.Mediator.publish 'auth:gplus-api-loaded', {}
return
window.signinCallback = (authResult) ->
Backbone.Mediator.publish 'gplus-logged-in', authResult if authResult['access_token']
Backbone.Mediator.publish 'auth:logged-in-with-gplus', authResult if authResult.access_token
return
(->
po = document.createElement('script')

View file

@ -1,7 +1,7 @@
module.exports = initializeLinkedIn = ->
window.linkedInAsyncInit = ->
#console.log 'Linkedin async init success!'
Backbone.Mediator.publish 'linkedin-loaded'
Backbone.Mediator.publish 'auth:linkedin-api-loaded', {}
linkedInSnippet =
''

View file

@ -40,9 +40,9 @@ module.exports = class Camera extends CocoClass
# INIT
subscriptions:
'camera-zoom-in': 'onZoomIn'
'camera-zoom-out': 'onZoomOut'
'camera-zoom-to': 'onZoomTo'
'camera:zoom-in': 'onZoomIn'
'camera:zoom-out': 'onZoomOut'
'camera:zoom-to': 'onZoomTo'
'level:restarted': 'onLevelRestarted'
'surface:mouse-scrolled': 'onMouseScrolled'
'sprite:mouse-down': 'onMouseDown'
@ -187,7 +187,7 @@ module.exports = class Camera extends CocoClass
y: target.y + (@lastPos.y - e.originalEvent.rawY) / @zoom
@zoomTo newPos, @zoom, 0
@lastPos = {x: e.originalEvent.rawX, y: e.originalEvent.rawY}
Backbone.Mediator.publish 'camera:dragged'
Backbone.Mediator.publish 'camera:dragged', {}
onLevelRestarted: ->
@setBounds(@firstBounds, false)
@ -322,5 +322,5 @@ module.exports = class Camera extends CocoClass
createjs.Tween.removeTweens @
super()
onZoomTo: (pos, time) ->
@zoomTo @worldToSurface(pos), @zoom, time
onZoomTo: (e) ->
@zoomTo @worldToSurface(e.pos), @zoom, e.duration

View file

@ -57,11 +57,11 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
currentAction: null # related action that is right now playing
subscriptions:
'level-sprite-dialogue': 'onDialogue'
'level-sprite-clear-dialogue': 'onClearDialogue'
'level-set-letterbox': 'onSetLetterbox'
'level:sprite-dialogue': 'onDialogue'
'level:sprite-clear-dialogue': 'onClearDialogue'
'level:set-letterbox': 'onSetLetterbox'
'surface:ticked': 'onSurfaceTicked'
'level-sprite-move': 'onMove'
'sprite:move': 'onMove'
constructor: (@thangType, options) ->
super()
@ -519,14 +519,11 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
@imageObject.on 'pressmove', @onMouseEvent, @, false, 'sprite:dragged'
@imageObject.on 'pressup', @onMouseEvent, @, false, 'sprite:mouse-up'
onSetLetterbox: (e) ->
@letterboxOn = e.on
onMouseEvent: (e, ourEventName) ->
return if @letterboxOn or not @imageObject
p = @imageObject
p = p.parent while p.parent
newEvent = sprite: @, thang: @thang, originalEvent: e, canvas:p.canvas
newEvent = sprite: @, thang: @thang, originalEvent: e, canvas: p.canvas
@trigger ourEventName, newEvent
Backbone.Mediator.publish ourEventName, newEvent
@ -678,16 +675,19 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
label = @addLabel 'dialogue', Label.STYLE_DIALOGUE
label.setText e.blurb or '...'
sound = e.sound ? AudioPlayer.soundForDialogue e.message, @thangType.get 'soundTriggers'
@instance?.stop()
if @instance = @playSound sound, false
@instance.addEventListener 'complete', -> Backbone.Mediator.publish 'dialogue-sound-completed'
@dialogueSoundInstance?.stop()
if @dialogueSoundInstance = @playSound sound, false
@dialogueSoundInstance.addEventListener 'complete', -> Backbone.Mediator.publish 'sprite:dialogue-sound-completed', {}
@notifySpeechUpdated e
onClearDialogue: (e) ->
@labels.dialogue?.setText null
@instance?.stop()
@dialogueSoundInstance?.stop()
@notifySpeechUpdated {}
onSetLetterbox: (e) ->
@letterboxOn = e.on
setNameLabel: (name) ->
label = @addLabel 'name', Label.STYLE_NAME
label.setText name
@ -733,6 +733,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
return null unless sound
delay = if withDelay and sound.delay then 1000 * sound.delay / createjs.Ticker.getFPS() else 0
name = AudioPlayer.nameForSoundReference sound
AudioPlayer.preloadSoundReference sound
instance = AudioPlayer.playSound name, volume, delay, @getWorldPosition()
#console.log @thang?.id, 'played sound', name, 'with delay', delay, 'volume', volume, 'and got sound instance', instance
instance
@ -749,7 +750,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
distance = @thang.pos.distance target.pos
offset = Math.max(target.width, target.height, 2) / 2 + 3
pos = Vector.add(@thang.pos, heading.multiply(distance - offset))
Backbone.Mediator.publish 'level-sprite-clear-dialogue', {}
Backbone.Mediator.publish 'level:sprite-clear-dialogue', {}
@onClearDialogue()
args = [pos]
args.push(e.duration) if e.duration?

View file

@ -11,7 +11,9 @@ module.exports = class CoordinateDisplay extends createjs.Container
super()
@initialize()
@camera = options.camera
console.error 'CoordinateDisplay needs camera.' unless @camera
@layer = options.layer
console.error @toString(), 'needs a camera.' unless @camera
console.error @toString(), 'needs a layer.' unless @layer
@build()
@show = _.debounce @show, 125
Backbone.Mediator.subscribe(channel, @[func], @) for channel, func of @subscriptions
@ -21,6 +23,8 @@ module.exports = class CoordinateDisplay extends createjs.Container
@show = null
@destroyed = true
toString: -> '<CoordinateDisplay>'
build: ->
@mouseEnabled = @mouseChildren = false
@addChild @background = new createjs.Shape()
@ -30,6 +34,7 @@ module.exports = class CoordinateDisplay extends createjs.Container
@label.shadow = new createjs.Shadow('#000000', 1, 1, 0)
@background.name = 'Coordinate Display Background'
@pointMarker.name = 'Point Marker'
@layer.addChild @
onMouseOver: (e) -> @mouseInBounds = true
onMouseOut: (e) -> @mouseInBounds = false

View file

@ -0,0 +1,94 @@
CocoClass = require 'lib/CocoClass'
module.exports = class CoordinateGrid extends CocoClass
subscriptions:
'level:toggle-grid': 'onToggleGrid'
shortcuts:
'ctrl+g, ⌘+g': 'onToggleGrid'
constructor: (options, worldSize) ->
super()
options ?= {}
@camera = options.camera
@layer = options.layer
@textLayer = options.textLayer
console.error @toString(), 'needs a camera.' unless @camera
console.error @toString(), 'needs a layer.' unless @layer
console.error @toString(), 'needs a textLayer.' unless @textLayer
@build worldSize
destroy: ->
super()
toString: -> '<CoordinateGrid>'
build: (worldSize) ->
worldWidth = worldSize[0] ? 80
worldHeight = worldSize[1] ? 68
@gridContainer = new createjs.Container()
@gridShape = new createjs.Shape()
@gridContainer.addChild @gridShape
@gridContainer.mouseEnabled = false
@gridShape.alpha = 0.125
@gridShape.graphics.setStrokeStyle 1
@gridShape.graphics.beginStroke 'blue'
gridSize = Math.round(worldWidth / 20)
wopStart = x: 0, y: 0
wopEnd = x: worldWidth, y: worldHeight
supStart = @camera.worldToSurface wopStart
supEnd = @camera.worldToSurface wopEnd
wop = x: wopStart.x, y: wopStart.y
@labels = []
linesDrawn = 0
while wop.x <= wopEnd.x
sup = @camera.worldToSurface wop
@gridShape.graphics.mt(sup.x, supStart.y).lt(sup.x, supEnd.y)
if ++linesDrawn % 2
t = new createjs.Text(wop.x.toFixed(0), '16px Arial', 'blue')
t.textAlign = 'center'
t.textBaseline = 'bottom'
t.x = sup.x
t.y = supStart.y
t.alpha = 0.75
@labels.push t
wop.x += gridSize
if wopEnd.x < wop.x <= wopEnd.x - gridSize / 2
wop.x = wopEnd.x
linesDrawn = 0
while wop.y <= wopEnd.y
sup = @camera.worldToSurface wop
@gridShape.graphics.mt(supStart.x, sup.y).lt(supEnd.x, sup.y)
if ++linesDrawn % 2
t = new createjs.Text(wop.y.toFixed(0), '16px Arial', 'blue')
t.textAlign = 'left'
t.textBaseline = 'middle'
t.x = 0
t.y = sup.y
t.alpha = 0.75
@labels.push t
wop.y += gridSize
if wopEnd.y < wop.y <= wopEnd.y - gridSize / 2
wop.y = wopEnd.y
@gridShape.graphics.endStroke()
bounds = x: supStart.x, y: supEnd.y, width: supEnd.x - supStart.x, height: supStart.y - supEnd.y
return unless bounds?.width and bounds.height
@gridContainer.cache bounds.x, bounds.y, bounds.width, bounds.height
showGrid: ->
return if @gridShowing()
@layer.addChild @gridContainer
@textLayer.addChild label for label in @labels
hideGrid: ->
return unless @gridShowing()
@layer.removeChild @gridContainer
@textLayer.removeChild label for label in @labels
gridShowing: ->
@gridContainer?.parent?
onToggleGrid: (e) ->
e?.preventDefault?()
if @gridShowing() then @hideGrid() else @showGrid()

View file

@ -1,7 +1,7 @@
module.exports = class DebugDisplay extends createjs.Container
layerPriority: 20
subscriptions:
'level-set-debug': 'onSetDebug'
'level:set-debug': 'onSetDebug'
constructor: (options) ->
super()

View file

@ -2,9 +2,9 @@ CocoClass = require 'lib/CocoClass'
module.exports = class Dimmer extends CocoClass
subscriptions:
'level-disable-controls': 'onDisableControls'
'level-enable-controls': 'onEnableControls'
'level-highlight-sprites': 'onHighlightSprites'
'level:disable-controls': 'onDisableControls'
'level:enable-controls': 'onEnableControls'
'sprite:highlight-sprites': 'onHighlightSprites'
'sprite:speech-updated': 'onSpriteSpeechUpdated'
'surface:frame-changed': 'onFrameChanged'
'camera:zoom-updated': 'onZoomUpdated'

View file

@ -4,8 +4,8 @@ CocoSprite = require 'lib/surface/CocoSprite'
module.exports = IndieSprite = class IndieSprite extends CocoSprite
notOfThisWorld: true
subscriptions:
'note-group-started': 'onNoteGroupStarted'
'note-group-ended': 'onNoteGroupEnded'
'script:note-group-started': 'onNoteGroupStarted'
'script:note-group-ended': 'onNoteGroupEnded'
constructor: (thangType, options) ->
options.thang = @makeIndieThang thangType, options
@ -26,6 +26,8 @@ module.exports = IndieSprite = class IndieSprite extends CocoSprite
thang.getActionName = -> thang.action
thang.acts = true
thang.isSelectable = true
thang.team = options.team
thang.teamColors = options.teamColors
thang
onNoteGroupStarted: => @scriptRunning = true

View file

@ -1,6 +1,6 @@
module.exports = class Letterbox extends createjs.Container
subscriptions:
'level-set-letterbox': 'onSetLetterbox'
'level:set-letterbox': 'onSetLetterbox'
constructor: (options) ->
super()

View file

@ -216,7 +216,7 @@ module.exports = class Mark extends CocoClass
onLoadedThangType: ->
@build()
@toggle(@toggleTo) if @toggleTo?
Backbone.Mediator.publish 'sprite:loaded'
Backbone.Mediator.publish 'sprite:loaded', {sprite: @}
update: (pos=null) ->
return false unless @on and @mark

View file

@ -9,7 +9,7 @@ module.exports = class MusicPlayer extends CocoClass
standingBy: null
subscriptions:
'level-play-music': 'onPlayMusic'
'music-player:play-music': 'onPlayMusic'
'audio-player:loaded': 'onAudioLoaded'
constructor: ->

View file

@ -24,10 +24,9 @@ module.exports = class PointChooser extends CocoClass
@shape.layerIndex = 100
onMouseDown: (e) =>
console.log 'got stagemousedown', e, key.shift
return unless key.shift
@setPoint @options.camera.screenToWorld {x: e.stageX, y: e.stageY}
Backbone.Mediator.publish 'choose-point', point: @point
Backbone.Mediator.publish 'surface:choose-point', point: @point
updateShape: ->
sup = @options.camera.worldToSurface @point

View file

@ -27,7 +27,7 @@ module.exports = class RegionChooser extends CocoClass
onMouseUp: (e) =>
return unless @firstPoint
Backbone.Mediator.publish 'choose-region', points: [@firstPoint, @secondPoint]
Backbone.Mediator.publish 'surface:choose-region', points: [@firstPoint, @secondPoint]
@firstPoint = null
@secondPoint = null
@options.camera.dragDisabled = false

View file

@ -12,12 +12,12 @@ module.exports = class SpriteBoss extends CocoClass
subscriptions:
'bus:player-joined': 'onPlayerJoined'
'bus:player-left': 'onPlayerLeft'
'level-set-debug': 'onSetDebug'
'level-highlight-sprites': 'onHighlightSprites'
'level:set-debug': 'onSetDebug'
'sprite:highlight-sprites': 'onHighlightSprites'
'surface:stage-mouse-down': 'onStageMouseDown'
'level-select-sprite': 'onSelectSprite'
'level-suppress-selection-sounds': 'onSuppressSelectionSounds'
'level-lock-select': 'onSetLockSelect'
'level:select-sprite': 'onSelectSprite'
'level:suppress-selection-sounds': 'onSuppressSelectionSounds'
'level:lock-select': 'onSetLockSelect'
'level:restarted': 'onLevelRestarted'
'god:new-world-created': 'onNewWorld'
'god:streaming-world-updated': 'onNewWorld'
@ -111,7 +111,7 @@ module.exports = class SpriteBoss extends CocoClass
unless thangType = @thangTypeFor indieSprite.thangType
console.warn "Need to convert #{indieSprite.id}'s ThangType #{indieSprite.thangType} to a ThangType reference. Until then, #{indieSprite.id} won't show up."
return
sprite = new IndieSprite thangType, @createSpriteOptions {thangID: indieSprite.id, pos: indieSprite.pos, sprites: @sprites, colorConfig: indieSprite.colorConfig}
sprite = new IndieSprite thangType, @createSpriteOptions {thangID: indieSprite.id, pos: indieSprite.pos, sprites: @sprites, team: indieSprite.team, teamColors: @world.getTeamColors()}
@addSprite sprite, sprite.thang.id
createOpponentWizard: (opponent) ->
@ -198,7 +198,7 @@ module.exports = class SpriteBoss extends CocoClass
sprite.setThang thang # make sure Sprite has latest Thang
else
sprite = @addThangToSprites(thang)
Backbone.Mediator.publish 'surface:new-thang-added', thang:thang, sprite:sprite
Backbone.Mediator.publish 'surface:new-thang-added', thang: thang, sprite: sprite
updateCache = updateCache or sprite.imageObject.parent is @spriteLayers['Obstacle']
sprite.playSounds()
item.modifyStats() for item in itemsJustEquipped
@ -319,9 +319,9 @@ module.exports = class SpriteBoss extends CocoClass
if alive and not @suppressSelectionSounds
instance = sprite.playSound 'selected'
if instance?.playState is 'playSucceeded'
Backbone.Mediator.publish 'thang-began-talking', thang: sprite?.thang
Backbone.Mediator.publish 'sprite:thang-began-talking', thang: sprite?.thang
instance.addEventListener 'complete', ->
Backbone.Mediator.publish 'thang-finished-talking', thang: sprite?.thang
Backbone.Mediator.publish 'sprite:thang-finished-talking', thang: sprite?.thang
onFlagColorSelected: (e) ->
@removeSprite @flagCursorSprite if @flagCursorSprite

View file

@ -12,6 +12,7 @@ CountdownScreen = require './CountdownScreen'
PlaybackOverScreen = require './PlaybackOverScreen'
DebugDisplay = require './DebugDisplay'
CoordinateDisplay = require './CoordinateDisplay'
CoordinateGrid = require './CoordinateGrid'
SpriteBoss = require './SpriteBoss'
PointChooser = require './PointChooser'
RegionChooser = require './RegionChooser'
@ -24,7 +25,7 @@ module.exports = Surface = class Surface extends CocoClass
surfaceLayer: null
surfaceTextLayer: null
screenLayer: null
gridLayer: null # TODO: maybe
gridLayer: null
spriteBoss: null
@ -51,21 +52,19 @@ module.exports = Surface = class Surface extends CocoClass
frameRate: 30 # Best as a divisor of 60, like 15, 30, 60, with RAF_SYNCHED timing.
subscriptions:
'level-disable-controls': 'onDisableControls'
'level-enable-controls': 'onEnableControls'
'level-set-playing': 'onSetPlaying'
'level-set-debug': 'onSetDebug'
'level-toggle-debug': 'onToggleDebug'
'level-set-grid': 'onSetGrid'
'level-toggle-grid': 'onToggleGrid'
'level-toggle-pathfinding': 'onTogglePathFinding'
'level-set-time': 'onSetTime'
'level-set-surface-camera': 'onSetCamera'
'level:disable-controls': 'onDisableControls'
'level:enable-controls': 'onEnableControls'
'level:set-playing': 'onSetPlaying'
'level:set-debug': 'onSetDebug'
'level:toggle-debug': 'onToggleDebug'
'level:toggle-pathfinding': 'onTogglePathFinding'
'level:set-time': 'onSetTime'
'camera:set-camera': 'onSetCamera'
'level:restarted': 'onLevelRestarted'
'god:new-world-created': 'onNewWorld'
'god:streaming-world-updated': 'onNewWorld'
'tome:cast-spells': 'onCastSpells'
'level-set-letterbox': 'onSetLetterbox'
'level:set-letterbox': 'onSetLetterbox'
'application:idle-changed': 'onIdleChanged'
'camera:zoom-updated': 'onZoomUpdated'
'playback:real-time-playback-started': 'onRealTimePlaybackStarted'
@ -75,7 +74,6 @@ module.exports = Surface = class Surface extends CocoClass
shortcuts:
'ctrl+\\, ⌘+\\': 'onToggleDebug'
'ctrl+g, ⌘+g': 'onToggleGrid'
'ctrl+o, ⌘+o': 'onTogglePathFinding'
# external functions
@ -103,6 +101,8 @@ module.exports = Surface = class Surface extends CocoClass
@dimmer?.destroy()
@countdownScreen?.destroy()
@playbackOverScreen?.destroy()
@coordinateDisplay?.destroy()
@coordinateGrid?.destroy()
@stage.clear()
@musicPlayer?.destroy()
@stage.removeAllChildren()
@ -126,12 +126,8 @@ module.exports = Surface = class Surface extends CocoClass
@showLevel()
@updateState true if @loaded
# TODO: synchronize both ways of choosing whether to show coords (@world via UI System or @options via World Select modal)
if @world.showCoordinates and @options.coords and not @coordinateDisplay
@coordinateDisplay = new CoordinateDisplay camera: @camera
@surfaceTextLayer.addChild @coordinateDisplay
@onFrameChanged()
Backbone.Mediator.publish 'surface:world-set-up'
Backbone.Mediator.publish 'surface:world-set-up', {world: @world}
onTogglePathFinding: (e) ->
e?.preventDefault?()
@ -315,7 +311,6 @@ module.exports = Surface = class Surface extends CocoClass
return if @currentFrame is @lastFrame and not force
progress = @getProgress()
Backbone.Mediator.publish('surface:frame-changed',
type: 'frame-changed'
selectedThang: @spriteBoss.selectedSprite?.thang
progress: progress
frame: @currentFrame
@ -325,11 +320,11 @@ module.exports = Surface = class Surface extends CocoClass
if @lastFrame < @world.frames.length and @currentFrame >= @world.totalFrames - 1
@ended = true
@setPaused true
Backbone.Mediator.publish 'surface:playback-ended'
Backbone.Mediator.publish 'surface:playback-ended', {}
else if @currentFrame < @world.totalFrames and @ended
@ended = false
@setPaused false
Backbone.Mediator.publish 'surface:playback-restarted'
Backbone.Mediator.publish 'surface:playback-restarted', {}
@lastFrame = @currentFrame
@ -364,12 +359,15 @@ module.exports = Surface = class Surface extends CocoClass
onNewWorld: (event) ->
return unless event.world.name is @world.name
@onStreamingWorldUpdated event
onStreamingWorldUpdated: (event) ->
@casting = false
@spriteBoss.play()
# This has a tendency to break scripts that are waiting for playback to change when the level is loaded
# so only run it after the first world is created.
Backbone.Mediator.publish 'level-set-playing', {playing: true} unless event.firstWorld or @setPlayingCalled
Backbone.Mediator.publish 'level:set-playing', {playing: true} unless event.firstWorld or @setPlayingCalled
@setWorld event.world
@onFrameChanged(true)
@ -390,22 +388,21 @@ module.exports = Surface = class Surface extends CocoClass
# initialization
initEasel: ->
# takes DOM objects, not jQuery objects
@stage = new createjs.Stage(@canvas[0])
@stage = new createjs.Stage(@canvas[0]) # Takes DOM objects, not jQuery objects.
canvasWidth = parseInt @canvas.attr('width'), 10
canvasHeight = parseInt @canvas.attr('height'), 10
@camera?.destroy()
@camera = new Camera @canvas
AudioPlayer.camera = @camera
@camera = AudioPlayer.camera = new Camera @canvas
@layers.push @surfaceLayer = new Layer name: 'Surface', layerPriority: 0, transform: Layer.TRANSFORM_SURFACE, camera: @camera
@layers.push @surfaceTextLayer = new Layer name: 'Surface Text', layerPriority: 1, transform: Layer.TRANSFORM_SURFACE_TEXT, camera: @camera
@layers.push @screenLayer = new Layer name: 'Screen', layerPriority: 2, transform: Layer.TRANSFORM_SCREEN, camera: @camera
@layers.push @gridLayer = new Layer name: 'Grid', layerPriority: 2, transform: Layer.TRANSFORM_SURFACE, camera: @camera
@layers.push @screenLayer = new Layer name: 'Screen', layerPriority: 3, transform: Layer.TRANSFORM_SCREEN, camera: @camera
@stage.addChild @layers...
@surfaceLayer.addChild @cameraBorder = new CameraBorder bounds: @camera.bounds
@screenLayer.addChild new Letterbox canvasWidth: canvasWidth, canvasHeight: canvasHeight
@spriteBoss = new SpriteBoss camera: @camera, surfaceLayer: @surfaceLayer, surfaceTextLayer: @surfaceTextLayer, world: @world, thangTypes: @options.thangTypes, choosing: @options.choosing, navigateToSelection: @options.navigateToSelection, showInvisible: @options.showInvisible
@countdownScreen ?= new CountdownScreen camera: @camera, layer: @screenLayer
@playbackOverScreen ?= new PlaybackOverScreen camera: @camera, layer: @screenLayer
@countdownScreen = new CountdownScreen camera: @camera, layer: @screenLayer
@playbackOverScreen = new PlaybackOverScreen camera: @camera, layer: @screenLayer
@initCoordinates()
@stage.enableMouseOver(10)
@stage.addEventListener 'stagemousemove', @onMouseMove
@stage.addEventListener 'stagemousedown', @onMouseDown
@ -416,6 +413,11 @@ module.exports = Surface = class Surface extends CocoClass
createjs.Ticker.setFPS @options.frameRate
@onResize()
initCoordinates: ->
@coordinateGrid ?= new CoordinateGrid {camera: @camera, layer: @gridLayer, textLayer: @surfaceTextLayer}, @world.size()
@coordinateGrid.showGrid() if @world.showGrid or @options.grid
@coordinateDisplay ?= new CoordinateDisplay camera: @camera, layer: @surfaceTextLayer if @world.showCoordinates or @options.coords
onResize: (e) =>
return if @destroyed
oldWidth = parseInt @canvas.attr('width'), 10
@ -447,12 +449,10 @@ module.exports = Surface = class Surface extends CocoClass
@loaded = true
@spriteBoss.createMarks()
@spriteBoss.createIndieSprites @world.indieSprites, @options.wizards
Backbone.Mediator.publish 'registrar-echo-states'
@updateState true
@drawCurrentFrame()
@showGrid() if @options.grid # TODO: pay attention to world grid setting (which we only know when world simulates)
createjs.Ticker.addEventListener 'tick', @tick
Backbone.Mediator.publish 'level:started'
Backbone.Mediator.publish 'level:started', {}
createOpponentWizard: (opponent) ->
@spriteBoss.createOpponentWizard opponent
@ -460,70 +460,9 @@ module.exports = Surface = class Surface extends CocoClass
initAudio: ->
@musicPlayer = new MusicPlayer()
# grid; should probably refactor into separate class
showGrid: ->
return if @gridShowing()
unless @gridLayer
@gridLayer = new createjs.Container()
@gridShape = new createjs.Shape()
@gridLayer.addChild @gridShape
@gridLayer.z = 90019001
@gridLayer.mouseEnabled = false
@gridShape.alpha = 0.125
@gridShape.graphics.beginStroke 'blue'
gridSize = Math.round(@world.size()[0] / 20)
unless gridSize > 0.1
return console.error 'Grid size is', gridSize, 'so we can\'t draw a grid.'
wopStart = x: 0, y: 0
wopEnd = x: @world.size()[0], y: @world.size()[1]
supStart = @camera.worldToSurface wopStart
supEnd = @camera.worldToSurface wopEnd
wop = x: wopStart.x, y: wopStart.y
while wop.x < wopEnd.x
sup = @camera.worldToSurface wop
@gridShape.graphics.mt(sup.x, supStart.y).lt(sup.x, supEnd.y)
t = new createjs.Text(wop.x.toFixed(0), '16px Arial', 'blue')
t.x = sup.x - t.getMeasuredWidth() / 2
t.y = supStart.y - 10 - t.getMeasuredHeight() / 2
t.alpha = 0.75
@gridLayer.addChild t
wop.x += gridSize
while wop.y < wopEnd.y
sup = @camera.worldToSurface wop
@gridShape.graphics.mt(supStart.x, sup.y).lt(supEnd.x, sup.y)
t = new createjs.Text(wop.y.toFixed(0), '16px Arial', 'blue')
t.x = 10 - t.getMeasuredWidth() / 2
t.y = sup.y - t.getMeasuredHeight() / 2
t.alpha = 0.75
@gridLayer.addChild t
wop.y += gridSize
@gridShape.graphics.endStroke()
bounds = @gridLayer.getBounds()
return unless bounds?.width and bounds.height
@gridLayer.cache bounds.x, bounds.y, bounds.width, bounds.height
@surfaceLayer.addChild @gridLayer
hideGrid: ->
return unless @gridShowing()
@gridLayer.parent.removeChild @gridLayer
gridShowing: ->
@gridLayer?.parent?
onToggleGrid: (e) ->
# TODO: figure out a better way of managing grid / debug so it's not split across PlaybackView and Surface
e?.preventDefault?()
if @gridShowing() then @hideGrid() else @showGrid()
flag = $('#grid-toggle i.icon-ok')
flag.toggleClass 'invisible', not @gridShowing()
onSetGrid: (e) ->
if e.grid then @showGrid() else @hideGrid()
onToggleDebug: (e) ->
e?.preventDefault?()
Backbone.Mediator.publish 'level-set-debug', {debug: not @debug}
Backbone.Mediator.publish 'level:set-debug', {debug: not @debug}
onSetDebug: (e) ->
return if e.debug is @debug
@ -547,6 +486,7 @@ module.exports = Surface = class Surface extends CocoClass
onMouseUp: (e) =>
return if @disabled
console.log 'yo on mouse up', e
onBackground = not @stage.hitTest e.stageX, e.stageY
Backbone.Mediator.publish 'surface:stage-mouse-up', onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e

View file

@ -16,10 +16,9 @@ module.exports = class WizardSprite extends IndieSprite
subscriptions:
'bus:player-states-changed': 'onPlayerStatesChanged'
'me:synced': 'onMeSynced'
'auth:me-synced': 'onMeSynced'
'surface:sprite-selected': 'onSpriteSelected'
'echo-self-wizard-sprite': 'onEchoSelfWizardSprite'
'echo-all-wizard-sprites': 'onEchoAllWizardSprites'
'sprite:echo-all-wizard-sprites': 'onEchoAllWizardSprites'
shortcuts:
'up': 'onMoveKey'
@ -36,6 +35,7 @@ module.exports = class WizardSprite extends IndieSprite
@setNameLabel me.displayName()
else if options.name
@setNameLabel options.name
Backbone.Mediator.publish 'self-wizard:created', sprite: @
makeIndieThang: (thangType, options) ->
thang = super thangType, options
@ -112,7 +112,6 @@ module.exports = class WizardSprite extends IndieSprite
@targetPos = @getPosFromTarget(@targetSprite or targetPos)
@endMoveTween()
onEchoSelfWizardSprite: (e) -> e.payload = @ if @isSelf
onEchoAllWizardSprites: (e) -> e.payload.push @
defaultPos: -> x: 35, y: 24, z: @thang.depth / 2 + @thang.bobHeight
move: (pos, duration) -> @setTarget(pos, duration)
@ -132,7 +131,7 @@ module.exports = class WizardSprite extends IndieSprite
@targetPos = @boundWizard targetPos
@beginMoveTween(duration, isLinear)
@shoveOtherWizards()
Backbone.Mediator.publish('self-wizard:target-changed', {sender: @}) if @isSelf
Backbone.Mediator.publish('self-wizard:target-changed', {sprite: @}) if @isSelf
boundWizard: (target) ->
# Passed an {x, y} in world coordinates, returns {x, y} within world bounds
@ -179,7 +178,7 @@ module.exports = class WizardSprite extends IndieSprite
shoveOtherWizards: (removeMe) ->
return unless @targetSprite
allWizards = []
Backbone.Mediator.publish('echo-all-wizard-sprites', {payload: allWizards})
Backbone.Mediator.publish 'sprite:echo-all-wizard-sprites', payload: allWizards
allOfUs = (wizard for wizard in allWizards when wizard.targetSprite is @targetSprite)
allOfUs = (wizard for wizard in allOfUs when wizard isnt @) if removeMe
@ -271,4 +270,4 @@ module.exports = class WizardSprite extends IndieSprite
position = {x: @targetPos.x + x, y: @targetPos.y + y}
@setTarget(position, interval, true)
@updatePosition()
Backbone.Mediator.publish 'camera-zoom-to', position, interval
Backbone.Mediator.publish 'camera:zoom-to', pos: position, duration: interval

View file

@ -167,7 +167,7 @@ module.exports = class Thang
{CN: @constructor.className, id: @id}
getSpriteOptions: ->
colorConfigs = @world?.getTeamColors() or {}
colorConfigs = @teamColors or @world?.getTeamColors() or {}
options = {colorConfig: {}}
if @team and teamColor = colorConfigs[@team]
options.colorConfig.team = teamColor

File diff suppressed because it is too large Load diff

View file

@ -103,11 +103,11 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
for_beginners: "Für Anfänger"
multiplayer: "Mehrspieler"
for_developers: "Für Entwickler"
# javascript_blurb: "The language of the web. Great for writing websites, web apps, HTML5 games, and servers."
javascript_blurb: "Die Sprache des Web. Geeignet für die Erstellung von Webseiten, WebApps, HTML5 Spielen und Servern.."
# python_blurb: "Simple yet powerful, Python is a great general purpose programming language."
# coffeescript_blurb: "Nicer JavaScript syntax."
# clojure_blurb: "A modern Lisp."
# lua_blurb: "Game scripting language."
coffeescript_blurb: "Schönere JavaScript Syntax."
clojure_blurb: "Ein modernes Lisp."
lua_blurb: "Skriptsprache für Spiele."
# io_blurb: "Simple but obscure."
play:
@ -179,7 +179,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
new_password: "Neues Passwort"
new_password_verify: "Passwort verifizieren"
email_subscriptions: "Email Abonnements"
# email_subscriptions_none: "No Email Subscriptions."
email_subscriptions_none: "Keine Email Abonnements."
email_announcements: "Ankündigungen"
email_announcements_description: "Erhalte regelmäßig Ankündigungen zu deinem Account."
email_notifications: "Benachrichtigungen"
@ -197,7 +197,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
error_saving: "Fehler beim Speichern"
saved: "Änderungen gespeichert"
password_mismatch: "Passwörter stimmen nicht überein."
# password_repeat: "Please repeat your password."
password_repeat: "Bitte wiederhole dein Passwort."
job_profile: "Jobprofil"
job_profile_approved: "Dein Jobprofil wurde von CodeCombat freigegeben. Arbeitgeber können dieses solange einsehen, bis du es als inaktiv markiert oder wenn innerhalb von vier Wochen keine Änderung daran vorgenommen wurde."
job_profile_explanation: "Hi! Fülle dies aus und wir melden uns bei dir bezüglich des Auffindens eines Jobs als Programmierer"
@ -212,7 +212,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
profile_for_suffix: ""
# featured: "Featured"
# not_featured: "Not Featured"
# looking_for: "Looking for:"
looking_for: "Suche nach:"
last_updated: "zuletzt geändert:"
contact: "Kontakt"
# active: "Looking for interview offers now"
@ -359,13 +359,13 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
customize_wizard: "Bearbeite den Zauberer"
home: "Startseite"
# stop: "Stop"
# game_menu: "Game Menu"
game_menu: "Spielmenü"
guide: "Hilfe"
restart: "Neustart"
goals: "Ziele"
# success: "Success!"
# incomplete: "Incomplete"
# timed_out: "Ran out of time"
success: "Erfolgreich!"
incomplete: "Unvollständig"
timed_out: "Zeit abgelaufen"
# failing: "Failing"
action_timeline: "Aktionszeitstrahl"
click_to_select: "Klicke auf eine Einheit, um sie auszuwählen."
@ -425,7 +425,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
tip_impossible: "Es wirkt immer unmöglich bis es vollbracht ist. - Nelson Mandela"
tip_talk_is_cheap: "Reden ist billig. Zeig mir den Code. - Linus Torvalds"
tip_first_language: "Das schwierigste, das du jemals lernen wirst, ist die erste Programmiersprache. - Alan Kay"
# tip_hardware_problem: "Q: How many programmers does it take to change a light bulb? A: None, it's a hardware problem."
tip_hardware_problem: "Q: Wie viele Programmierer braucht man um eine Glühbirne auszuwechseln? A: Keine, es ist ein Hardware-Problem."
time_current: "Aktuell"
time_total: "Total"
time_goto: "Gehe zu"
@ -433,19 +433,19 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
# infinite_loop_reset_level: "Reset Level"
infinite_loop_comment_out: "Meinen Code auskommentieren"
game_menu:
# game_menu:
# inventory_tab: "Inventory"
# choose_hero_tab: "Restart Level"
# save_load_tab: "Save/Load"
# options_tab: "Options"
choose_hero_tab: "Level neustarten"
save_load_tab: "Speichere/Lade"
options_tab: "Optionen"
# guide_tab: "Guide"
multiplayer_tab: "Multiplayer"
multiplayer_tab: "Mehrspieler"
# inventory_caption: "Equip your hero"
# choose_hero_caption: "Choose hero, language"
# save_load_caption: "... and view history"
# options_caption: "Configure settings"
options_caption: "Konfiguriere Einstellungen"
# guide_caption: "Docs and tips"
# multiplayer_caption: "Play with friends!"
multiplayer_caption: "Spiele mit Freunden!"
# inventory:
# temp: "Temp"
@ -458,9 +458,9 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
# granularity_change_history: "History"
options:
# general_options: "General Options"
# music_label: "Music"
# music_description: "Turn background music on/off."
general_options: "Allgemeine Einstellungen"
music_label: "Musik"
music_description: "Schalte Hintergrundmusik an/aus."
# autorun_label: "Autorun"
# autorun_description: "Control automatic code execution."
editor_config: "Editor Einstellungen"
@ -472,8 +472,8 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
editor_config_keybindings_label: "Tastenbelegung"
editor_config_keybindings_default: "Standard (Ace)"
editor_config_keybindings_description: "Fügt zusätzliche Tastenkombinationen, bekannt aus anderen Editoren, hinzu"
# editor_config_livecompletion_label: "Live Autocompletion"
# editor_config_livecompletion_description: "Displays autocomplete suggestions while typing."
editor_config_livecompletion_label: "Live Auto-Vervollständigung"
editor_config_livecompletion_description: "Zeigt Vorschläge der Auto-Vervollständigung an während du tippst."
editor_config_invisibles_label: "Zeige unsichtbare Zeichen"
editor_config_invisibles_description: "Zeigt unsichtbare Zeichen wie Leertasten an."
editor_config_indentguides_label: "Zeige Einrückungshilfe"
@ -485,9 +485,9 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
# temp: "Temp"
multiplayer:
multiplayer_title: "Multiplayer Einstellungen"
multiplayer_title: "Mehrspieler Einstellungen"
# multiplayer_toggle: "Enable multiplayer"
# multiplayer_toggle_description: "Allow others to join your game."
multiplayer_toggle_description: "Erlaube anderen an deinem Spiel teilzunehmen."
multiplayer_link_description: "Gib diesen Link jedem, der mitmachen will."
multiplayer_hint_label: "Hinweis:"
multiplayer_hint: " Klick den Link, um alles auszuwählen, dann drück ⌘-C oder Strg-C um den Link zu kopieren."
@ -521,7 +521,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
av_entities_active_instances_url: "Aktive Instanzen"
av_entities_employer_list_url: "Arbeitgeberliste"
av_other_sub_title: "Sonstige"
# av_other_debug_base_url: "Base (for debugging base.jade)"
av_other_debug_base_url: "Base (um base.jade zu debuggen)"
u_title: "Benutzerliste"
lg_title: "Letzte Spiele"
# clas: "CLAs"
@ -535,7 +535,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
# thang_editor_suffix: "to modify the CodeCombat source artwork. Allow units to throw projectiles, alter the direction of an animation, change a unit's hit points, or upload your own vector sprites."
# article_editor_prefix: "See a mistake in some of our docs? Want to make some instructions for your own creations? Check out the"
# article_editor_suffix: "and help CodeCombat players get the most out of their playtime."
# find_us: "Find us on these sites"
find_us: "Finde uns auf diesen Seiten"
# contribute_to_the_project: "Contribute to the project"
editor:
@ -547,8 +547,8 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
back: "Zurück"
revert: "Zurücksetzen"
revert_models: "Models zurücksetzen."
# pick_a_terrain: "Pick A Terrain"
# small: "Small"
pick_a_terrain: "Wähle ein Terrain"
small: "Klein"
# grassy: "Grassy"
fork_title: "Forke neue Version"
fork_creating: "Erzeuge Fork..."
@ -608,7 +608,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
general:
and: "und"
name: "Name"
# date: "Date"
date: "Datum"
body: "Inhalt"
version: "Version"
commit_msg: "Commit Nachricht"
@ -685,20 +685,20 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
recruitment_description_suffix: "So wenn du deine Fähigkeiten entwickelt hast und zustimmst, werden wir deine besten Leistungen den tausenden Arbeitgebern demonstrieren, welche nur auf die Gelegentheit warten, dich einzustellen. Sie bezahlen uns ein bisschen, und sie bezahlen dir "
recruitment_description_italic: "jede Menge"
recruitment_description_ending: ", die Seite bleibt kostenlos und jeder ist glücklich. So der Plan."
# copyrights_title: "Copyrights and Licenses"
copyrights_title: "Copyrights und Lizenzen"
# contributor_title: "Contributor License Agreement"
# contributor_description_prefix: "All contributions, both on the site and on our GitHub repository, are subject to our"
# cla_url: "CLA"
# contributor_description_suffix: "to which you should agree before contributing."
# code_title: "Code - MIT"
# code_description_prefix: "All code owned by CodeCombat or hosted on codecombat.com, both in the GitHub repository or in the codecombat.com database, is licensed under the"
# mit_license_url: "MIT license"
mit_license_url: "MIT Lizenz"
# code_description_suffix: "This includes all code in Systems and Components that are made available by CodeCombat for the purpose of creating levels."
# art_title: "Art/Music - Creative Commons "
# art_description_prefix: "All common content is available under the"
# cc_license_url: "Creative Commons Attribution 4.0 International License"
# art_description_suffix: "Common content is anything made generally available by CodeCombat for the purpose of creating Levels. This includes:"
# art_music: "Music"
art_music: "Musik"
# art_sound: "Sound"
# art_artwork: "Artwork"
# art_sprites: "Sprites"
@ -733,7 +733,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
# alert_account_message: "To subscribe for class emails, you'll need to be logged in first."
# archmage_summary: "Interested in working on game graphics, user interface design, database and server organization, multiplayer networking, physics, sound, or game engine performance? Want to help build a game to help other people learn what you are good at? We have a lot to do and if you are an experienced programmer and want to develop for CodeCombat, this class is for you. We would love your help building the best programming game ever."
# archmage_introduction: "One of the best parts about building games is they synthesize so many different things. Graphics, sound, real-time networking, social networking, and of course many of the more common aspects of programming, from low-level database management, and server administration to user facing design and interface building. There's a lot to do, and if you're an experienced programmer with a hankering to really dive into the nitty-gritty of CodeCombat, this class might be for you. We would love to have your help building the best programming game ever."
# class_attributes: "Class Attributes"
class_attributes: "Klassenattribute"
# archmage_attribute_1_pref: "Knowledge in "
# archmage_attribute_1_suf: ", or a desire to learn. Most of our code is in this language. If you're a fan of Ruby or Python, you'll feel right at home. It's JavaScript, but with a nicer syntax."
# archmage_attribute_2: "Some experience in programming and personal initiative. We'll help you get oriented, but we can't spend much time training you."
@ -865,8 +865,8 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
# fight: "Fight!"
# watch_victory: "Watch your victory"
# defeat_the: "Defeat the"
# tournament_ends: "Tournament ends"
# tournament_ended: "Tournament ended"
tournament_ends: "Turnier endet"
tournament_ended: "Turnier beendet"
tournament_rules: "Turnier-Regeln"
# tournament_blurb: "Write code, collect gold, build armies, crush foes, win prizes, and upgrade your career in our $40,000 Greed tournament! Check out the details"
# tournament_blurb_criss_cross: "Win bids, construct paths, outwit opponents, grab gems, and upgrade your career in our Criss-Cross tournament! Check out the details"
@ -875,7 +875,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
winners: "Gewinner"
ladder_prizes:
title: "Turnier Preise"
title: "Turnierpreise"
# blurb_1: "These prizes will be awarded according to"
# blurb_2: "the tournament rules"
# blurb_3: "to the top human and ogre players."
@ -938,9 +938,9 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
document: "Dokument"
sprite_sheet: "Sprite Sheet"
candidate_sessions: "Kandidat-Sessions"
# user_remark: "User Remark"
# versions: "Versions"
# items: "Items"
user_remark: "Benutzerkommentar"
versions: "Versionen"
items: "Gegenstände"
delta:
added: "hinzugefügt"
@ -948,15 +948,15 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
deleted: "gelöscht"
# moved_index: "Moved Index"
# text_diff: "Text Diff"
# merge_conflict_with: "MERGE CONFLICT WITH"
# no_changes: "No Changes"
merge_conflict_with: "MERGE KONFLIKT MIT"
no_changes: "Keine Änderungen"
# user:
# stats: "Stats"
# singleplayer_title: "Singleplayer Levels"
# multiplayer_title: "Multiplayer Levels"
singleplayer_title: "Einzelspieler Levels"
multiplayer_title: "Mehrspieler Levels"
# achievements_title: "Achievements"
# last_played: "Last Played"
last_played: "Zuletzt gespielt"
# status: "Status"
# status_completed: "Completed"
# status_unfinished: "Unfinished"

View file

@ -103,11 +103,11 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
for_beginners: "Für Anfänger"
multiplayer: "Mehrspieler"
for_developers: "Für Entwickler"
# javascript_blurb: "The language of the web. Great for writing websites, web apps, HTML5 games, and servers."
javascript_blurb: "Die Sprache des Web. Geeignet für die Erstellung von Webseiten, WebApps, HTML5 Spielen und Servern.."
# python_blurb: "Simple yet powerful, Python is a great general purpose programming language."
# coffeescript_blurb: "Nicer JavaScript syntax."
# clojure_blurb: "A modern Lisp."
# lua_blurb: "Game scripting language."
coffeescript_blurb: "Schönere JavaScript Syntax."
clojure_blurb: "Ein modernes Lisp."
lua_blurb: "Skriptsprache für Spiele."
# io_blurb: "Simple but obscure."
play:
@ -179,7 +179,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
new_password: "Neues Passwort"
new_password_verify: "Passwort verifizieren"
email_subscriptions: "Email Abonnements"
# email_subscriptions_none: "No Email Subscriptions."
email_subscriptions_none: "Keine Email Abonnements."
email_announcements: "Ankündigungen"
email_announcements_description: "Erhalte regelmäßig Ankündigungen zu deinem Account."
email_notifications: "Benachrichtigungen"
@ -197,7 +197,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
error_saving: "Fehler beim Speichern"
saved: "Änderungen gespeichert"
password_mismatch: "Passwörter stimmen nicht überein."
# password_repeat: "Please repeat your password."
password_repeat: "Bitte wiederhole dein Passwort."
job_profile: "Jobprofil"
job_profile_approved: "Dein Jobprofil wurde von CodeCombat freigegeben. Arbeitgeber können dieses solange einsehen, bis du es als inaktiv markiert oder wenn innerhalb von vier Wochen keine Änderung daran vorgenommen wurde."
job_profile_explanation: "Hi! Fülle dies aus und wir melden uns bei dir bezüglich des Auffindens eines Jobs als Programmierer"
@ -212,7 +212,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
profile_for_suffix: ""
# featured: "Featured"
# not_featured: "Not Featured"
# looking_for: "Looking for:"
looking_for: "Suche nach:"
last_updated: "zuletzt geändert:"
contact: "Kontakt"
# active: "Looking for interview offers now"
@ -359,13 +359,13 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
customize_wizard: "Bearbeite den Zauberer"
home: "Startseite"
# stop: "Stop"
# game_menu: "Game Menu"
game_menu: "Spielmenü"
guide: "Hilfe"
restart: "Neustart"
goals: "Ziele"
# success: "Success!"
# incomplete: "Incomplete"
# timed_out: "Ran out of time"
success: "Erfolgreich!"
incomplete: "Unvollständig"
timed_out: "Zeit abgelaufen"
# failing: "Failing"
action_timeline: "Aktionszeitstrahl"
click_to_select: "Klicke auf eine Einheit, um sie auszuwählen."
@ -425,7 +425,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
tip_impossible: "Es wirkt immer unmöglich bis es vollbracht ist. - Nelson Mandela"
tip_talk_is_cheap: "Reden ist billig. Zeig mir den Code. - Linus Torvalds"
tip_first_language: "Das schwierigste, das du jemals lernen wirst, ist die erste Programmiersprache. - Alan Kay"
# tip_hardware_problem: "Q: How many programmers does it take to change a light bulb? A: None, it's a hardware problem."
tip_hardware_problem: "Q: Wie viele Programmierer braucht man um eine Glühbirne auszuwechseln? A: Keine, es ist ein Hardware-Problem."
time_current: "Aktuell"
time_total: "Total"
time_goto: "Gehe zu"
@ -435,17 +435,17 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
# game_menu:
# inventory_tab: "Inventory"
# choose_hero_tab: "Restart Level"
# save_load_tab: "Save/Load"
# options_tab: "Options"
choose_hero_tab: "Level neustarten"
save_load_tab: "Speichere/Lade"
options_tab: "Optionen"
# guide_tab: "Guide"
# multiplayer_tab: "Multiplayer"
multiplayer_tab: "Mehrspieler"
# inventory_caption: "Equip your hero"
# choose_hero_caption: "Choose hero, language"
# save_load_caption: "... and view history"
# options_caption: "Configure settings"
options_caption: "Konfiguriere Einstellungen"
# guide_caption: "Docs and tips"
# multiplayer_caption: "Play with friends!"
multiplayer_caption: "Spiele mit Freunden!"
# inventory:
# temp: "Temp"
@ -458,9 +458,9 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
# granularity_change_history: "History"
options:
# general_options: "General Options"
# music_label: "Music"
# music_description: "Turn background music on/off."
general_options: "Allgemeine Einstellungen"
music_label: "Musik"
music_description: "Schalte Hintergrundmusik an/aus."
# autorun_label: "Autorun"
# autorun_description: "Control automatic code execution."
editor_config: "Editor Einstellungen"
@ -472,8 +472,8 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
editor_config_keybindings_label: "Tastenbelegung"
editor_config_keybindings_default: "Standard (Ace)"
editor_config_keybindings_description: "Fügt zusätzliche Tastenkombinationen, bekannt aus anderen Editoren, hinzu"
# editor_config_livecompletion_label: "Live Autocompletion"
# editor_config_livecompletion_description: "Displays autocomplete suggestions while typing."
editor_config_livecompletion_label: "Live Auto-Vervollständigung"
editor_config_livecompletion_description: "Zeigt Vorschläge der Auto-Vervollständigung an während du tippst."
editor_config_invisibles_label: "Zeige unsichtbare Zeichen"
editor_config_invisibles_description: "Zeigt unsichtbare Zeichen wie Leertasten an."
editor_config_indentguides_label: "Zeige Einrückungshilfe"
@ -485,9 +485,9 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
# temp: "Temp"
multiplayer:
multiplayer_title: "Multiplayer Einstellungen"
multiplayer_title: "Mehrspieler Einstellungen"
# multiplayer_toggle: "Enable multiplayer"
# multiplayer_toggle_description: "Allow others to join your game."
multiplayer_toggle_description: "Erlaube anderen an deinem Spiel teilzunehmen."
multiplayer_link_description: "Gib diesen Link jedem, der mitmachen will."
multiplayer_hint_label: "Hinweis:"
multiplayer_hint: " Klick den Link, um alles auszuwählen, dann drück ⌘-C oder Strg-C um den Link zu kopieren."
@ -521,7 +521,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
av_entities_active_instances_url: "Aktive Instanzen"
av_entities_employer_list_url: "Arbeitgeberliste"
av_other_sub_title: "Sonstige"
# av_other_debug_base_url: "Base (for debugging base.jade)"
av_other_debug_base_url: "Base (um base.jade zu debuggen)"
u_title: "Benutzerliste"
lg_title: "Letzte Spiele"
# clas: "CLAs"
@ -535,7 +535,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
# thang_editor_suffix: "to modify the CodeCombat source artwork. Allow units to throw projectiles, alter the direction of an animation, change a unit's hit points, or upload your own vector sprites."
# article_editor_prefix: "See a mistake in some of our docs? Want to make some instructions for your own creations? Check out the"
# article_editor_suffix: "and help CodeCombat players get the most out of their playtime."
# find_us: "Find us on these sites"
find_us: "Finde uns auf diesen Seiten"
# contribute_to_the_project: "Contribute to the project"
editor:
@ -547,8 +547,8 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
back: "Zurück"
revert: "Zurücksetzen"
revert_models: "Models zurücksetzen."
# pick_a_terrain: "Pick A Terrain"
# small: "Small"
pick_a_terrain: "Wähle ein Terrain"
small: "Klein"
# grassy: "Grassy"
fork_title: "Forke neue Version"
fork_creating: "Erzeuge Fork..."
@ -608,7 +608,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
general:
and: "und"
name: "Name"
# date: "Date"
date: "Datum"
body: "Inhalt"
version: "Version"
commit_msg: "Commit Nachricht"
@ -685,20 +685,20 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
recruitment_description_suffix: "So wenn du deine Fähigkeiten entwickelt hast und zustimmst, werden wir deine besten Leistungen den tausenden Arbeitgebern demonstrieren, welche nur auf die Gelegentheit warten, dich einzustellen. Sie bezahlen uns ein bisschen, und sie bezahlen dir "
recruitment_description_italic: "jede Menge"
recruitment_description_ending: ", die Seite bleibt kostenlos und jeder ist glücklich. So der Plan."
# copyrights_title: "Copyrights and Licenses"
copyrights_title: "Copyrights und Lizenzen"
# contributor_title: "Contributor License Agreement"
# contributor_description_prefix: "All contributions, both on the site and on our GitHub repository, are subject to our"
# cla_url: "CLA"
# contributor_description_suffix: "to which you should agree before contributing."
# code_title: "Code - MIT"
# code_description_prefix: "All code owned by CodeCombat or hosted on codecombat.com, both in the GitHub repository or in the codecombat.com database, is licensed under the"
# mit_license_url: "MIT license"
mit_license_url: "MIT Lizenz"
# code_description_suffix: "This includes all code in Systems and Components that are made available by CodeCombat for the purpose of creating levels."
# art_title: "Art/Music - Creative Commons "
# art_description_prefix: "All common content is available under the"
# cc_license_url: "Creative Commons Attribution 4.0 International License"
# art_description_suffix: "Common content is anything made generally available by CodeCombat for the purpose of creating Levels. This includes:"
# art_music: "Music"
art_music: "Musik"
# art_sound: "Sound"
# art_artwork: "Artwork"
# art_sprites: "Sprites"
@ -733,7 +733,7 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
# alert_account_message: "To subscribe for class emails, you'll need to be logged in first."
# archmage_summary: "Interested in working on game graphics, user interface design, database and server organization, multiplayer networking, physics, sound, or game engine performance? Want to help build a game to help other people learn what you are good at? We have a lot to do and if you are an experienced programmer and want to develop for CodeCombat, this class is for you. We would love your help building the best programming game ever."
# archmage_introduction: "One of the best parts about building games is they synthesize so many different things. Graphics, sound, real-time networking, social networking, and of course many of the more common aspects of programming, from low-level database management, and server administration to user facing design and interface building. There's a lot to do, and if you're an experienced programmer with a hankering to really dive into the nitty-gritty of CodeCombat, this class might be for you. We would love to have your help building the best programming game ever."
# class_attributes: "Class Attributes"
class_attributes: "Klassenattribute"
# archmage_attribute_1_pref: "Knowledge in "
# archmage_attribute_1_suf: ", or a desire to learn. Most of our code is in this language. If you're a fan of Ruby or Python, you'll feel right at home. It's JavaScript, but with a nicer syntax."
# archmage_attribute_2: "Some experience in programming and personal initiative. We'll help you get oriented, but we can't spend much time training you."
@ -938,9 +938,9 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
document: "Dokument"
sprite_sheet: "Sprite Sheet"
candidate_sessions: "Kandidat-Sessions"
# user_remark: "User Remark"
# versions: "Versions"
# items: "Items"
user_remark: "Benutzerkommentar"
versions: "Versionen"
items: "Gegenstände"
delta:
added: "hinzugefügt"
@ -948,15 +948,15 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
deleted: "gelöscht"
# moved_index: "Moved Index"
# text_diff: "Text Diff"
# merge_conflict_with: "MERGE CONFLICT WITH"
# no_changes: "No Changes"
merge_conflict_with: "MERGE KONFLIKT MIT"
no_changes: "Keine Änderungen"
# user:
# stats: "Stats"
# singleplayer_title: "Singleplayer Levels"
# multiplayer_title: "Multiplayer Levels"
singleplayer_title: "Einzelspieler Levels"
multiplayer_title: "Mehrspieler Levels"
# achievements_title: "Achievements"
# last_played: "Last Played"
last_played: "Zuletzt gespielt"
# status: "Status"
# status_completed: "Completed"
# status_unfinished: "Unfinished"

View file

@ -355,7 +355,6 @@
play_level:
done: "Done"
grid: "Grid"
customize_wizard: "Customize Wizard"
home: "Home"
stop: "Stop"
@ -908,6 +907,7 @@
unknown: "Unknown error."
resources:
sessions: "Sessions"
your_sessions: "Your Sessions"
level: "Level"
social_network_apis: "Social Network APIs"
@ -923,6 +923,7 @@
patched_model: "Source Document"
model: "Model"
system: "System"
systems: "Systems"
component: "Component"
components: "Components"
thang: "Thang"
@ -937,10 +938,16 @@
source_document: "Source Document"
document: "Document"
sprite_sheet: "Sprite Sheet"
employers: "Employers"
candidates: "Candidates"
candidate_sessions: "Candidate Sessions"
user_remark: "User Remark"
user_remarks: "User Remarks"
versions: "Versions"
items: "Items"
wizard: "Wizard"
achievement: "Achievement"
clas: "CLAs"
delta:
added: "Added"

View file

@ -358,7 +358,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
grid: "Grelha"
customize_wizard: "Personalizar Feiticeiro"
home: "Início"
# stop: "Stop"
stop: "Parar"
game_menu: "Menu do Jogo"
guide: "Guia"
restart: "Reiniciar"
@ -499,9 +499,9 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
space: "Espaço"
enter: "Enter"
escape: "Esc"
# shift: "Shift"
shift: "Shift"
cast_spell: "Lançar feitiço atual."
# run_real_time: "Run in real time."
run_real_time: "Correr em tempo real."
continue_script: "Saltar o script atual."
skip_scripts: "Saltar todos os scripts saltáveis."
toggle_playback: "Alternar entre Jogar e Pausar."

View file

@ -312,7 +312,7 @@ class CocoModel extends Backbone.Model
achievements = new NewAchievementCollection
achievements.fetch
success: (collection) ->
me.fetch (success: -> Backbone.Mediator.publish('achievements:new', collection)) unless _.isEmpty(collection.models)
me.fetch (success: -> Backbone.Mediator.publish('achievements:new', earnedAchievements: collection)) unless _.isEmpty(collection.models)
error: ->
console.error 'Miserably failed to fetch unnotified achievements', arguments

View file

@ -0,0 +1,17 @@
c = require './../schemas'
CLASubmissionSchema = c.object {
title: 'CLA Submission'
description: 'Recording when a user signed the CLA.'
}
_.extend CLASubmissionSchema.properties,
user: c.objectId links: [{rel: 'extra', href: '/db/user/{($)}'}]
email: c.shortString({format: 'email'})
name: {type: 'string'}
githubUsername: c.shortString()
created: c.date title: 'Created', readOnly: true
c.extendBasicProperties CLASubmissionSchema, 'user.remark'
module.exports = CLASubmissionSchema

View file

@ -65,7 +65,7 @@ GoalSchema = c.object {title: 'Goal', description: 'A goal that the player can a
ResponseSchema = c.object {title: 'Dialogue Button', description: 'A button to be shown to the user with the dialogue.', required: ['text']},
text: {title: 'Title', description: 'The text that will be on the button', 'default': 'Okay', type: 'string', maxLength: 30}
channel: c.shortString(title: 'Channel', format: 'event-channel', description: 'Channel that this event will be broadcast over, like "level-set-playing".')
channel: c.shortString(title: 'Channel', format: 'event-channel', description: 'Channel that this event will be broadcast over, like "level:set-playing".')
event: {type: 'object', title: 'Event', description: 'Event that will be broadcast when this button is pressed, like {playing: true}.'}
buttonClass: c.shortString(title: 'Button Class', description: 'CSS class that will be added to the button, like "btn-primary".')
i18n: {type: 'object', format: 'i18n', props: ['text'], description: 'Help translate this button'}

View file

@ -43,7 +43,7 @@ _.extend UserSchema.properties,
photoURL: {type: 'string', format: 'image-file', title: 'Profile Picture', description: 'Upload a 256x256px or larger image to serve as your profile picture.'}
facebookID: c.shortString({title: 'Facebook ID'})
githubID: c.shortString({title: 'GitHub ID'})
githubID: {type: 'integer', title: 'GitHub ID'}
gplusID: c.shortString({title: 'G+ ID'})
wizardColor1: c.pct({title: 'Wizard Clothes Color'})

View file

@ -1,45 +0,0 @@
module.exports =
'application: idle-changed':
{} # TODO schema
'fbapi-loaded':
{} # TODO schema
'logging-in-with-facebook':
{} # TODO schema
'facebook-logged-in':
title: 'Facebook logged in'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when you successfully logged in with facebook'
type: 'object'
properties:
response:
type: 'object'
properties:
status: {type: 'string'}
authResponse:
type: 'object'
properties:
accessToken: {type: 'string'}
expiresIn: {type: 'number'}
signedRequest: {type: 'string'}
userID: {type: 'string'}
required: ['response']
'facebook-logged-out': {}
'linkedin-loaded': {}
'gapi-loaded':
{} # TODO schema
'logging-in-with-gplus':
{} # TODO schema
'gplus-logged-in':
title: 'G+ logged in'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when you successfully logged in with G+'
type: 'object'
required: ['access_token']

View file

@ -0,0 +1,39 @@
c = require 'schemas/schemas'
module.exports =
'auth:me-synced': c.object {required: ['me']},
me: {type: 'object'}
'auth:facebook-api-loaded': c.object {}
'auth:logging-in-with-facebook': c.object {}
'auth:logged-in-with-facebook': c.object {title: 'Facebook logged in', description: 'Published when you successfully logged in with Facebook', required: ['response']},
response:
type: 'object'
properties:
status: {type: 'string'}
authResponse:
type: 'object'
properties:
accessToken: {type: 'string'}
expiresIn: {type: 'number'}
signedRequest: {type: 'string'}
userID: {type: 'string'}
'auth:linkedin-api-loaded': c.object {}
'auth:gplus-api-loaded': c.object {}
'auth:logging-in-with-gplus': c.object {}
'auth:logged-in-with-gplus':
title: 'G+ logged in'
description: 'Published when you successfully logged in with G+'
type: 'object'
required: ['access_token']
properties:
access_token: {type: 'string'}
# Could be some other stuff
'auth:log-in-with-github': c.object {}

View file

@ -1,71 +1,27 @@
c = require 'schemas/schemas'
module.exports =
'bus:connecting':
title: 'Bus Connecting'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when a Bus starts connecting'
type: 'object'
properties:
bus:
$ref: 'bus'
'bus:connecting': c.object {title: 'Bus Connecting', description: 'Published when a Bus starts connecting'},
bus: {$ref: 'bus'}
'bus:connected':
title: 'Bus Connected'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when a Bus has connected'
type: 'object'
properties:
bus:
$ref: 'bus'
'bus:connected': c.object {title: 'Bus Connected', description: 'Published when a Bus has connected'},
bus: {$ref: 'bus'}
'bus:disconnected':
title: 'Bus Disconnected'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when a Bus has disconnected'
type: 'object'
properties:
bus:
$ref: 'bus'
'bus:disconnected': c.object {title: 'Bus Disconnected', description: 'Published when a Bus has disconnected'},
bus: {$ref: 'bus'}
'bus:new-message':
title: 'Message sent'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'A new message was sent'
type: 'object'
properties:
message:
type: 'object'
bus:
$ref: 'bus'
'bus:new-message': c.object {title: 'Message sent', description: 'A new message was sent'},
message: {type: 'object'}
bus: {$ref: 'bus'}
'bus:player-joined':
title: 'Player joined'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'A new player has joined'
type: 'object'
properties:
player:
type: 'object'
bus:
$ref: 'bus'
'bus:player-joined': c.object {title: 'Player joined', description: 'A new player has joined'},
player: {type: 'object'}
bus: {$ref: 'bus'}
'bus:player-left':
title: 'Player left'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'A player has left'
type: 'object'
properties:
player:
type: 'object'
bus:
$ref: 'bus'
'bus:player-left': c.object {title: 'Player left', description: 'A player has left'},
player: {type: 'object'}
bus: {$ref: 'bus'}
'bus:player-states-changed':
title: 'Player state changes'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'State of the players has changed'
type: 'object'
properties:
player:
type: 'array'
bus:
$ref: 'bus'
'bus:player-states-changed': c.object {title: 'Player state changes', description: 'State of the players has changed'},
states: c.array {}, {type: 'object'}
bus: {$ref: 'bus'}

View file

@ -1,78 +1,43 @@
c = require 'schemas/schemas'
module.exports =
'save-new-version':
title: 'Save New Version'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when a version gets saved'
type: 'object'
properties:
major:
type: 'boolean'
commitMessage:
type: 'string'
required: ['major', 'commitMessage']
additionalProperties: false
'editor:save-new-version': c.object {title: 'Save New Version', description: 'Published when a version gets saved', required: ['major', 'commitMessage']},
major: {type: 'boolean'}
commitMessage: {type: 'string'}
# TODO all these events starting with 'level:' should have 'editor' in their name
# to avoid confusion with level play events
'editor:view-switched': c.object {title: 'Level View Switched', description: 'Published whenever the view switches'}
'level:view-switched':
title: 'Level View Switched'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published whenever the view switches'
$ref: 'jQueryEvent'
'editor:level-component-editing-ended': c.object {required: ['component']},
component: {type: 'object'}
'level-components-changed':
{} # TODO schema
'editor:edit-level-system': c.object {required: ['original', 'majorVersion']},
original: {type: 'string'}
majorVersion: {type: 'integer', minimum: 0}
'edit-level-component':
{} # TODO schema
'editor:level-system-added': c.object {required: ['system']},
system: {type: 'object'}
'level-component-edited':
{} # TODO schema
'editor:level-system-editing-ended': c.object {required: ['system']},
system: {type: 'object'}
'level-component-editing-ended':
{} # TODO schema
'editor:edit-level-thang': c.object {required: ['thangID']},
thangID: {type: 'string'}
'level-systems-changed':
{} # TODO schema
'editor:level-thang-edited': c.object {required: ['thangID', 'thangData']},
thangID: {type: 'string'}
thangData: {type: 'object'}
'edit-level-system':
{} # TODO schema
'editor:level-thang-done-editing': c.object {}
'level-system-added':
{} # TODO schema
'editor:level-loaded': c.object {required: ['level']},
level: {type: 'object'}
'level-system-edited':
{} # TODO schema
'level:reload-from-data': c.object {required: ['level', 'supermodel']},
level: {type: 'object'}
supermodel: {type: 'object'}
'level-system-editing-ended':
{} # TODO schema
'level:reload-thang-type': c.object {required: ['thangType']},
thangType: {type: 'object'}
'level-thangs-changed':
title: 'Level Thangs Changed'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when a Thang changes'
type: 'object'
properties:
thangsData:
type: 'array'
required: ['thangsData']
additionalProperties: false
'edit-level-thang':
{} # TODO schema
'level-thang-edited':
{} # TODO schema
'level-thang-done-editing':
{} # TODO schema
'level-loaded':
{} # TODO schema
'level-reload-from-data':
{} # TODO schema
'save-new-version':
{} # TODO schema
'editor:random-terrain-generated': c.object {required: ['thangs']},
thangs: c.array {}, {type: 'object'}

View file

@ -1,4 +1,6 @@
c = require 'schemas/schemas'
module.exports =
# app/lib/errors
'server-error':
{} # TODO schema
'errors:server-error': c.object {required: ['response']},
response: {type: 'object'}

View file

@ -0,0 +1,53 @@
c = require 'schemas/schemas'
goalStatesSchema =
type: 'object'
additionalProperties:
type: 'object'
required: ['status']
properties:
status:
oneOf: [
{type: 'null'}
{type: 'string', enum: ['success', 'failure', 'incomplete']}
]
keyFrame:
oneOf: [
{type: 'integer', minimum: 0}
{type: 'string', enum: ['end']}
]
team: {type: ['null', 'string']}
worldUpdatedEventSchema = c.object {required: ['world', 'firstWorld', 'goalStates', 'team', 'firstChangedFrame']},
world: {type: 'object'}
firstWorld: {type: 'boolean'}
goalStates: goalStatesSchema
team: {type: 'string'}
firstChangedFrame: {type: 'integer', minimum: 0}
module.exports =
'god:user-code-problem': c.object {required: ['problem']},
problem: {type: 'object'}
'god:non-user-code-problem': c.object {required: ['problem']},
problem: {type: 'object'}
'god:infinite-loop': c.object {required: ['firstWorld']},
firstWorld: {type: 'boolean'}
'god:new-world-created': worldUpdatedEventSchema
'god:streaming-world-updated': worldUpdatedEventSchema
'god:goals-calculated': c.object {required: ['goalStates']},
goalStates: goalStatesSchema
'god:world-load-progress-changed': c.object {required: ['progress']},
progress: {type: 'number', minimum: 0, maximum: 1}
'god:debug-world-load-progress-changed': c.object {required: ['progress']},
progress: {type: 'number', minimum: 0, maximum: 1}
'god:debug-value-return': c.object {required: ['key']},
key: {type: 'string'}
value: {type: 'any'}

View file

@ -1,23 +1,29 @@
c = require 'schemas/schemas'
module.exports =
'audio-played:loaded':
{} # TODO schema
'application:idle-changed': c.object {},
idle: {type: 'boolean'}
# TODO location is debatable
'note-group-started':
{} # TODO schema
'audio-player:loaded': c.object {required: ['sender']},
sender: {type: 'object'}
'note-group-ended':
{} # TODO schema
'audio-player:play-sound': c.object {required: ['trigger']},
trigger: {type: 'string'}
volume: {type: 'number', minimum: 0, maximum: 1}
'modal-opened':
{} # TODO schema
'music-player:play-music': c.object {required: ['play']},
play: {type: 'boolean'}
file: {type: 'string'}
'modal-closed':
{} # TODO schema
'modal:opened': c.object {}
# TODO I propose prepending 'modal:'
'save-new-version':
{} # TODO schema
'modal:closed': c.object {}
'router:navigate':
{} # TODO schema
'router:navigate': c.object {required: ['route']},
route: {type: 'string'}
view: {type: 'object'}
viewClass: {type: 'object'}
viewArgs: {type: 'array'}
'achievements:new': c.object {required: 'earnedAchievements'},
earnedAchievements: {type: 'object'}

View file

@ -1,206 +1,153 @@
c = require 'schemas/schemas'
module.exports =
# TODO There should be a better way to divide these channels into smaller ones
# TODO location is debatable
'echo-self-wizard-sprite':
{} # TODO schema
'level:session-will-save': c.object {required: ['session']},
session: {type: 'object'}
'level:session-will-save':
{} # TODO schema
'level:shift-space-pressed': c.object {}
'level-loader:progress-changed':
{} # TODO schema
'level:escape-pressed': c.object {}
'level:shift-space-pressed':
{} # TODO schema
'level:enable-controls': c.object {},
controls: c.array {},
c.shortString()
'level:escape-pressed':
{} # TODO schema
'level:disable-controls': c.object {},
controls: c.array {},
c.shortString()
'level-enable-controls':
{} # TODO schema
'level-set-letterbox':
{} # TODO schema
'level:set-letterbox': c.object {},
on: {type: 'boolean'}
'level:started':
{} # TODO schema
'level:started': c.object {}
'level-set-debug':
{} # TODO schema
'level:set-debug': c.object {required: ['debug']},
debug: {type: 'boolean'}
'level-set-grid':
{} # TODO schema
'level:restart': c.object {}
'level:restarted':
{} # TODO schema
'level:restarted': c.object {}
'level-set-volume':
{} # TODO schema
'level:set-volume': c.object {required: ['volume']},
volume: {type: 'number', minimum: 0, maximum: 1}
'level-set-time':
{} # TODO schema
'level:set-time': c.object {},
time: {type: 'number', minimum: 0}
ratio: {type: 'number', minimum: 0, maximum: 1}
frameOffset: {type: 'integer'}
scrubDuration: {type: 'integer', minimum: 0}
'level-select-sprite':
{} # TODO schema
'level:select-sprite': c.object {},
thangID: {type: ['string', 'null', 'undefined']}
spellName: {type: ['string', 'null', 'undefined']}
'level-set-playing':
{} # TODO schema
'level:set-playing': c.object {required: ['playing']},
playing: {type: 'boolean'}
'level:team-set':
{} # TODO schema
'level:team-set': c.object {required: ['team']},
team: c.shortString()
'level:docs-shown': {}
'level:docs-shown': c.object {}
'level:docs-hidden': {}
'level:docs-hidden': c.object {}
'level:victory-hidden':
{} # TODO schema
'level:flag-color-selected': c.object {},
color:
oneOf: [
{type: 'null'}
{type: 'string', enum: ['green', 'black', 'violet'], description: 'The flag color to place next, or omitted/null if deselected.'}
]
pos: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'level:flag-color-selected':
type: 'object'
additionalProperties: false
properties:
color:
oneOf: [
{type: 'null'}
{type: 'string', enum: ['green', 'black', 'violet'], description: 'The flag color to place next, or omitted/null if deselected.'}
]
pos:
'level:flag-updated': c.object {required: ['player', 'color', 'time', 'active']},
player: {type: 'string'}
team: {type: 'string'}
color: {type: 'string', enum: ['green', 'black', 'violet']}
time: {type: 'number', minimum: 0}
active: {type: 'boolean'}
pos: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'level:next-game-pressed': c.object {}
'level:loading-view-unveiled': c.object {required: ['view']},
view: {type: 'object'}
'playback:manually-scrubbed': c.object {required: ['ratio']},
ratio: {type: 'number', minimum: 0, maximum: 1}
'playback:stop-real-time-playback': c.object {}
'playback:real-time-playback-started': c.object {}
'playback:real-time-playback-ended': c.object {}
'level:play-next-level': c.object {}
'level:toggle-playing': c.object {}
'level:toggle-grid': c.object {}
'level:toggle-debug': c.object {}
'level:toggle-pathfinding': c.object {}
'level:scrub-forward': c.object {}
'level:scrub-back': c.object {}
'level:show-victory': c.object {required: ['showModal']},
showModal: {type: 'boolean'}
'level:highlight-dom': c.object {required: ['selector']},
selector: {type: 'string'}
delay: {type: 'number'}
sides: {type: 'array', items: {'enum': ['left', 'right', 'top', 'bottom']}}
offset: {type: 'object'}
rotation: {type: 'number'}
'level:end-highlight-dom': c.object {}
'level:focus-dom': c.object {},
selector: {type: 'string'}
'level:lock-select': c.object {},
lock: {type: ['boolean', 'array']}
'level:suppress-selection-sounds': c.object {required: ['suppress']},
suppress: {type: 'boolean'}
'goal-manager:new-goal-states': c.object {required: ['goalStates', 'goals', 'overallStatus', 'timedOut']},
goalStates:
type: 'object'
additionalProperties:
type: 'object'
additionalProperties: false
required: ['x', 'y']
required: ['status']
properties:
x: {type: 'number'}
y: {type: 'number'}
status:
oneOf: [
{type: 'null'}
{type: 'string', enum: ['success', 'failure', 'incomplete']}
]
keyFrame:
oneOf: [
{type: 'integer', minimum: 0}
{type: 'string', enum: ['end']}
]
team: {type: ['null', 'string']}
goals: c.array {},
{type: 'object'}
overallStatus:
oneOf: [
{type: 'null'}
{type: 'string', enum: ['success', 'failure', 'incomplete']}
]
timedOut: {type: 'boolean'}
'level:flag-updated':
type: 'object'
additionalProperties: false
required: ['player', 'color', 'time', 'active']
properties:
player:
type: 'string'
team:
type: 'string'
color:
type: 'string'
enum: ['green', 'black', 'violet']
time:
type: 'number'
minimum: 0
active:
type: 'boolean'
pos:
type: 'object'
additionalProperties: false
required: ['x', 'y']
properties:
x: {type: 'number'}
y: {type: 'number'}
'next-game-pressed':
{} # TODO schema
'end-current-script':
{} # TODO schema
'script:reset':
{} # TODO schema
'script:ended':
{} # TODO schema
'end-all-scripts': {}
'script:state-changed':
{} # TODO schema
'script-manager:tick':
type: 'object'
additionalProperties: false
properties:
scriptRunning: {type: 'string'}
noteGroupRunning: {type: 'string'}
timeSinceLastScriptEnded: {type: 'number'}
scriptStates:
type: 'object'
additionalProperties:
title: 'Script State'
type: 'object'
additionalProperties: false
properties:
timeSinceLastEnded:
type: 'number'
description: 'seconds since this script ended last'
timeSinceLastTriggered:
type: 'number'
description: 'seconds since this script was triggered last'
'play-sound':
{} # TODO schema
# TODO refactor name
'onLoadingViewUnveiled':
{} # TODO schema
'playback:manually-scrubbed':
{} # TODO schema
'playback:stop-real-time-playback':
type: 'object'
additionalProperties: false
'playback:real-time-playback-started':
type: 'object'
additionalProperties: false
'playback:real-time-playback-ended':
type: 'object'
additionalProperties: false
'change:editor-config':
{} # TODO schema
'restart-level':
{} # TODO schema
'play-next-level':
{} # TODO schema
'level-select-sprite':
{} # TODO schema
'level-toggle-grid':
{} # TODO schema
'level-toggle-debug':
{} # TODO schema
'level-toggle-pathfinding':
{} # TODO schema
'level-scrub-forward':
{} # TODO schema
'level-scrub-back':
{} # TODO schema
'level-show-victory':
type: 'object'
additionalProperties: false
properties:
showModal: {type: 'boolean'}
'level-highlight-dom':
type: 'object'
additionalProperties: false
properties:
selector: {type: 'string'}
delay: {type: 'number'}
sides: {type: 'array', items: {'enum': ['left', 'right', 'top', 'bottom']}}
offset: {type: 'object'}
rotation: {type: 'number'}
'goal-manager:new-goal-states':
{} # TODO schema
'level:edit-wizard-settings': c.object {}

View file

@ -0,0 +1,27 @@
c = require 'schemas/schemas'
module.exports =
'script:end-current-script': c.object {}
'script:reset': c.object {}
'script:ended': c.object {required: ['scriptID']},
scriptID: {type: 'string'}
'script:state-changed': c.object {required: ['currentScript', 'currentScriptOffset']},
currentScript: {type: ['string', 'null']}
currentScriptOffset: {type: 'integer', minimum: 0}
'script:tick': c.object {required: ['scriptRunning', 'noteGroupRunning', 'scriptStates', 'timeSinceLastScriptEnded']},
scriptRunning: {type: 'string'}
noteGroupRunning: {type: 'string'}
timeSinceLastScriptEnded: {type: 'number'}
scriptStates:
type: 'object'
additionalProperties: c.object {title: 'Script State'},
timeSinceLastEnded: {type: 'number', minimum: 0, description: 'seconds since this script ended last'}
timeSinceLastTriggered: {type: 'number', minimum: 0, description: 'seconds since this script was triggered last'}
'script:note-group-started': c.object {}
'script:note-group-ended': c.object {}

View file

@ -1,108 +1,180 @@
c = require 'schemas/schemas'
spriteMouseEventSchema = c.object {required: ['sprite', 'thang', 'originalEvent', 'canvas']},
sprite: {type: 'object'}
thang: {type: 'object'}
originalEvent: {type: 'object'}
canvas: {type: 'object'}
module.exports = # /app/lib/surface
'camera-dragged':
{} # TODO schema
'camera:dragged': c.object {}
'camera-zoom-in':
{} # TODO schema
'camera:zoom-in': c.object {}
'camera-zoom-out':
{} # TODO schema
'camera:zoom-out': c.object {}
'camera-zoom-to':
{} # TODO schema
'camera:zoom-to': c.object {required: ['pos']},
pos: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
duration: {type: 'number', minimum: 0}
'camera:zoom-updated':
{} # TODO schema
'camera:zoom-updated': c.object {required: ['camera', 'zoom', 'surfaceViewport']},
camera: {type: 'object'}
zoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
surfaceViewport: {type: 'object'}
'sprite:speech-updated':
{} # TODO schema
'camera:set-camera': c.object {},
pos: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
thangID: {type: 'string'}
zoom: {type: 'number'}
duration: {type: 'number', minimum: 0}
bounds: c.array {maxItems: 2, minItems: 2},
c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'dialogue-sound-completed':
{} # TODO schema
'sprite:speech-updated': c.object {required: ['sprite', 'thang']},
sprite: {type: 'object'}
thang: {type: 'object'}
blurb: {type: 'string'}
message: {type: 'string'}
mood: {type: 'string'}
responses: {type: 'array'}
spriteID: {type: 'string'}
sound: {type: ['null', 'undefined', 'object']}
'surface:gold-changed':
{} # TODO schema
'level:sprite-dialogue': c.object {required: ['spriteID', 'message']},
blurb: {type: 'string'}
message: {type: 'string'}
mood: {type: 'string'}
responses: {type: 'array'}
spriteID: {type: 'string'}
sound: {type: ['null', 'undefined', 'object']}
'surface:coordinate-selected':
{} # TODO schema
'sprite:dialogue-sound-completed': c.object {}
'surface:coordinates-shown':
{} # TODO schema
'level:sprite-clear-dialogue': c.object {}
'level-sprite-clear-dialogue':
{} # TODO schema
'surface:gold-changed': c.object {required: ['team', 'gold']},
team: {type: 'string'}
gold: {type: 'number'}
goldEarned: {type: 'number'}
'sprite:loaded':
{} # TODO schema
'surface:coordinate-selected': c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'choose-point':
{} # TODO schema
'surface:coordinates-shown': c.object {}
'choose-region':
{} # TODO schema
'sprite:loaded': c.object {},
sprite: {type: 'object'}
'surface:new-thang-added':
{} # TODO schema
'surface:choose-point': c.object {required: ['point']},
point: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'surface:sprite-selected':
{} # TODO schema
'surface:choose-region': c.object {required: ['points']},
points: c.array {minItems: 2, maxItems: 2},
c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'thang-began-talking':
{} # TODO schema
'surface:new-thang-added': c.object {required: ['thang', 'sprite']},
thang: {type: 'object'}
sprite: {type: 'object'}
'thang-finished-talking':
{} # TODO schema
'surface:sprite-selected': c.object {required: ['thang', 'sprite']},
thang: {type: ['object', 'null', 'undefined']}
sprite: {type: ['object', 'null', 'undefined']}
spellName: {type: ['string', 'null', 'undefined']}
originalEvent: {type: ['object', 'null', 'undefined']}
worldPos: {type: ['object', 'null', 'undefined']}
'surface:world-set-up':
{} # TODO schema
'sprite:thang-began-talking': c.object {},
thang: {type: 'object'}
'surface:frame-changed':
{} # TODO schema
'sprite:thang-finished-talking': c.object {},
thang: {type: 'object'}
'surface:playback-ended':
{} # TODO schema
'sprite:highlight-sprites': c.object {},
thangIDs: c.array {}, {type: 'string'}
delay: {type: 'number'}
'surface:playback-restarted':
{} # TODO schema
'sprite:move': c.object {required: ['spriteID', 'pos']},
spriteID: {type: 'string'}
pos: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
duration: {type: 'number', minimum: 0}
'level-set-playing':
{} # TODO schema
'sprite:mouse-down': spriteMouseEventSchema
'sprite:clicked': spriteMouseEventSchema
'sprite:double-clicked': spriteMouseEventSchema
'sprite:dragged': spriteMouseEventSchema
'sprite:mouse-up': spriteMouseEventSchema
'registrar-echo-states':
{} # TODO schema
'surface:world-set-up': c.object {},
world: {type: 'object'}
'surface:mouse-moved':
{} # TODO schema
'surface:frame-changed': c.object {required: ['frame', 'world', 'progress']},
frame: {type: 'number', minimum: 0}
world: {type: 'object'}
progress: {type: 'number', minimum: 0, maximum: 1}
selectedThang: {type: ['object', 'null', 'undefined']}
'surface:stage-mouse-down':
{} # TODO schema
'surface:playback-ended': c.object {}
'surface:mouse-scrolled':
{} # TODO schema
'surface:playback-restarted': c.object {}
'surface:ticked':
{} # TODO schema
'surface:mouse-moved': c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
'surface:mouse-over':
{} # TODO schema
'surface:stage-mouse-down': c.object {required: ['onBackground', 'x', 'y', 'originalEvent']},
onBackground: {type: 'boolean'}
x: {type: 'number'}
y: {type: 'number'}
originalEvent: {type: 'object'}
worldPos: {type: ['object', 'null', 'undefined']}
'surface:mouse-out':
{} # TODO schema
'surface:stage-mouse-up': c.object {required: ['onBackground', 'x', 'y', 'originalEvent']},
onBackground: {type: 'boolean'}
x: {type: 'number'}
y: {type: 'number'}
originalEvent: {type: 'object'}
'self-wizard:target-changed':
{} # TODO schema
'surface:mouse-scrolled': c.object {required: ['deltaX', 'deltaY', 'screenPos', 'canvas']},
deltaX: {type: 'number'}
deltaY: {type: 'number'}
screenPos: c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
canvas: {type: 'object'}
'echo-all-wizard-sprites':
{} # TODO schema
'surface:ticked': c.object {required: ['dt']},
dt: {type: 'number'}
'surface:flag-appeared':
type: 'object'
additionalProperties: false
required: ['sprite']
properties:
sprite:
type: 'object'
'surface:mouse-over': c.object {}
'surface:remove-selected-flag':
type: 'object'
additionalProperties: false
'surface:mouse-out': c.object {}
'sprite:echo-all-wizard-sprites': c.object {required: ['payload']},
payload: c.array {}, {type: 'object'}
'self-wizard:created': c.object {required: ['sprite']},
sprite: {type: 'object'}
'self-wizard:target-changed': c.object {required: ['sprite']},
sprite: {type: 'object'}
'surface:flag-appeared': c.object {required: ['sprite']},
sprite: {type: 'object'}
'surface:remove-selected-flag': c.object {}
'surface:remove-flag': c.object {required: 'color'},
color: {type: 'string'}

View file

@ -1,277 +1,109 @@
c = require 'schemas/schemas'
module.exports =
"tome:cast-spell":
title: "Cast Spell"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when a spell is cast"
type: ["object", "undefined"]
properties:
spell:
type: "object"
thang:
type: "object"
preload:
type: "boolean"
realTime:
type: "boolean"
required: []
additionalProperties: false
'tome:cast-spell': c.object {title: 'Cast Spell', description: 'Published when a spell is cast', required: ['spell', 'thang', 'preload', 'realTime']},
spell: {type: 'object'}
thang: {type: 'object'}
preload: {type: 'boolean'}
realTime: {type: 'boolean'}
"tome:cast-spells":
title: "Cast Spells"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when spells are cast"
type: ["object", "undefined"]
properties:
spells:
type: "object"
preload:
type: "boolean"
realTime:
type: "boolean"
required: []
additionalProperties: false
'tome:cast-spells': c.object {title: 'Cast Spells', description: 'Published when spells are cast', required: ['spells', 'preload', 'realTime']},
spells: [type: 'object']
preload: [type: 'boolean']
realTime: [type: 'boolean']
"tome:manual-cast":
title: "Manually Cast Spells"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you wish to manually recast all spells"
type: "object"
properties:
realTime:
type: "boolean"
required: []
additionalProperties: false
'tome:manual-cast': c.object {title: 'Manually Cast Spells', description: 'Published when you wish to manually recast all spells', required: []},
realTime: {type: 'boolean'}
"tome:spell-created":
title: "Spell Created"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published after a new spell has been created"
type: "object"
properties:
"spell": "object"
required: ["spell"]
additionalProperties: false
'tome:spell-created': c.object {title: 'Spell Created', description: 'Published after a new spell has been created', required: ['spell']},
spell: {type: 'object'}
"tome:spell-debug-property-hovered":
title: "Spell Debug Property Hovered"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you hover over a spell property"
type: "object"
properties:
"property": "string"
"owner": "string"
required: []
additionalProperties: false
'tome:spell-has-changed-significantly-calculation': c.object {title: 'Has Changed Significantly Calculation', description: 'Let anyone know that the spell has changed significantly.', required: ['hasChangedSignificantly']},
hasChangedSignificantly: {type: 'boolean'}
"tome:toggle-spell-list":
title: "Toggle Spell List"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you toggle the dropdown for a thang's spells"
type: "undefined"
additionalProperties: false
'tome:spell-debug-property-hovered': c.object {title: 'Spell Debug Property Hovered', description: 'Published when you hover over a spell property', required: []},
property: {type: 'string'}
owner: {type: 'string'}
"tome:reload-code":
title: "Reload Code"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you reset a spell to its original source"
type: "object"
properties:
"spell": "object"
required: ["spell"]
additionalProperties: false
'tome:spell-debug-value-request': c.object {title: 'Spell Debug Value Request', description: 'Published when the SpellDebugView wants to retrieve a debug value.', required: ['thangID', 'spellID', 'variableChain', 'frame']},
thangID: {type: 'string'}
spellID: {type: 'string'}
variableChain: c.array {}, {type: 'string'}
frame: {type: 'integer', minimum: 0}
"tome:palette-hovered":
title: "Palette Hovered"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you hover over a Thang in the spell palette"
type: "object"
properties:
"thang": "object"
"prop": "string"
"entry": "object"
required: ["thang", "prop", "entry"]
additionalProperties: false
'tome:toggle-spell-list': c.object {title: 'Toggle Spell List', description: 'Published when you toggle the dropdown for a thang\'s spells'}
"tome:palette-pin-toggled":
title: "Palette Pin Toggled"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you pin or unpin the spell palette"
type: "object"
properties:
"entry": "object"
"pinned": "boolean"
required: ["entry", "pinned"]
additionalProperties: false
'tome:reload-code': c.object {title: 'Reload Code', description: 'Published when you reset a spell to its original source', required: ['spell']},
spell: {type: 'object'}
"tome:palette-clicked":
title: "Palette Clicked"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you click on the spell palette"
type: "object"
properties:
"thang": "object"
"prop": "string"
"entry": "object"
required: ["thang", "prop", "entry"]
additionalProperties: false
'tome:palette-hovered': c.object {title: 'Palette Hovered', description: 'Published when you hover over a Thang in the spell palette', required: ['thang', 'prop', 'entry']},
thang: {type: 'object'}
prop: {type: 'string'}
entry: {type: 'object'}
"tome:spell-statement-index-updated":
title: "Spell Statement Index Updated"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when the spell index is updated"
type: "object"
properties:
"statementIndex": "object"
"ace": "object"
required: ["statementIndex", "ace"]
additionalProperties: false
'tome:palette-pin-toggled': c.object {title: 'Palette Pin Toggled', description: 'Published when you pin or unpin the spell palette', required: ['entry', 'pinned']},
entry: {type: 'object'}
pinned: {type: 'boolean'}
# TODO proposition: refactor 'tome' into spell events
"spell-beautify":
title: "Beautify"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you click the \"beautify\" button"
type: "object"
properties:
"spell": "object"
required: []
additionalProperties: false
'tome:palette-clicked': c.object {title: 'Palette Clicked', description: 'Published when you click on the spell palette', required: ['thang', 'prop', 'entry']},
thang: {type: 'object'}
prop: {type: 'string'}
entry: {type: 'object'}
"spell-step-forward":
title: "Step Forward"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you step forward in time"
type: "undefined"
additionalProperties: false
'tome:spell-statement-index-updated': c.object {title: 'Spell Statement Index Updated', description: 'Published when the spell index is updated', required: ['statementIndex', 'ace']},
statementIndex: {type: 'object'}
ace: {type: 'object'}
"spell-step-backward":
title: "Step Backward"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you step backward in time"
type: "undefined"
additionalProperties: false
'tome:spell-beautify': c.object {title: 'Beautify', description: 'Published when you click the \'beautify\' button', required: []},
spell: {type: 'object'}
"tome:spell-loaded":
title: "Spell Loaded"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when a spell is loaded"
type: "object"
properties:
"spell": "object"
required: ["spell"]
additionalProperties: false
'tome:spell-step-forward': c.object {title: 'Step Forward', description: 'Published when you step forward in time'}
"tome:spell-changed":
title: "Spell Changed"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when a spell is changed"
type: "object"
properties:
"spell": "object"
required: ["spell"]
additionalProperties: false
'tome:spell-step-backward': c.object {title: 'Step Backward', description: 'Published when you step backward in time'}
"tome:editing-began":
title: "Editing Began"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you have begun changing code"
type: "undefined"
additionalProperties: false
'tome:spell-loaded': c.object {title: 'Spell Loaded', description: 'Published when a spell is loaded', required: ['spell']},
spell: {type: 'object'}
"tome:editing-ended":
title: "Editing Ended"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you have stopped changing code"
type: "undefined"
additionalProperties: false
'tome:spell-changed': c.object {title: 'Spell Changed', description: 'Published when a spell is changed', required: ['spell']},
spell: {type: 'object'}
"tome:problems-updated":
title: "Problems Updated"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when problems have been updated"
type: "object"
properties:
"spell": "object"
"problems": "array"
"isCast": "boolean"
required: ["spell", "problems", "isCast"]
additionalProperties: false
'tome:editing-began': c.object {title: 'Editing Began', description: 'Published when you have begun changing code'}
"tome:thang-list-entry-popover-shown":
title: "Thang List Entry Popover Shown"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when we show the popover for a thang in the master list"
type: "object"
properties:
"entry": "object"
required: ["entry"]
additionalProperties: false
'tome:editing-ended': c.object {title: 'Editing Ended', description: 'Published when you have stopped changing code'}
"tome:spell-shown":
title: "Spell Shown"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when we show a spell"
type: "object"
properties:
"thang": "object"
"spell": "object"
required: ["thang", "spell"]
additionalProperties: false
'tome:problems-updated': c.object {title: 'Problems Updated', description: 'Published when problems have been updated', required: ['spell', 'problems', 'isCast']},
spell: {type: 'object'}
problems: {type: 'array'}
isCast: {type: 'boolean'}
'tome:change-language':
title: 'Tome Change Language'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when the Tome should update its programming language.'
type: 'object'
additionalProperties: false
properties:
language:
type: 'string'
required: ['language']
'tome:thang-list-entry-popover-shown': c.object {title: 'Thang List Entry Popover Shown', description: 'Published when we show the popover for a thang in the master list', required: ['entry']},
entry: {type: 'object'}
'tome:spell-changed-language':
title: 'Spell Changed Language'
$schema: 'http://json-schema.org/draft-04/schema#'
description: 'Published when an individual spell has updated its code language.'
type: 'object'
additionalProperties: false
properties:
spell:
type: 'object'
language:
type: 'string'
required: ['spell']
'tome:spell-shown': c.object {title: 'Spell Shown', description: 'Published when we show a spell', required: ['thang', 'spell']},
thang: {type: 'object'}
spell: {type: 'object'}
"tome:comment-my-code":
title: "Comment My Code"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when we comment out a chunk of your code"
type: "undefined"
additionalProperties: false
'tome:change-language': c.object {title: 'Tome Change Language', description: 'Published when the Tome should update its programming language', required: ['language']},
language: {type: 'string'}
"tome:change-config":
title: "Change Config"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when you change your tome settings"
type: "undefined"
additionalProperties: false
'tome:spell-changed-language': c.object {title: 'Spell Changed Language', description: 'Published when an individual spell has updated its code language', required: ['spell']},
spell: {type: 'object'}
language: {type: 'string'}
"tome:update-snippets":
title: "Update Snippets"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published when we need to add Zatanna Snippets"
type: "object"
properties:
"propGroups": "object"
"allDocs": "object"
"language": "string"
required: ["propGroups", "allDocs"]
additionalProperties: false
'tome:comment-my-code': c.object {title: 'Comment My Code', description: 'Published when we comment out a chunk of your code'}
# TODO proposition: add tome to name
"focus-editor":
title: "Focus Editor"
$schema: "http://json-schema.org/draft-04/schema#"
description: "Published whenever we want to give focus back to the editor"
type: "undefined"
additionalProperties: false
'tome:change-config': c.object {title: 'Change Config', description: 'Published when you change your tome settings'}
'tome:update-snippets': c.object {title: 'Update Snippets', description: 'Published when we need to add Zatanna snippets', required: ['propGroups', 'allDocs']},
propGroups: {type: 'object'}
allDocs: {type: 'object'}
language: {type: 'string'}
'tome:insert-snippet': c.object {title: 'Insert Snippet', description: 'Published when we need to insert a Zatanna snippet', required: ['doc', 'language', 'formatted']},
doc: {type: 'object'}
language: {type: 'string'}
formatted: {type: 'object'}
'tome:focus-editor': c.object {title: 'Focus Editor', description: 'Published whenever we want to give focus back to the editor'}
'tome:fullscreen-view': c.object {title: 'Fullscreen View', description: 'Published when we want to make the Tome take up most of the screen'}

View file

@ -1,9 +0,0 @@
module.exports =
'me:synced':
{} # TODO schema
'user-fetched':
{} # TODO schema
'edit-wizard-settings':
{} # TODO schema

View file

@ -1,18 +0,0 @@
module.exports =
'god:user-code-problem':
{} # TODO schema
'god:infinite-loop':
{} # TODO schema
'god:user-code-problem':
{} # TODO schema
'god:new-world-created':
{} # TODO schema
'god:streaming-world-updated':
{} # TODO schema
'god:world-load-progress-changed':
{} # TODO schema

View file

@ -225,6 +225,14 @@ table.table
.ui-slider-handle
border: 1px solid black !important
// Override jQuery UI widget images that we don't use
.ui-widget-content, .ui-widget-header, .ui-widget-overlay, .ui-widget-shadow
background-image: none
.ui-widget-content, .ui-state-default, .ui-widget-header
.ui-state-default, .ui-state-focus, .ui-state-active, .ui-state-highlight, .ui-state-error
background-image: none
// Fonts
.header-font

View file

@ -6,8 +6,8 @@ $mobile: 1050px
$addPaletteIconColumns: 3
$extantThangsWidth: 300px
$addPaletteIconWidth: 40px
$addPaletteIconPadding: 2px
$addPaletteIconMargin: 2px
$addPaletteIconPadding: 0px
$addPaletteIconMargin: 4px
$addPaletteWidth: ($addPaletteIconWidth + 2 * $addPaletteIconPadding + 2 * $addPaletteIconMargin) * $addPaletteIconColumns + 20
#toggle
@ -198,15 +198,26 @@ $mobile: 1050px
padding: $addPaletteIconPadding
margin: $addPaletteIconMargin
cursor: pointer
width: $addPaletteIconWidth
height: $addPaletteIconWidth
img
position: absolute
width: $addPaletteIconWidth
height: $addPaletteIconWidth
transition: box-shadow 0.25s ease-out
&:hover
$hoverScaleIncreaseFactor: 0.2
outline: 1px dotted blue
img
left: -($hoverScaleIncreaseFactor / 2) * $addPaletteIconWidth
top: -($hoverScaleIncreaseFactor / 2) * $addPaletteIconWidth
width: (1 + $hoverScaleIncreaseFactor) * $addPaletteIconWidth
height: (1 + $hoverScaleIncreaseFactor) * $addPaletteIconWidth
&.selected
border: 1px solid blue
margin: $addPaletteIconPadding - 1px
outline: 1px solid blue
@include box-shadow(0px 5px 25px rgba(79, 79, 213, 0.6))
background: #add8e6

View file

@ -17,29 +17,25 @@
overflow: hidden
background: white
border: 1px solid #333
border-radius: 5px
position: relative
-webkit-transition: opacity 0.3s ease-in-out
-moz-transition: opacity 0.3s ease-in-out
-ms-transition: opacity 0.3s ease-in-out
-o-transition: opacity 0.3s ease-in-out
transition: opacity 0.3s ease-in-out
opacity: 0.4
border-radius: 5px
.only-one
-webkit-transition: opacity 0.3s ease-in-out
-moz-transition: opacity 0.3s ease-in-out
-ms-transition: opacity 0.3s ease-in-out
-o-transition: opacity 0.3s ease-in-out
transition: opacity 0.3s ease-in-out
opacity: 0
.play-option:hover
opacity: 1
.only-one
#normal-view:hover
.play-option
opacity: 0.4
.play-option:hover
opacity: 1
.only-one
opacity: 1
.my-icon
position: relative

View file

@ -32,7 +32,7 @@ block content
a(href="/editor/article")
img(src="/images/pages/community/article.png")
h2
a.spl(href="/editor/level", data-i18n="editor.article_title")
a.spl(href="/editor/article", data-i18n="editor.article_title")
p
span(data-i18n="community.article_editor_prefix") See a mistake in some of our docs? Want to make some instructions for your own creations? Check out the
a.spl.spr(href="/editor/article", data-i18n="editor.article_title")

View file

@ -5,6 +5,6 @@ div.editor-nano-container.nano
for group in groups
h4= group.name
for thangType in group.thangs
div.add-thang-palette-icon(data-thang-type=thangType.get('name'))
img(title="Add " + thangType.get('name'), src=thangType.getPortraitURL(), alt="")
div.add-thang-palette-icon(data-thang-type=thangType.get('name'), title=thangType.get('name'))
img(src=thangType.getPortraitURL(), alt="")
div.clearfix

View file

@ -5,6 +5,12 @@ block modal-header-content
block modal-body-content
h4.language-selection(data-i18n="ladder.select_your_language") Select your language!
.form-group.select-group
select#tome-language(name="language")
for option in languages
option(value=option.id selected=(language === option.id))= option.name
div#noob-view.secret
a(href="/play/level/#{levelID}-tutorial").btn.btn-success.btn-block.btn-lg
p
@ -18,11 +24,6 @@ block modal-body-content
strong(data-i18n="ladder.tutorial_not_sure") Not sure what's going on?
|
a(href="/play/level/#{levelID}-tutorial", data-i18n="ladder.tutorial_play_first") Play the tutorial first.
h4.language-selection(data-i18n="ladder.select_your_language") Select your language!
.form-group.select-group
select#tome-language(name="language")
for option in languages
option(value=option.id selected=(language === option.id))= option.name
a(href="/play/level/#{levelID}?team=#{teamID}")
div.play-option
img(src=myPortrait).my-icon.only-one

View file

@ -37,10 +37,6 @@ button.btn.btn-xs.btn-inverse#music-button(title="Toggle Music")
li.selectable#view-keyboard-shortcuts
i.icon-info-sign
span(data-i18n="play_level.keyboard_shortcuts") Key Shortcuts
li(title="Ctrl/Cmd + G: Toggle grid display").selectable#grid-toggle
i.icon-th
span(data-i18n="play_level.grid") Grid
i.icon-ok.secret.invisible
li.selectable#edit-wizard-settings
i.icon-user
span(data-i18n="play_level.customize_wizard") Customize Wizard

View file

@ -1,7 +1,6 @@
RootView = require 'views/kinds/RootView'
template = require 'templates/employers'
User = require 'models/User'
UserRemark = require 'models/UserRemark'
{me} = require 'lib/auth'
CocoCollection = require 'collections/CocoCollection'
EmployerSignupModal = require 'views/modal/EmployerSignupModal'
@ -10,10 +9,6 @@ class CandidatesCollection extends CocoCollection
url: '/db/user/x/candidates'
model: User
class UserRemarksCollection extends CocoCollection
url: '/db/user.remark?project=contact,contactName,user'
model: UserRemark
module.exports = class EmployersView extends RootView
id: 'employers-view'
template: template
@ -32,9 +27,12 @@ module.exports = class EmployersView extends RootView
constructor: (options) ->
super options
@getCandidates()
@candidates = @supermodel.loadCollection(new CandidatesCollection(), 'candidates').model
@setFilterDefaults()
onLoaded: ->
super()
@setUpScrolling()
afterRender: ->
super()
@ -53,6 +51,7 @@ module.exports = class EmployersView extends RootView
swapFolderIcon: ->
$('#folder-icon').toggleClass('glyphicon-folder-close').toggleClass('glyphicon-folder-open')
onFilterChanged: ->
@resetFilters()
that = @
@ -75,6 +74,7 @@ module.exports = class EmployersView extends RootView
openSignupModal: ->
@openModalView new EmployerSignupModal
handleSelectAllChange: (e) ->
checkedState = e.currentTarget.checked
$('#filters :input').each ->
@ -110,6 +110,7 @@ module.exports = class EmployersView extends RootView
return filteredCandidates
setFilterDefaults: ->
@filters =
phoneScreenFilter: [true, false]
@ -129,6 +130,7 @@ module.exports = class EmployersView extends RootView
return (_.filter candidates, (c) -> c.get('jobProfile').curated?[filterName] is filterValue).length
else
return Math.floor(Math.random() * 500)
createFilterAlert: ->
currentFilterSet = _.cloneDeep @filters
currentSavedFilters = _.cloneDeep me.get('savedEmployerFilterAlerts') ? []
@ -158,7 +160,6 @@ module.exports = class EmployersView extends RootView
for filter, index in savedFilters
$("#saved-filter-table tbody").append("""<tr data-filter-index="#{index}"><td>#{@generateFilterAlertDescription(filter)}</td><td class="deletion-col"><a>✗</a></td></tr> """)
generateFilterAlertDescription: (filter) =>
descriptionString = ""
for key in _.keys(filter).sort()
@ -191,8 +192,6 @@ module.exports = class EmployersView extends RootView
ctx.featuredCandidates = ctx.candidates
ctx.candidatesInFilter = @candidatesInFilter
ctx.otherCandidates = _.reject ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
ctx.remarks = {}
ctx.remarks[remark.get('user')] = remark for remark in @remarks.models
ctx.moment = moment
ctx._ = _
ctx.numberOfCandidates = ctx.featuredCandidates.length
@ -202,17 +201,7 @@ module.exports = class EmployersView extends RootView
userPermissions = me.get('permissions') ? []
_.contains userPermissions, 'employer'
getCandidates: ->
@candidates = new CandidatesCollection()
@candidates.fetch()
@remarks = new UserRemarksCollection()
@remarks.fetch()
# Re-render when we have fetched them, but don't wait and show a progress bar while loading.
@listenToOnce @candidates, 'all', @renderCandidatesAndSetupScrolling
@listenToOnce @remarks, 'all', @renderCandidatesAndSetupScrolling
renderCandidatesAndSetupScrolling: =>
@render()
setUpScrolling: =>
$('.nano').nanoScroller()
#if window.history?.state?.lastViewedCandidateID
# $('.nano').nanoScroller({scrollTo: $('#' + window.history.state.lastViewedCandidateID)})
@ -340,9 +329,11 @@ module.exports = class EmployersView extends RootView
8:
'': filterSelectExactMatch
'': filterSelectExactMatch
logoutAccount: ->
window.location.hash = ''
super()
onCandidateClicked: (e) ->
id = $(e.target).closest('tr').data('candidate-id')
if id and (@isEmployer() or me.isAdmin())

View file

@ -8,7 +8,6 @@ SpriteBuilder = require 'lib/sprites/SpriteBuilder'
module.exports = class WizardSettingsView extends CocoView
id: 'wizard-settings-view'
template: template
startsLoading: true
events:
'click .color-group': (e) ->
@ -27,13 +26,11 @@ module.exports = class WizardSettingsView extends CocoView
loadWizard: ->
@wizardThangType = new ThangType()
@wizardThangType.url = -> '/db/thang.type/wizard'
@wizardThangType.fetch()
@listenToOnce(@wizardThangType, 'sync', @initCanvas)
@wizardThangType.setURL '/db/thang.type/wizard'
@supermodel.loadModel @wizardThangType, 'wizard'
initCanvas: ->
@startsLoading = false
@render()
onLoaded: ->
super()
@spriteBuilder = new SpriteBuilder(@wizardThangType)
@initStage()
@ -56,7 +53,7 @@ module.exports = class WizardSettingsView extends CocoView
c
afterRender: ->
return if @startsLoading
return unless @supermodel.finished()
wizardSettings = me.get('wizard') or {}
wizardSettings.colorConfig ?= {}

View file

@ -1,30 +1,29 @@
RootView = require 'views/kinds/RootView'
template = require 'templates/admin/clas'
CocoCollection = require 'collections/CocoCollection'
CocoModel = require 'models/CocoModel'
class CLASubmission extends CocoModel
@className: 'CLA'
@schema: require 'schemas/models/cla_submission'
urlRoot: '/db/cla.submission'
class CLACollection extends CocoCollection
url: '/db/cla.submissions'
model: CLASubmission
module.exports = class CLAsView extends RootView
id: 'admin-clas-view'
template: template
startsLoading: true
constructor: (options) ->
super options
@getCLAs()
getCLAs: ->
CLACollection = Backbone.Collection.extend({
url: '/db/cla.submissions'
})
@clas = new CLACollection()
@clas.fetch()
@listenTo(@clas, 'sync', @onCLAsLoaded)
onCLAsLoaded: ->
@startsLoading = false
@render()
@clas = @supermodel.loadCollection(new CLACollection(), 'clas').model
getRenderData: ->
c = super()
c.clas = []
unless @startsLoading
c.clas = _.uniq (_.sortBy (cla.attributes for cla in @clas.models), (m) -> m.githubUsername?.toLowerCase()), 'githubUsername'
if @supermodel.finished()
c.clas = _.uniq (_.sortBy (cla.attributes for cla in @clas.models), (m) ->
m.githubUsername?.toLowerCase()), 'githubUsername'
c

View file

@ -23,7 +23,12 @@ module.exports = class CandidatesView extends RootView
constructor: (options) ->
super options
@getCandidates()
@candidates = @supermodel.loadCollection(new CandidatesCollection(), 'candidates').model
@remarks = @supermodel.loadCollection(new UserRemarksCollection(), 'user_remarks').model
onLoaded: ->
super()
@setUpScrolling()
afterRender: ->
super()
@ -51,17 +56,7 @@ module.exports = class CandidatesView extends RootView
userPermissions = me.get('permissions') ? []
_.contains userPermissions, "employer"
getCandidates: ->
@candidates = new CandidatesCollection()
@candidates.fetch()
@remarks = new UserRemarksCollection()
@remarks.fetch()
# Re-render when we have fetched them, but don't wait and show a progress bar while loading.
@listenToOnce @candidates, 'all', @renderCandidatesAndSetupScrolling
@listenToOnce @remarks, 'all', @renderCandidatesAndSetupScrolling
renderCandidatesAndSetupScrolling: =>
@render()
setUpScrolling: ->
$(".nano").nanoScroller()
if window.history?.state?.lastViewedCandidateID
$(".nano").nanoScroller({scrollTo:$("#" + window.history.state.lastViewedCandidateID)})

View file

@ -18,7 +18,7 @@ module.exports = class EmployersListView extends RootView
constructor: (options) ->
super options
@getEmployers()
@employers = @supermodel.loadCollection(new EmployersCollection(), 'employers').model
afterRender: ->
super()
@ -30,12 +30,6 @@ module.exports = class EmployersListView extends RootView
ctx.moment = moment
ctx
getEmployers: ->
@employers = new EmployersCollection()
@employers.fetch()
# Re-render when we have fetched them, but don't wait and show a progress bar while loading.
@listenToOnce @employers, 'all', => @render()
sortTable: ->
# http://mottie.github.io/tablesorter/docs/example-widget-bootstrap-theme.html
$.extend $.tablesorter.themes.bootstrap,

View file

@ -1,10 +1,10 @@
RootView = require 'views/kinds/RootView'
template = require 'templates/admin/level_sessions'
LevelSession = require 'models/LevelSession'
CocoCollection = require 'collections/CocoCollection'
# Placeholder
class LevelSessionCollection extends Backbone.Collection
url: '/db/level_session/x/active'
class LevelSessionCollection extends CocoCollection
url: '/db/level_session/x/active?project=screenshot,levelName,creatorName'
model: LevelSession
module.exports = class LevelSessionsView extends RootView
@ -16,9 +16,7 @@ module.exports = class LevelSessionsView extends RootView
@getLevelSessions()
getLevelSessions: ->
@sessions = new LevelSessionCollection()
@sessions.fetch()
@listenToOnce @sessions, 'all', @render
@sessions = @supermodel.loadCollection(new LevelSessionCollection(), 'sessions').model
getRenderData: =>
c = super()

View file

@ -9,7 +9,6 @@ app = require 'application'
module.exports = class AchievementEditView extends RootView
id: 'editor-achievement-edit-view'
template: template
startsLoading: true
events:
'click #save-button': 'saveAchievement'
@ -23,21 +22,15 @@ module.exports = class AchievementEditView extends RootView
super options
@achievement = new Achievement(_id: @achievementID)
@achievement.saveBackups = true
@achievement.once 'error', (achievement, jqxhr) =>
@hideLoading()
$(@$el).find('.main-content-area').children('*').not('.breadcrumb').remove()
errors.backboneFailure arguments...
@achievement.fetch()
@listenToOnce(@achievement, 'sync', @buildTreema)
@supermodel.loadModel @achievement, 'achievement'
@pushChangesToPreview = _.throttle(@pushChangesToPreview, 500)
onLoaded: ->
super()
@buildTreema()
buildTreema: ->
return if @treema? or (not @achievement.loaded)
@startsLoading = false
@render()
data = $.extend(true, {}, @achievement.attributes)
options =
data: data
@ -47,7 +40,6 @@ module.exports = class AchievementEditView extends RootView
callbacks:
change: @pushChangesToPreview
@treema = @$el.find('#achievement-treema').treema(options)
@treema.build()
getRenderData: (context={}) ->
@ -57,21 +49,16 @@ module.exports = class AchievementEditView extends RootView
context
afterRender: ->
super(arguments...)
super()
return unless @supermodel.finished()
@pushChangesToPreview()
pushChangesToPreview: =>
$('#achievement-view').empty()
if @treema?
for key, value of @treema.data
@achievement.set key, value
earned =
earnedPoints: @achievement.get 'worth'
popup = new AchievementPopup achievement: @achievement, earnedAchievement:earned, popup: false, container: $('#achievement-view')
@$el.find('#achievement-view').empty()
for key, value of @treema.data
@achievement.set key, value
earned = earnedPoints: @achievement.get 'worth'
popup = new AchievementPopup achievement: @achievement, earnedAchievement: earned, popup: false, container: $('#achievement-view')
openSaveModal: ->
'Maybe later' # TODO patch patch patch

View file

@ -8,7 +8,6 @@ PatchesView = require 'views/editor/PatchesView'
module.exports = class ArticleEditView extends RootView
id: 'editor-article-edit-view'
template: template
startsLoading: true
events:
'click #preview-button': 'openPreview'
@ -16,34 +15,23 @@ module.exports = class ArticleEditView extends RootView
'click #save-button': 'openSaveModal'
subscriptions:
'save-new-version': 'saveNewArticle'
'editor:save-new-version': 'saveNewArticle'
constructor: (options, @articleID) ->
super options
@article = new Article(_id: @articleID)
@article.saveBackups = true
@listenToOnce(@article, 'error',
() =>
@hideLoading()
# Hack: editor components appear after calling insertSubView.
# So we need to hide them first.
$(@$el).find('.main-content-area').children('*').not('#error-view').remove()
@insertSubView(new ErrorView())
)
@article.fetch()
@listenToOnce(@article, 'sync', @buildTreema)
@supermodel.loadModel @article, 'article'
@pushChangesToPreview = _.throttle(@pushChangesToPreview, 500)
onLoaded: ->
super()
@buildTreema()
buildTreema: ->
return if @treema? or (not @article.loaded)
unless @article.attributes.body
@article.set('body', '')
@startsLoading = false
@render()
data = $.extend(true, {}, @article.attributes)
options =
data: data
@ -53,7 +41,6 @@ module.exports = class ArticleEditView extends RootView
callbacks:
change: @pushChangesToPreview
@treema = @$el.find('#article-treema').treema(options)
@treema.build()
pushChangesToPreview: =>
@ -73,7 +60,7 @@ module.exports = class ArticleEditView extends RootView
afterRender: ->
super()
return if @startsLoading
return unless @supermodel.finished()
@showReadOnly() if me.get('anonymous')
@patchesView = @insertSubView(new PatchesView(@article), @$el.find('.patches-view'))
@patchesView.load()
@ -111,4 +98,4 @@ module.exports = class ArticleEditView extends RootView
showVersionHistory: (e) ->
versionHistoryView = new VersionHistoryView article: @article, @articleID
@openModalView versionHistoryView
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}

View file

@ -72,7 +72,7 @@ module.exports = class LevelEditView extends RootView
super()
return unless @supermodel.finished()
@$el.find('a[data-toggle="tab"]').on 'shown.bs.tab', (e) =>
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
@insertSubView new ThangsTabView world: @world, supermodel: @supermodel, level: @level
@insertSubView new SettingsTabView supermodel: @supermodel
@insertSubView new ScriptsTabView world: @world, supermodel: @supermodel, files: @files
@ -81,7 +81,7 @@ module.exports = class LevelEditView extends RootView
@insertSubView new RelatedAchievementsView supermodel: @supermodel, level: @level
@insertSubView new ComponentDocsView # Don't give it the supermodel, it'll pollute it!
Backbone.Mediator.publish 'level-loaded', level: @level
Backbone.Mediator.publish 'editor:level-loaded', level: @level
@showReadOnly() if me.get('anonymous')
@patchesView = @insertSubView(new PatchesView(@level), @$el.find('.patches-view'))
@listenTo @patchesView, 'accepted-patch', -> location.reload()
@ -96,7 +96,7 @@ module.exports = class LevelEditView extends RootView
onPlayLevel: (e) ->
team = $(e.target).data('team')
sendLevel = =>
@childWindow.Backbone.Mediator.publish 'level-reload-from-data', level: @level, supermodel: @supermodel
@childWindow.Backbone.Mediator.publish 'level:reload-from-data', level: @level, supermodel: @supermodel
if @childWindow and not @childWindow.closed
# Reset the LevelView's world, but leave the rest of the state alone
sendLevel()
@ -134,20 +134,20 @@ module.exports = class LevelEditView extends RootView
startPatchingLevel: (e) ->
@openModalView new SaveVersionModal({model: @level})
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
startCommittingLevel: (e) ->
@openModalView new SaveLevelModal level: @level, supermodel: @supermodel
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
startForking: (e) ->
@openModalView new ForkModal model: @level, editorPath: 'level'
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
showVersionHistory: (e) ->
versionHistoryView = new VersionHistoryView level: @level, @levelID
@openModalView versionHistoryView
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
toggleWatchLevel: ->
button = @$el.find('#level-watch-button')

View file

@ -14,9 +14,7 @@ module.exports = class ComponentsTabView extends CocoView
className: 'tab-pane'
subscriptions:
'edit-level-component': 'editLevelComponent'
'level-component-edited': 'onLevelComponentEdited'
'level-component-editing-ended': 'onLevelComponentEditingEnded'
'editor:level-component-editing-ended': 'onLevelComponentEditingEnded'
events:
'click #create-new-component-button': 'createNewLevelComponent'
@ -66,14 +64,11 @@ module.exports = class ComponentsTabView extends CocoView
createNewLevelComponent: (e) ->
levelComponentNewView = new LevelComponentNewView supermodel: @supermodel
@openModalView levelComponentNewView
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
editLevelComponent: (e) ->
@levelComponentEditView = @insertSubView new LevelComponentEditView(original: e.original, majorVersion: e.majorVersion, supermodel: @supermodel)
onLevelComponentEdited: (e) ->
Backbone.Mediator.publish 'level-components-changed', {}
onLevelComponentEditingEnded: (e) ->
@removeSubView @levelComponentEditView
@levelComponentEditView = null
@ -90,6 +85,3 @@ class LevelComponentNode extends TreemaObjectNode
m.get('original') is @data.original and m.get('version').major is @data.majorVersion
name = "#{comp.get('system')}.#{comp.get('name')} v#{comp.get('version').major}"
@buildValueForDisplaySimply valEl, "#{name} (#{count})"
onEnterPressed: ->
Backbone.Mediator.publish 'edit-level-component', original: @data.original, majorVersion: @data.majorVersion

View file

@ -64,7 +64,6 @@ module.exports = class LevelComponentEditView extends CocoView
# Make sure it validates first?
for key, value of @componentSettingsTreema.data
@levelComponent.set key, value unless key is 'js' # will compile code if needed
Backbone.Mediator.publish 'level-component-edited', levelComponent: @levelComponent
null
buildConfigSchemaTreema: ->
@ -82,7 +81,6 @@ module.exports = class LevelComponentEditView extends CocoView
onConfigSchemaEdited: =>
@levelComponent.set 'configSchema', @configSchemaTreema.data
Backbone.Mediator.publish 'level-component-edited', levelComponent: @levelComponent
buildCodeEditor: ->
@editor?.destroy()
@ -100,21 +98,20 @@ module.exports = class LevelComponentEditView extends CocoView
onEditorChange: =>
return if @destroyed
@levelComponent.set 'code', @editor.getValue()
Backbone.Mediator.publish 'level-component-edited', levelComponent: @levelComponent
null
endEditing: (e) ->
Backbone.Mediator.publish 'level-component-editing-ended', levelComponent: @levelComponent
Backbone.Mediator.publish 'editor:level-component-editing-ended', component: @levelComponent
null
showVersionHistory: (e) ->
componentVersionsModal = new ComponentVersionsModal {}, @levelComponent.id
@openModalView componentVersionsModal
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
startPatchingComponent: (e) ->
@openModalView new SaveVersionModal({model: @levelComponent})
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
toggleWatchComponent: ->
button = @$el.find('#component-watch-button')

View file

@ -38,5 +38,4 @@ module.exports = class NewLevelComponentModal extends ModalView
forms.applyErrorsToForm(@$el, JSON.parse(res.responseText))
res.success =>
@supermodel.registerModel component
Backbone.Mediator.publish 'edit-level-component', original: component.get('_id'), majorVersion: 0
@hide()

View file

@ -215,9 +215,7 @@ module.exports = class TerrainRandomizeModal extends ModalView
presetType = target.attr 'data-preset-type'
presetSize = target.attr 'data-preset-size'
@randomizeThangs presetType, presetSize
Backbone.Mediator.publish('randomize:terrain-generated',
'thangs': @thangs
)
Backbone.Mediator.publish 'editor:random-terrain-generated', thangs: @thangs
@hide()
randomizeThangs: (presetName, presetSize) ->

View file

@ -10,8 +10,8 @@ module.exports = class WorldSelectModal extends ModalView
cache: false
subscriptions:
'choose-region': 'selectionMade'
'choose-point': 'selectionMade'
'surface:choose-region': 'selectionMade'
'surface:choose-point': 'selectionMade'
events:
'click #done-button': 'done'

View file

@ -11,7 +11,7 @@ module.exports = class ScriptsTabView extends CocoView
className: 'tab-pane'
subscriptions:
'level-loaded': 'onLevelLoaded'
'editor:level-loaded': 'onLevelLoaded'
constructor: (options) ->
super options

View file

@ -17,7 +17,7 @@ module.exports = class SettingsTabView extends CocoView
]
subscriptions:
'level-loaded': 'onLevelLoaded'
'editor:level-loaded': 'onLevelLoaded'
constructor: (options) ->
super options

View file

@ -19,23 +19,14 @@ module.exports = class AddLevelSystemModal extends ModalView
constructor: (options) ->
super options
@extantSystems = options.extantSystems ? []
render: ->
if not @systems
@systems = @supermodel.getCollection new LevelSystemSearchCollection()
unless @systems.loaded
@listenToOnce(@systems, 'sync', @onSystemsSync)
@systems.fetch()
super() # do afterRender at the end
@systems = @supermodel.loadCollection(new LevelSystemSearchCollection(), 'systems').model
afterRender: ->
super()
return @showLoading() unless @systems?.loaded
@hideLoading()
return unless @supermodel.finished()
@renderAvailableSystems()
renderAvailableSystems: ->
return unless @systems
ul = @$el.find('ul.available-systems-list').empty()
systems = (m.attributes for m in @systems.models)
_.remove systems, (system) =>
@ -44,10 +35,6 @@ module.exports = class AddLevelSystemModal extends ModalView
for system in systems
ul.append $(availableSystemTemplate(system: system))
onSystemsSync: ->
@supermodel.addCollection @systems
@render()
onAddSystem: (e) ->
id = $(e.currentTarget).data('system-id')
system = _.find @systems.models, id: id

View file

@ -58,7 +58,6 @@ module.exports = class LevelSystemEditView extends CocoView
# Make sure it validates first?
for key, value of @systemSettingsTreema.data
@levelSystem.set key, value unless key is 'js' # will compile code if needed
Backbone.Mediator.publish 'level-system-edited', levelSystem: @levelSystem
null
buildConfigSchemaTreema: ->
@ -76,7 +75,6 @@ module.exports = class LevelSystemEditView extends CocoView
onConfigSchemaEdited: =>
@levelSystem.set 'configSchema', @configSchemaTreema.data
Backbone.Mediator.publish 'level-system-edited', levelSystem: @levelSystem
buildCodeEditor: ->
@editor?.destroy()
@ -93,21 +91,20 @@ module.exports = class LevelSystemEditView extends CocoView
onEditorChange: =>
@levelSystem.set 'code', @editor.getValue()
Backbone.Mediator.publish 'level-system-edited', levelSystem: @levelSystem
null
endEditing: (e) ->
Backbone.Mediator.publish 'level-system-editing-ended', levelSystem: @levelSystem
Backbone.Mediator.publish 'editor:level-system-editing-ended', system: @levelSystem
null
showVersionHistory: (e) ->
systemVersionsModal = new SystemVersionsModal {}, @levelSystem.id
@openModalView systemVersionsModal
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
startPatchingSystem: (e) ->
@openModalView new SaveVersionModal({model: @levelSystem})
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
toggleWatchSystem: ->
console.log 'toggle watch system?'

View file

@ -32,5 +32,5 @@ module.exports = class NewLevelSystemModal extends ModalView
forms.applyErrorsToForm(@$el, JSON.parse(res.responseText))
res.success =>
@supermodel.registerModel system
Backbone.Mediator.publish 'edit-level-system', original: system.get('_id'), majorVersion: 0
Backbone.Mediator.publish 'editor:edit-level-system', original: system.get('_id'), majorVersion: 0
@hide()

View file

@ -13,11 +13,10 @@ module.exports = class SystemsTabView extends CocoView
className: 'tab-pane'
subscriptions:
'level-system-added': 'onLevelSystemAdded'
'edit-level-system': 'editLevelSystem'
'level-system-edited': 'onLevelSystemEdited'
'level-system-editing-ended': 'onLevelSystemEditingEnded'
'level-loaded': 'onLevelLoaded'
'editor:level-system-added': 'onLevelSystemAdded'
'editor:edit-level-system': 'editLevelSystem'
'editor:level-system-editing-ended': 'onLevelSystemEditingEnded'
'editor:level-loaded': 'onLevelLoaded'
events:
'click #add-system-button': 'addLevelSystem'
@ -91,18 +90,15 @@ module.exports = class SystemsTabView extends CocoView
addLevelSystem: (e) ->
@openModalView new AddLevelSystemModal supermodel: @supermodel, extantSystems: _.cloneDeep @systemsTreema.data
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
createNewLevelSystem: (e) ->
@openModalView new NewLevelSystemModal supermodel: @supermodel
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
editLevelSystem: (e) ->
@levelSystemEditView = @insertSubView new LevelSystemEditView(original: e.original, majorVersion: e.majorVersion, supermodel: @supermodel)
onLevelSystemEdited: (e) ->
Backbone.Mediator.publish 'level-systems-changed', systemsData: @systemsTreema.data
onLevelSystemEditingEnded: (e) ->
@removeSubView @levelSystemEditView
@levelSystemEditView = null
@ -150,7 +146,7 @@ class LevelSystemNode extends TreemaObjectNode
onEnterPressed: (e) ->
super e
Backbone.Mediator.publish 'edit-level-system', original: @data.original, majorVersion: @data.majorVersion
Backbone.Mediator.publish 'editor:edit-level-system', original: @data.original, majorVersion: @data.majorVersion
open: (depth) ->
super depth

View file

@ -14,7 +14,6 @@ module.exports = class AddThangsView extends CocoView
id: 'add-thangs-column'
className: 'add-thangs-palette thangs-column'
template: add_thangs_template
startsLoading: false
events:
'keyup input#thang-search': 'runSearch'
@ -56,6 +55,10 @@ module.exports = class AddThangsView extends CocoView
afterRender: ->
super()
@buildAddThangPopovers()
buildAddThangPopovers: ->
@$el.find('#thangs-list .add-thang-palette-icon').tooltip(container: 'body', animation: false)
runSearch: (e) =>
if e?.which is 27

View file

@ -56,13 +56,10 @@ module.exports = class LevelThangEditView extends CocoView
saveThang: (e) ->
# Make sure it validates first?
event =
thangData: @thangData
id: @oldID
Backbone.Mediator.publish 'level-thang-edited', event
Backbone.Mediator.publish 'editor:level-thang-edited', thangData: @thangData, thangID: @oldID
navigateToAllThangs: ->
Backbone.Mediator.publish 'level-thang-done-editing'
Backbone.Mediator.publish 'editor:level-thang-done-editing', {}
toggleNameEdit: ->
link = @$el.find '#thang-name-link'

View file

@ -28,22 +28,21 @@ module.exports = class ThangsTabView extends CocoView
id: 'editor-level-thangs-tab-view'
className: 'tab-pane active'
template: thangs_template
startsLoading: true
subscriptions:
'surface:sprite-selected': 'onExtantThangSelected'
'surface:mouse-moved': 'onSurfaceMouseMoved'
'surface:mouse-over': 'onSurfaceMouseOver'
'surface:mouse-out': 'onSurfaceMouseOut'
'edit-level-thang': 'editThang'
'level-thang-edited': 'onLevelThangEdited'
'level-thang-done-editing': 'onLevelThangDoneEditing'
'level:view-switched': 'onViewSwitched'
'editor:edit-level-thang': 'editThang'
'editor:level-thang-edited': 'onLevelThangEdited'
'editor:level-thang-done-editing': 'onLevelThangDoneEditing'
'editor:view-switched': 'onViewSwitched'
'sprite:dragged': 'onSpriteDragged'
'sprite:mouse-up': 'onSpriteMouseUp'
'sprite:double-clicked': 'onSpriteDoubleClicked'
'surface:stage-mouse-up': 'onStageMouseUp'
'randomize:terrain-generated': 'onRandomizeTerrain'
'editor:random-terrain-generated': 'onRandomTerrainGenerated'
events:
'click #extant-thangs-filter button': 'onFilterExtantThangs'
@ -233,7 +232,7 @@ module.exports = class ThangsTabView extends CocoView
return unless e.thang
@editThang thangID: e.thang.id
onRandomizeTerrain: (e) ->
onRandomTerrainGenerated: (e) ->
@thangsBatch = []
nonRandomThangs = (thang for thang in @thangsTreema.get('') when not /Random/.test thang.id)
@thangsTreema.set '', nonRandomThangs
@ -403,7 +402,6 @@ module.exports = class ThangsTabView extends CocoView
thang.isSelectable = not thang.isLand for thang in @world.thangs # let us select walls and such
@surface?.setWorld @world
@selectAddThangType @addThangType, @cloneSourceThang if @addThangType # make another addThang sprite, since the World just refreshed
Backbone.Mediator.publish 'level-thangs-changed', thangsData: @thangsTreema.data
null
onTreemaThangSelected: (e, selectedTreemas) =>
@ -450,13 +448,13 @@ module.exports = class ThangsTabView extends CocoView
@editThangView = new LevelThangEditView thangData: thangData, level: @level, world: @world, supermodel: @supermodel # supermodel needed for checkForMissingSystems
@insertSubView @editThangView
@$el.find('.thangs-column').hide()
Backbone.Mediator.publish 'level:view-switched', e
Backbone.Mediator.publish 'editor:view-switched', {}
onLevelThangEdited: (e) ->
newThang = e.thangData
@thangsTreema.set "id=#{e.id}", newThang
@thangsTreema.set "id=#{e.thangID}", newThang
onLevelThangDoneEditing: ->
onLevelThangDoneEditing: (e) ->
@removeSubView @editThangView
@editThangView = null
@onThangsChanged()
@ -531,4 +529,4 @@ class ThangNode extends TreemaObjectNode
@buildValueForDisplaySimply valEl, s
onEnterPressed: ->
Backbone.Mediator.publish 'edit-level-thang', thangID: @data.id
Backbone.Mediator.publish 'editor:edit-level-thang', thangID: @data.id

View file

@ -11,23 +11,22 @@ module.exports = class ThangTypeColorsTabView extends CocoView
offset: 0
constructor: (@thangType, options) ->
@listenToOnce(@thangType, 'sync', @tryToBuild)
# @listenToOnce(@thangType.schema(), 'sync', @tryToBuild)
super options
@supermodel.loadModel @thangType, 'thang'
@colorConfig = {hue: 0, saturation: 0.5, lightness: 0.5}
@spriteBuilder = new SpriteBuilder(@thangType)
f = =>
@offset++
@updateMovieClip()
@interval = setInterval f, 1000
super options
destroy: ->
clearInterval @interval
super()
onLoaded: -> @render()
afterRender: ->
super()
return unless @supermodel.finished()
@createShapeButtons()
@initStage()
@initSliders()

View file

@ -21,7 +21,6 @@ module.exports = class ThangTypeEditView extends RootView
id: 'thang-type-edit-view'
className: 'editor'
template: template
startsLoading: true
resolution: 4
scale: 3
mockThang:
@ -45,7 +44,7 @@ module.exports = class ThangTypeEditView extends RootView
'keyup .play-with-level-input': 'onPlayLevelKeyUp'
subscriptions:
'save-new-version': 'saveNewThangType'
'editor:save-new-version': 'saveNewThangType'
# init / render
@ -439,7 +438,7 @@ module.exports = class ThangTypeEditView extends RootView
level = _.string.slugify level
if @childWindow and not @childWindow.closed
# Reset the LevelView's world, but leave the rest of the state alone
@childWindow.Backbone.Mediator.publish 'level-reload-thang-type', thangType: @thangType
@childWindow.Backbone.Mediator.publish 'level:reload-thang-type', thangType: @thangType
else
# Create a new Window with a blank LevelView
scratchLevelID = level + '?dev=true'

View file

@ -9,7 +9,7 @@ module.exports = class ChooseHeroView extends CocoView
template: template
events:
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'restart-level'
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart-level', {}
getRenderData: (context={}) ->
context = super(context)

View file

@ -61,7 +61,7 @@ module.exports = class OptionsView extends CocoView
volume = @volumeSlider.slider('value')
me.set 'volume', volume
@$el.find('#option-volume-value').text (volume * 100).toFixed(0) + '%'
Backbone.Mediator.publish 'level-set-volume', volume: volume
Backbone.Mediator.publish 'level:set-volume', volume: volume
onHidden: ->
if @playerName and @playerName isnt me.get('name')
@ -72,7 +72,7 @@ module.exports = class OptionsView extends CocoView
@aceConfig.behaviors = @$el.find('#option-behaviors').prop('checked')
@aceConfig.liveCompletion = @$el.find('#option-live-completion').prop('checked')
me.set 'aceConfig', @aceConfig
Backbone.Mediator.publish 'tome:change-config'
Backbone.Mediator.publish 'tome:change-config', {}
updateMusic: ->
me.set 'music', @$el.find('#option-music').prop('checked')

View file

@ -179,7 +179,7 @@ module.exports = class CocoView extends Backbone.View
$('#modal-wrapper .modal').modal(modalOptions).on 'hidden.bs.modal', @modalClosed
window.currentModal = modalView
@getRootView().stopListeningToShortcuts(true)
Backbone.Mediator.publish 'modal-opened', {}
Backbone.Mediator.publish 'modal:opened', {}
modalClosed: =>
visibleModal.willDisappear() if visibleModal
@ -193,7 +193,7 @@ module.exports = class CocoView extends Backbone.View
@openModalView(wm)
else
@getRootView().listenToShortcuts(true)
Backbone.Mediator.publish 'modal-closed', {}
Backbone.Mediator.publish 'modal:closed', {}
# Loading RootViews

View file

@ -36,8 +36,8 @@ module.exports = class RootView extends CocoView
showNewAchievement: (achievement, earnedAchievement) ->
popup = new AchievementPopup achievement: achievement, earnedAchievement: earnedAchievement
handleNewAchievements: (earnedAchievements) ->
_.each earnedAchievements.models, (earnedAchievement) =>
handleNewAchievements: (e) ->
_.each e.earnedAchievements.models, (earnedAchievement) =>
achievement = new Achievement(_id: earnedAchievement.get('achievement'))
achievement.fetch
success: (achievement) => @showNewAchievement(achievement, earnedAchievement)

View file

@ -19,8 +19,8 @@ module.exports = class AuthModal extends ModalView
'keyup #name': 'onNameChange'
subscriptions:
'server-error': 'onServerError'
'logging-in-with-facebook': 'onLoggingInWithFacebook'
'errors:server-error': 'onServerError'
'auth:logging-in-with-facebook': 'onLoggingInWithFacebook'
constructor: (options) ->
@onNameChange = _.debounce @checkNameExists, 500
@ -104,4 +104,4 @@ module.exports = class AuthModal extends ModalView
forms.setErrorToProperty @$el, 'name', "That name is taken! How about #{newName}?", true
onGitHubLoginClicked: ->
Backbone.Mediator.publish 'github-login'
Backbone.Mediator.publish 'auth:log-in-with-github', {}

View file

@ -11,8 +11,8 @@ module.exports = class EmployerSignupModal extends ModalView
closeButton: true
subscriptions:
'server-error': 'onServerError'
'linkedin-loaded': 'onLinkedInLoaded'
'errors:server-error': 'onServerError'
'auth:linkedin-api-loaded': 'onLinkedInLoaded'
'created-user-without-reload': 'createdAccount'
events:

View file

@ -18,7 +18,7 @@ module.exports = class RecoverModal extends ModalView
'keydown input': 'recoverAccount'
subscriptions:
'server-error': 'onServerError'
'errors:server-error': 'onServerError'
onServerError: (e) -> # TODO: work error handling into a separate forms system
@disableModalInProgress(@$el)

Some files were not shown because too many files have changed in this diff Show more