From 5dde2572ff4d21fb8bae754d9cf4b97fbaba96c9 Mon Sep 17 00:00:00 2001 From: Imperadeiro98 Date: Tue, 26 Aug 2014 19:15:50 +0100 Subject: [PATCH 01/13] Update pt-PT.coffee --- app/locale/pt-PT.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/locale/pt-PT.coffee b/app/locale/pt-PT.coffee index 54138f1b6..8be7d0bee 100644 --- a/app/locale/pt-PT.coffee +++ b/app/locale/pt-PT.coffee @@ -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." From 38dcb7fcefcd1b1954236039bd258af4b822fe66 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 11:29:16 -0700 Subject: [PATCH 02/13] Fixed #5. --- app/views/play/level/DialogueAnimator.coffee | 18 +++++++++++++++--- app/views/play/level/LevelHUDView.coffee | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/views/play/level/DialogueAnimator.coffee b/app/views/play/level/DialogueAnimator.coffee index 2edae3662..3b1c3a2d7 100644 --- a/app/views/play/level/DialogueAnimator.coffee +++ b/app/views/play/level/DialogueAnimator.coffee @@ -7,6 +7,9 @@ module.exports = class DialogueAnimator constructor: (html, @jqueryElement) -> d = $('
').html(html) @childrenToAdd = _.map(d[0].childNodes, (e) -> return e) + @t0 = new Date() + @charsAdded = 0 + @charsPerSecond = 50 tick: -> if not @charsToAdd and not @childAnimator @@ -26,19 +29,28 @@ module.exports = class DialogueAnimator nextElem = @childrenToAdd[0] @childrenToAdd = @childrenToAdd[1..] if nextElem.nodeName is '#text' - @charsToAdd = _.string.chars(nextElem.nodeValue) + @charsToAdd = nextElem.nodeValue else value = nextElem.innerHTML newElem = $(nextElem).html('') @jqueryElement.append(newElem) if value + @charsAdded += @childAnimator.getCharsAdded() if @childAnimator @childAnimator = new DialogueAnimator(value, newElem) addSingleChar: -> - @jqueryElement.html(@jqueryElement.html() + @charsToAdd[0]) - @charsToAdd = @charsToAdd[1..] + elapsed = (new Date()) - @t0 + nAdded = @getCharsAdded() + nToHaveBeenAdded = Math.round @charsPerSecond * elapsed / 1000 + nToAdd = Math.min nToHaveBeenAdded - nAdded, @charsToAdd.length + @jqueryElement.html(@jqueryElement.html() + @charsToAdd.slice(0, nToAdd)) + @charsToAdd = @charsToAdd.slice(nToAdd) if @charsToAdd.length is 0 @charsToAdd = null + @charsAdded += nToAdd + + getCharsAdded: -> + @charsAdded + (@childAnimator?.charsAdded ? 0) done: -> return false if @childrenToAdd.length > 0 diff --git a/app/views/play/level/LevelHUDView.coffee b/app/views/play/level/LevelHUDView.coffee index a273712b2..c1314c823 100644 --- a/app/views/play/level/LevelHUDView.coffee +++ b/app/views/play/level/LevelHUDView.coffee @@ -197,7 +197,7 @@ module.exports = class LevelHUDView extends CocoView @lastResponses = null @bubble.append($("

#{@speaker ? 'Captain Anya'}

")) @animator = new DialogueAnimator(message, @bubble) - @messageInterval = setInterval(@addMoreMessage, 20) + @messageInterval = setInterval(@addMoreMessage, 1000 / 30) addMoreMessage: => if @animator.done() From 741139db5971fc08f97ccdc729eeb10c2459a595 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 11:34:33 -0700 Subject: [PATCH 03/13] Apparently GitHub ids are integers, not strings. --- app/schemas/models/user.coffee | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/schemas/models/user.coffee b/app/schemas/models/user.coffee index 467111b27..9f289f806 100644 --- a/app/schemas/models/user.coffee +++ b/app/schemas/models/user.coffee @@ -11,19 +11,19 @@ phoneScreenFilter = title: 'Phone screened' type: 'boolean' description: 'Whether the candidate has been phone screened.' -schoolFilter = +schoolFilter = title: 'School' type: 'string' enum: ['Top School', 'Other'] -locationFilter = +locationFilter = title: 'Location' type: 'string' enum: ['Bay Area', 'New York', 'Other US', 'International'] -roleFilter = +roleFilter = title: 'Role' type: 'string' enum: ['Web Developer', 'Software Developer', 'Mobile Developer'] -seniorityFilter = +seniorityFilter = title: 'Seniority' type: 'string' enum: ['College Student', 'Recent Grad', 'Junior', 'Senior'] @@ -32,7 +32,7 @@ visa = c.shortString description: 'Are you authorized to work in the US, or do you need visa sponsorship? (If you live in Canada or Australia, mark authorized.)' enum: ['Authorized to work in the US', 'Need visa sponsorship'] default: 'Authorized to work in the US' - + _.extend UserSchema.properties, email: c.shortString({title: 'Email', format: 'email'}) firstName: c.shortString({title: 'First Name'}) @@ -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'}) @@ -187,7 +187,7 @@ _.extend UserSchema.properties, phoneScreenFilter: title: 'Phone screen filter values' type: 'array' - items: + items: type: 'boolean' schoolFilter: title: 'School filter values' @@ -195,32 +195,32 @@ _.extend UserSchema.properties, items: type: schoolFilter.type enum: schoolFilter.enum - locationFilter: + locationFilter: title: 'Location filter values' type: 'array' items: type: locationFilter.type enum: locationFilter.enum - roleFilter: + roleFilter: title: 'Role filter values' type: 'array' items: type: roleFilter.type enum: roleFilter.enum - seniorityFilter: + seniorityFilter: title: 'Seniority filter values' type: 'array' items: type: roleFilter.type enum: seniorityFilter.enum - visa: + visa: title: 'Visa filter values' type: 'array' items: type: visa.type enum: visa.enum }) - + points: {type: 'number'} activity: {type: 'object', description: 'Summary statistics about user activity', additionalProperties: c.activity} stats: c.object {additionalProperties: false}, From 3e9adf6b1aad4a2d600b227613dd25b10fd55881 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 12:39:30 -0700 Subject: [PATCH 04/13] Fixed issue with IndieSprites no longer coloring properly. --- app/lib/surface/IndieSprite.coffee | 2 ++ app/lib/surface/SpriteBoss.coffee | 2 +- app/lib/world/thang.coffee | 2 +- app/views/play/level/LevelHUDView.coffee | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/lib/surface/IndieSprite.coffee b/app/lib/surface/IndieSprite.coffee index a297b7508..a914a96fb 100644 --- a/app/lib/surface/IndieSprite.coffee +++ b/app/lib/surface/IndieSprite.coffee @@ -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 diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index 319358d58..c7e22b56c 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -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) -> diff --git a/app/lib/world/thang.coffee b/app/lib/world/thang.coffee index da69fdf0e..44900c417 100644 --- a/app/lib/world/thang.coffee +++ b/app/lib/world/thang.coffee @@ -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 diff --git a/app/views/play/level/LevelHUDView.coffee b/app/views/play/level/LevelHUDView.coffee index c1314c823..0f10fa330 100644 --- a/app/views/play/level/LevelHUDView.coffee +++ b/app/views/play/level/LevelHUDView.coffee @@ -197,7 +197,7 @@ module.exports = class LevelHUDView extends CocoView @lastResponses = null @bubble.append($("

#{@speaker ? 'Captain Anya'}

")) @animator = new DialogueAnimator(message, @bubble) - @messageInterval = setInterval(@addMoreMessage, 1000 / 30) + @messageInterval = setInterval(@addMoreMessage, 1000 / 30) # 30 FPS addMoreMessage: => if @animator.done() From 35b107cf585611f3deccfa13b8c186bdfe13ea51 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 13:56:57 -0700 Subject: [PATCH 05/13] Refactored grid. Fixed #158. --- app/lib/surface/CoordinateDisplay.coffee | 7 +- app/lib/surface/CoordinateGrid.coffee | 102 ++++++++++++++++++ app/lib/surface/Surface.coffee | 97 ++++------------- app/locale/en.coffee | 1 - app/templates/play/level/playback.jade | 4 - app/views/play/level/LevelPlaybackView.coffee | 12 --- 6 files changed, 127 insertions(+), 96 deletions(-) create mode 100644 app/lib/surface/CoordinateGrid.coffee diff --git a/app/lib/surface/CoordinateDisplay.coffee b/app/lib/surface/CoordinateDisplay.coffee index 155f7e7ac..8d235cec9 100644 --- a/app/lib/surface/CoordinateDisplay.coffee +++ b/app/lib/surface/CoordinateDisplay.coffee @@ -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: -> '' + 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 diff --git a/app/lib/surface/CoordinateGrid.coffee b/app/lib/surface/CoordinateGrid.coffee new file mode 100644 index 000000000..7535ccf6d --- /dev/null +++ b/app/lib/surface/CoordinateGrid.coffee @@ -0,0 +1,102 @@ +CocoClass = require 'lib/CocoClass' + +module.exports = class CoordinateGrid extends CocoClass + subscriptions: + 'level-toggle-grid': 'onToggleGrid' + 'level-set-grid': 'onSetGrid' + + 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: -> '' + + 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 + console.log wop.y, wopEnd.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) -> + # 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() + diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index 013c6801f..9ba6ab0b6 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -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 @@ -56,8 +57,6 @@ module.exports = Surface = class Surface extends CocoClass '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' @@ -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,10 +126,6 @@ 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' @@ -364,6 +360,9 @@ 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() @@ -390,22 +389,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 +414,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 @@ -450,7 +453,6 @@ module.exports = Surface = class Surface extends CocoClass 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' @@ -460,67 +462,6 @@ 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} diff --git a/app/locale/en.coffee b/app/locale/en.coffee index ee033e20d..fc7fe48b5 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -355,7 +355,6 @@ play_level: done: "Done" - grid: "Grid" customize_wizard: "Customize Wizard" home: "Home" stop: "Stop" diff --git a/app/templates/play/level/playback.jade b/app/templates/play/level/playback.jade index afcbd8276..f0c83859b 100644 --- a/app/templates/play/level/playback.jade +++ b/app/templates/play/level/playback.jade @@ -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 diff --git a/app/views/play/level/LevelPlaybackView.coffee b/app/views/play/level/LevelPlaybackView.coffee index b783d3db4..deddab970 100644 --- a/app/views/play/level/LevelPlaybackView.coffee +++ b/app/views/play/level/LevelPlaybackView.coffee @@ -18,8 +18,6 @@ module.exports = class LevelPlaybackView extends CocoView 'level-scrub-back': 'onScrubBack' 'level-set-volume': 'onSetVolume' 'level-set-debug': 'onSetDebug' - 'level-set-grid': 'onSetGrid' - 'level-toggle-grid': 'onToggleGrid' 'surface:frame-changed': 'onFrameChanged' 'god:new-world-created': 'onNewWorld' 'god:streaming-world-updated': 'onNewWorld' @@ -30,7 +28,6 @@ module.exports = class LevelPlaybackView extends CocoView events: 'click #debug-toggle': 'onToggleDebug' - 'click #grid-toggle': 'onToggleGrid' 'click #edit-wizard-settings': 'onEditWizardSettings' 'click #edit-editor-config': 'onEditEditorConfig' 'click #view-keyboard-shortcuts': 'onViewKeyboardShortcuts' @@ -188,11 +185,6 @@ module.exports = class LevelPlaybackView extends CocoView flag = $('#debug-toggle i.icon-ok') Backbone.Mediator.publish('level-set-debug', {debug: flag.hasClass('invisible')}) - onToggleGrid: -> - return if @shouldIgnore() - flag = $('#grid-toggle i.icon-ok') - Backbone.Mediator.publish('level-set-grid', {grid: flag.hasClass('invisible')}) - onEditWizardSettings: -> Backbone.Mediator.publish 'edit-wizard-settings' @@ -316,10 +308,6 @@ module.exports = class LevelPlaybackView extends CocoView flag = $('#debug-toggle i.icon-ok') flag.toggleClass 'invisible', not e.debug - onSetGrid: (e) -> - flag = $('#grid-toggle i.icon-ok') - flag.toggleClass 'invisible', not e.grid - # to refactor hookUpScrubber: -> From 7300c4b3b85974d274dc08f65d4b6aeae20322be Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 14:00:03 -0700 Subject: [PATCH 06/13] Finished removing grid from playback options menu. --- app/lib/surface/CoordinateGrid.coffee | 8 -------- app/schemas/subscriptions/play.coffee | 3 --- 2 files changed, 11 deletions(-) diff --git a/app/lib/surface/CoordinateGrid.coffee b/app/lib/surface/CoordinateGrid.coffee index 7535ccf6d..1d796ada2 100644 --- a/app/lib/surface/CoordinateGrid.coffee +++ b/app/lib/surface/CoordinateGrid.coffee @@ -3,7 +3,6 @@ CocoClass = require 'lib/CocoClass' module.exports = class CoordinateGrid extends CocoClass subscriptions: 'level-toggle-grid': 'onToggleGrid' - 'level-set-grid': 'onSetGrid' shortcuts: 'ctrl+g, ⌘+g': 'onToggleGrid' @@ -69,7 +68,6 @@ module.exports = class CoordinateGrid extends CocoClass t.alpha = 0.75 @labels.push t wop.y += gridSize - console.log wop.y, wopEnd.y, gridSize if wopEnd.y < wop.y <= wopEnd.y - gridSize / 2 wop.y = wopEnd.y @gridShape.graphics.endStroke() @@ -91,12 +89,6 @@ module.exports = class CoordinateGrid extends CocoClass @gridContainer?.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() diff --git a/app/schemas/subscriptions/play.coffee b/app/schemas/subscriptions/play.coffee index c73370473..ee52d5fd3 100644 --- a/app/schemas/subscriptions/play.coffee +++ b/app/schemas/subscriptions/play.coffee @@ -29,9 +29,6 @@ module.exports = 'level-set-debug': {} # TODO schema - 'level-set-grid': - {} # TODO schema - 'level:restarted': {} # TODO schema From 50ad45334505d76c886411e7fbd5773c364d6594 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 14:34:23 -0700 Subject: [PATCH 07/13] Fixed #169. --- app/styles/editor/level/thangs_tab.sass | 19 +++++++++++++++---- app/templates/editor/level/add_thangs.jade | 4 ++-- .../editor/level/thangs/AddThangsView.coffee | 4 ++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/styles/editor/level/thangs_tab.sass b/app/styles/editor/level/thangs_tab.sass index d26d2a83b..53ea9902e 100644 --- a/app/styles/editor/level/thangs_tab.sass +++ b/app/styles/editor/level/thangs_tab.sass @@ -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 diff --git a/app/templates/editor/level/add_thangs.jade b/app/templates/editor/level/add_thangs.jade index 092547d66..561494262 100644 --- a/app/templates/editor/level/add_thangs.jade +++ b/app/templates/editor/level/add_thangs.jade @@ -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 \ No newline at end of file diff --git a/app/views/editor/level/thangs/AddThangsView.coffee b/app/views/editor/level/thangs/AddThangsView.coffee index 3bbfae0f9..93b2ad149 100644 --- a/app/views/editor/level/thangs/AddThangsView.coffee +++ b/app/views/editor/level/thangs/AddThangsView.coffee @@ -56,6 +56,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 From a5c18a41408a9ab16099cea232f10e1ca3661c8b Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 15:22:13 -0700 Subject: [PATCH 08/13] Fixed #453. --- app/lib/AudioPlayer.coffee | 6 ++++-- app/lib/surface/CocoSprite.coffee | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/lib/AudioPlayer.coffee b/app/lib/AudioPlayer.coffee index 3c6c73992..b0039cc25 100644 --- a/app/lib/AudioPlayer.coffee +++ b/app/lib/AudioPlayer.coffee @@ -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 diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index d1066a37d..711b0cca0 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -678,14 +678,14 @@ 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 'dialogue-sound-completed' @notifySpeechUpdated e onClearDialogue: (e) -> @labels.dialogue?.setText null - @instance?.stop() + @dialogueSoundInstance?.stop() @notifySpeechUpdated {} setNameLabel: (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 From 1864cb09bc8f049444a22dffa549778c4be61465 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 15:42:33 -0700 Subject: [PATCH 09/13] Fixed #712. Fixed a bug with listing files/musics in admin files view due to removed trailing slashes. --- app/views/admin/FilesView.coffee | 1 + app/views/play/level/PlayLevelView.coffee | 1 + server_setup.coffee | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/admin/FilesView.coffee b/app/views/admin/FilesView.coffee index f444bd91a..784efabea 100644 --- a/app/views/admin/FilesView.coffee +++ b/app/views/admin/FilesView.coffee @@ -33,6 +33,7 @@ module.exports = class FilesView extends RootView currentFolder: -> @$el.find('#folder-select').val() loadFiles: -> + console.log 'trying to load', "/file/#{@currentFolder()}/" $.ajax url: "/file/#{@currentFolder()}/" success: @onLoadedFiles diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index dde56b11e..bfa752be3 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -466,6 +466,7 @@ module.exports = class PlayLevelView extends RootView pointer = $('#pointer') pointer.css('transition', 'all 0.6s ease-out') pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance-50}px)") + Backbone.Mediator.publish 'play-sound', trigger: 'dom_highlight', volume: 0.75 setTimeout((=> pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)").css('transition', 'all 0.4s ease-in')), 800) diff --git a/server_setup.coffee b/server_setup.coffee index bb72554c4..10a586713 100644 --- a/server_setup.coffee +++ b/server_setup.coffee @@ -77,7 +77,8 @@ setupRedirectMiddleware = (app) -> setupTrailingSlashRemovingMiddleware = (app) -> app.use (req, res, next) -> - return res.redirect 301, req.url[...-1] if req.url.length > 1 and req.url.slice(-1) is '/' + # Remove trailing slashes except for in /file/.../ URLs, because those are treated as directory listings. + return res.redirect 301, req.url[...-1] if req.url.length > 1 and req.url.slice(-1) is '/' and not /\/file\//.test req.url next() exports.setupMiddleware = (app) -> From 871cd4b3c95ffe6636eedfd45487e8d7e51c9e39 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 17:34:00 -0700 Subject: [PATCH 10/13] Fixed #784. --- app/Router.coffee | 2 +- app/locale/en.coffee | 8 ++++ app/schemas/models/cla_submission.coffee | 17 ++++++++ app/styles/play/ladder/play_modal.sass | 20 ++++----- app/templates/community.jade | 2 +- app/templates/play/ladder/play_modal.jade | 11 ++--- app/views/EmployersView.coffee | 41 ++++++++----------- app/views/account/WizardSettingsView.coffee | 13 +++--- app/views/admin/CLAsView.coffee | 31 +++++++------- app/views/admin/CandidatesView.coffee | 21 ++++------ app/views/admin/EmployersListView.coffee | 8 +--- app/views/admin/FilesView.coffee | 1 - app/views/admin/LevelSessionsView.coffee | 10 ++--- .../achievement/AchievementEditView.coffee | 37 ++++++----------- .../editor/article/ArticleEditView.coffee | 27 ++++-------- .../level/systems/AddLevelSystemModal.coffee | 17 +------- .../editor/level/thangs/AddThangsView.coffee | 1 - .../editor/level/thangs/ThangsTabView.coffee | 1 - .../thang/ThangTypeColorsTabView.coffee | 7 ++-- .../editor/thang/ThangTypeEditView.coffee | 1 - app/views/modal/VersionsModal.coffee | 1 - app/views/play/MainPlayView.coffee | 5 +-- app/views/play/SpectateView.coffee | 33 --------------- app/views/play/ladder/LadderPlayModal.coffee | 10 ++--- app/views/play/ladder/MainLadderView.coffee | 3 +- app/views/play/ladder/MyMatchesTabView.coffee | 17 ++++---- app/views/play/level/PlayLevelView.coffee | 1 - .../play/level/modal/VictoryModal.coffee | 2 +- 28 files changed, 129 insertions(+), 219 deletions(-) create mode 100644 app/schemas/models/cla_submission.coffee diff --git a/app/Router.coffee b/app/Router.coffee index eeccc4e0d..9788b66c6 100644 --- a/app/Router.coffee +++ b/app/Router.coffee @@ -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') diff --git a/app/locale/en.coffee b/app/locale/en.coffee index fc7fe48b5..6d7ac8d8f 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -907,6 +907,7 @@ unknown: "Unknown error." resources: + sessions: "Sessions" your_sessions: "Your Sessions" level: "Level" social_network_apis: "Social Network APIs" @@ -922,6 +923,7 @@ patched_model: "Source Document" model: "Model" system: "System" + systems: "Systems" component: "Component" components: "Components" thang: "Thang" @@ -936,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" diff --git a/app/schemas/models/cla_submission.coffee b/app/schemas/models/cla_submission.coffee new file mode 100644 index 000000000..8f0fb43ce --- /dev/null +++ b/app/schemas/models/cla_submission.coffee @@ -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 diff --git a/app/styles/play/ladder/play_modal.sass b/app/styles/play/ladder/play_modal.sass index 6050df159..1bed7b9d1 100644 --- a/app/styles/play/ladder/play_modal.sass +++ b/app/styles/play/ladder/play_modal.sass @@ -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 + + #normal-view:hover + .play-option + opacity: 0.4 - .play-option:hover - opacity: 1 - .only-one + .play-option:hover opacity: 1 + .only-one + opacity: 1 .my-icon position: relative diff --git a/app/templates/community.jade b/app/templates/community.jade index 430b2621f..64c563c5b 100644 --- a/app/templates/community.jade +++ b/app/templates/community.jade @@ -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") diff --git a/app/templates/play/ladder/play_modal.jade b/app/templates/play/ladder/play_modal.jade index c25c3a1f5..22b4db84c 100644 --- a/app/templates/play/ladder/play_modal.jade +++ b/app/templates/play/ladder/play_modal.jade @@ -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 diff --git a/app/views/EmployersView.coffee b/app/views/EmployersView.coffee index b7699e428..d9dcd5a89 100644 --- a/app/views/EmployersView.coffee +++ b/app/views/EmployersView.coffee @@ -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,18 +130,19 @@ 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') ? [] currentSavedFilters.push currentFilterSet @patchEmployerFilterAlerts currentSavedFilters, @renderSavedFilters - + deleteFilterAlert: (e) -> index = $(e.target).closest('tbody tr').data('filter-index') currentSavedFilters = me.get('savedEmployerFilterAlerts') currentSavedFilters.splice(index,1) @patchEmployerFilterAlerts currentSavedFilters, @renderSavedFilters - + patchEmployerFilterAlerts: (newFilters, cb) -> me.set('savedEmployerFilterAlerts',newFilters) unless me.isValid() @@ -149,7 +151,7 @@ module.exports = class EmployersView extends RootView else triggerErrorAlert = -> alert("There was an error saving your filter alert! Please notify team@codecombat.com.") res = me.save {"savedEmployerFilterAlerts": newFilters}, {patch: true, success: cb, error: triggerErrorAlert} - + renderSavedFilters: => savedFilters = me.get('savedEmployerFilterAlerts') unless savedFilters?.length then return $("#saved-filter-table").hide() @@ -157,8 +159,7 @@ module.exports = class EmployersView extends RootView $("#saved-filter-table").find("tbody tr").remove() for filter, index in savedFilters $("#saved-filter-table tbody").append("""#{@generateFilterAlertDescription(filter)} """) - - + generateFilterAlertDescription: (filter) => descriptionString = "" for key in _.keys(filter).sort() @@ -168,7 +169,7 @@ module.exports = class EmployersView extends RootView descriptionString += value.join(", ") if descriptionString.length is 0 then descriptionString = "Any new candidate" return descriptionString - + getActiveAndApprovedCandidates: => candidates = _.filter @candidates.models, (c) -> c.get('jobProfile').active return _.filter candidates, (c) -> c.get('jobProfileApproved') @@ -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()) diff --git a/app/views/account/WizardSettingsView.coffee b/app/views/account/WizardSettingsView.coffee index 7035cdc45..d94fb21ce 100644 --- a/app/views/account/WizardSettingsView.coffee +++ b/app/views/account/WizardSettingsView.coffee @@ -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 ?= {} diff --git a/app/views/admin/CLAsView.coffee b/app/views/admin/CLAsView.coffee index a384215ed..203347fdd 100644 --- a/app/views/admin/CLAsView.coffee +++ b/app/views/admin/CLAsView.coffee @@ -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 diff --git a/app/views/admin/CandidatesView.coffee b/app/views/admin/CandidatesView.coffee index 7d8d89038..3216be2dc 100644 --- a/app/views/admin/CandidatesView.coffee +++ b/app/views/admin/CandidatesView.coffee @@ -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)}) @@ -203,4 +198,4 @@ module.exports = class CandidatesView extends RootView url = "/account/profile/#{id}" window.open url,"_blank" else - @openModalView new EmployerSignupModal \ No newline at end of file + @openModalView new EmployerSignupModal diff --git a/app/views/admin/EmployersListView.coffee b/app/views/admin/EmployersListView.coffee index a5fcb7a45..1893fb4ba 100644 --- a/app/views/admin/EmployersListView.coffee +++ b/app/views/admin/EmployersListView.coffee @@ -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, diff --git a/app/views/admin/FilesView.coffee b/app/views/admin/FilesView.coffee index 784efabea..f444bd91a 100644 --- a/app/views/admin/FilesView.coffee +++ b/app/views/admin/FilesView.coffee @@ -33,7 +33,6 @@ module.exports = class FilesView extends RootView currentFolder: -> @$el.find('#folder-select').val() loadFiles: -> - console.log 'trying to load', "/file/#{@currentFolder()}/" $.ajax url: "/file/#{@currentFolder()}/" success: @onLoadedFiles diff --git a/app/views/admin/LevelSessionsView.coffee b/app/views/admin/LevelSessionsView.coffee index aca163686..4555ccf8e 100644 --- a/app/views/admin/LevelSessionsView.coffee +++ b/app/views/admin/LevelSessionsView.coffee @@ -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() diff --git a/app/views/editor/achievement/AchievementEditView.coffee b/app/views/editor/achievement/AchievementEditView.coffee index 98d6a4f32..524c14e2e 100644 --- a/app/views/editor/achievement/AchievementEditView.coffee +++ b/app/views/editor/achievement/AchievementEditView.coffee @@ -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 diff --git a/app/views/editor/article/ArticleEditView.coffee b/app/views/editor/article/ArticleEditView.coffee index 96d4facc7..a61f19b2e 100644 --- a/app/views/editor/article/ArticleEditView.coffee +++ b/app/views/editor/article/ArticleEditView.coffee @@ -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' @@ -22,28 +21,17 @@ module.exports = class ArticleEditView extends RootView 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() diff --git a/app/views/editor/level/systems/AddLevelSystemModal.coffee b/app/views/editor/level/systems/AddLevelSystemModal.coffee index d11071e4c..173cf05ab 100644 --- a/app/views/editor/level/systems/AddLevelSystemModal.coffee +++ b/app/views/editor/level/systems/AddLevelSystemModal.coffee @@ -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 diff --git a/app/views/editor/level/thangs/AddThangsView.coffee b/app/views/editor/level/thangs/AddThangsView.coffee index 93b2ad149..c2c017c15 100644 --- a/app/views/editor/level/thangs/AddThangsView.coffee +++ b/app/views/editor/level/thangs/AddThangsView.coffee @@ -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' diff --git a/app/views/editor/level/thangs/ThangsTabView.coffee b/app/views/editor/level/thangs/ThangsTabView.coffee index 748e1a575..ee7954d58 100644 --- a/app/views/editor/level/thangs/ThangsTabView.coffee +++ b/app/views/editor/level/thangs/ThangsTabView.coffee @@ -28,7 +28,6 @@ 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' diff --git a/app/views/editor/thang/ThangTypeColorsTabView.coffee b/app/views/editor/thang/ThangTypeColorsTabView.coffee index 41876272e..cdc624587 100644 --- a/app/views/editor/thang/ThangTypeColorsTabView.coffee +++ b/app/views/editor/thang/ThangTypeColorsTabView.coffee @@ -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() diff --git a/app/views/editor/thang/ThangTypeEditView.coffee b/app/views/editor/thang/ThangTypeEditView.coffee index 4ddeadecb..1522ddeb5 100644 --- a/app/views/editor/thang/ThangTypeEditView.coffee +++ b/app/views/editor/thang/ThangTypeEditView.coffee @@ -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: diff --git a/app/views/modal/VersionsModal.coffee b/app/views/modal/VersionsModal.coffee index 78eab024f..b9c93bb95 100755 --- a/app/views/modal/VersionsModal.coffee +++ b/app/views/modal/VersionsModal.coffee @@ -17,7 +17,6 @@ class VersionsViewCollection extends CocoCollection module.exports = class VersionsModal extends ModalView template: template - startsLoading: true plain: true modalWidthPercent: 80 diff --git a/app/views/play/MainPlayView.coffee b/app/views/play/MainPlayView.coffee index 4797ddf6f..bb3838327 100644 --- a/app/views/play/MainPlayView.coffee +++ b/app/views/play/MainPlayView.coffee @@ -18,8 +18,7 @@ module.exports = class MainPlayView extends RootView constructor: (options) -> super options @levelStatusMap = {} - @sessions = new LevelSessionsCollection() - @sessions.fetch() + @sessions = @supermodel.loadCollection(new LevelSessionsCollection(), 'your_sessions', null, 0).model @listenToOnce @sessions, 'sync', @onSessionsLoaded onSessionsLoaded: (e) -> @@ -29,8 +28,6 @@ module.exports = class MainPlayView extends RootView getRenderData: (context={}) -> context = super(context) - context.home = true - context.notFound = @getQueryVariable 'not_found' tutorials = [ { name: 'Rescue Mission' diff --git a/app/views/play/SpectateView.coffee b/app/views/play/SpectateView.coffee index 8c23d779d..eb11eda33 100644 --- a/app/views/play/SpectateView.coffee +++ b/app/views/play/SpectateView.coffee @@ -38,7 +38,6 @@ module.exports = class SpectateLevelView extends RootView template: template cache: false shortcutsEnabled: true - startsLoading: true isEditorPreview: false subscriptions: @@ -70,7 +69,6 @@ module.exports = class SpectateLevelView extends RootView console.profile?() if PROFILE_ME super options $(window).on('resize', @onWindowResize) - @listenToOnce(@supermodel, 'error', @onLevelLoadError) @sessionOne = @getQueryVariable 'session-one' @sessionTwo = @getQueryVariable 'session-two' @@ -87,9 +85,6 @@ module.exports = class SpectateLevelView extends RootView else @load() - onLevelLoadError: (e) => - application.router.navigate "/play?not_found=#{@levelID}", {trigger: true} - setLevel: (@level, @supermodel) -> serializedLevel = @level.serialize @supermodel, @session @god?.setLevel serializedLevel @@ -106,7 +101,6 @@ module.exports = class SpectateLevelView extends RootView opponentSessionID: @sessionTwo spectateMode: true team: @getQueryVariable('team') - @listenToOnce(@levelLoader, 'loaded-all', @onLevelLoaderLoaded) @god = new God maxAngels: 1 getRenderData: -> @@ -121,37 +115,10 @@ module.exports = class SpectateLevelView extends RootView super() $('body').addClass('is-playing') - updateProgress: (progress) -> - super(progress) - return if @seenDocs - return unless showFrequency = @levelLoader.level.get('showGuide') - session = @levelLoader.session - diff = new Date().getTime() - new Date(session.get('created')).getTime() - return if showFrequency is 'first-time' and diff > (5 * 60 * 1000) - return unless @levelLoader.level.loaded - articles = @levelLoader.supermodel.getModels Article - for article in articles - return unless article.loaded - @showGuide() - - showGuide: -> - @seenDocs = true - LevelGuideModal = require './level/modal/LevelGuideModal' - options = {docs: @levelLoader.level.get('documentation'), supermodel: @supermodel} - @openModalView(new LevelGuideModal(options), true) - Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @ - return true - onLoaded: -> _.defer => @onLevelLoaded() onLevelLoaded: -> - return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early - # Save latest level played in local storage - if window.currentModal and not window.currentModal.destroyed - @loadingView.showReady() - return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @ - @grabLevelLoaderData() #at this point, all requisite data is loaded, and sessions are not denormalized team = @world.teamForPlayer(0) diff --git a/app/views/play/ladder/LadderPlayModal.coffee b/app/views/play/ladder/LadderPlayModal.coffee index 0d7494950..92f626248 100644 --- a/app/views/play/ladder/LadderPlayModal.coffee +++ b/app/views/play/ladder/LadderPlayModal.coffee @@ -9,7 +9,6 @@ module.exports = class LadderPlayModal extends ModalView id: 'ladder-play-modal' template: template closeButton: true - startsLoading: true @shownTutorialButton: false tutorialLevelExists: null @@ -60,11 +59,13 @@ module.exports = class LadderPlayModal extends ModalView challenger.opponentWizard = @nameMap[challenger.opponentID]?.wizard or {} @checkWizardLoaded() - $.ajax('/db/user/-/names', { + userNamesRequest = @supermodel.addRequestResource 'user_names', { + url: '/db/user/-/names' data: {ids: ids, wizard: true} - type: 'POST' + method: 'POST' success: success - }) + }, 0 + userNamesRequest.load() # PART 3: Make sure wizard is loaded @@ -76,7 +77,6 @@ module.exports = class LadderPlayModal extends ModalView finishRendering: -> @checkTutorialLevelExists (exists) => @tutorialLevelExists = exists - @startsLoading = false @render() @maybeShowTutorialButtons() diff --git a/app/views/play/ladder/MainLadderView.coffee b/app/views/play/ladder/MainLadderView.coffee index 8cb593036..2ebd4bba1 100644 --- a/app/views/play/ladder/MainLadderView.coffee +++ b/app/views/play/ladder/MainLadderView.coffee @@ -18,8 +18,7 @@ module.exports = class LadderHomeView extends RootView constructor: (options) -> super options @levelStatusMap = {} - @sessions = new LevelSessionsCollection() - @sessions.fetch() + @sessions = @supermodel.loadCollection(new LevelSessionsCollection(), 'your_sessions', null, 0).model @listenToOnce @sessions, 'sync', @onSessionsLoaded onSessionsLoaded: (e) -> diff --git a/app/views/play/ladder/MyMatchesTabView.coffee b/app/views/play/ladder/MyMatchesTabView.coffee index e0723a9ae..13bd52882 100644 --- a/app/views/play/ladder/MyMatchesTabView.coffee +++ b/app/views/play/ladder/MyMatchesTabView.coffee @@ -8,7 +8,6 @@ LadderSubmissionView = require 'views/play/common/LadderSubmissionView' module.exports = class MyMatchesTabView extends CocoView id: 'my-matches-tab-view' template: require 'templates/play/ladder/my_matches_tab' - startsLoading: true constructor: (options, @level, @sessions) -> super(options) @@ -31,7 +30,7 @@ module.exports = class MyMatchesTabView extends CocoView continue ids.push id unless @nameMap[id] - return @finishRendering() unless ids.length + return unless ids.length success = (nameMap) => return if @destroyed @@ -39,17 +38,15 @@ module.exports = class MyMatchesTabView extends CocoView for match in session.get('matches') or [] opponent = match.opponents[0] @nameMap[opponent.userID] ?= nameMap[opponent.userID]?.name ? '' - @finishRendering() + @render() if @supermodel.finished() - $.ajax('/db/user/-/names', { + userNamesRequest = @supermodel.addRequestResource 'user_names', { + url: '/db/user/-/names' data: {ids: ids} - type: 'POST' + method: 'POST' success: success - }) - - finishRendering: -> - @startsLoading = false - @render() + }, 0 + userNamesRequest.load() getRenderData: -> ctx = super() diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index bfa752be3..1121b8d47 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -41,7 +41,6 @@ module.exports = class PlayLevelView extends RootView template: template cache: false shortcutsEnabled: true - startsLoading: true isEditorPreview: false subscriptions: diff --git a/app/views/play/level/modal/VictoryModal.coffee b/app/views/play/level/modal/VictoryModal.coffee index 172e6ad14..1e9b0a7fd 100644 --- a/app/views/play/level/modal/VictoryModal.coffee +++ b/app/views/play/level/modal/VictoryModal.coffee @@ -39,7 +39,7 @@ module.exports = class VictoryModal extends ModalView loadExistingFeedback: -> url = "/db/level/#{@level.id}/feedback" @feedback = new LevelFeedback() - @feedback.url = -> url + @feedback.setURL url @feedback.fetch() @listenToOnce(@feedback, 'sync', -> @onFeedbackLoaded()) @listenToOnce(@feedback, 'error', -> @onFeedbackNotFound()) From 6ff01f7deb370838edc5255e0f06d0a375903d96 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 18:11:35 -0700 Subject: [PATCH 11/13] Fixed #814. --- app/lib/LevelBus.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/lib/LevelBus.coffee b/app/lib/LevelBus.coffee index d79451500..6fc3816e7 100644 --- a/app/lib/LevelBus.coffee +++ b/app/lib/LevelBus.coffee @@ -125,7 +125,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) -> From 8b80ac5c44d9590fd298b6310ea9f1412507fe4d Mon Sep 17 00:00:00 2001 From: djsmith85 Date: Wed, 27 Aug 2014 11:28:23 +0100 Subject: [PATCH 12/13] Added a few German translations Added translations to de.coffee and synced them with de-DE.coffee and de-AT.coffee. --- app/locale/de-AT.coffee | 1204 +++++++++++++++++++-------------------- app/locale/de-DE.coffee | 92 +-- app/locale/de.coffee | 84 +-- 3 files changed, 690 insertions(+), 690 deletions(-) diff --git a/app/locale/de-AT.coffee b/app/locale/de-AT.coffee index bb9d74e87..5d6ece832 100644 --- a/app/locale/de-AT.coffee +++ b/app/locale/de-AT.coffee @@ -1,315 +1,315 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: "German (Austria)", translation: common: loading: "Lade..." -# saving: "Saving..." -# sending: "Sending..." -# send: "Send" -# cancel: "Cancel" -# save: "Save" -# publish: "Publish" -# create: "Create" -# delay_1_sec: "1 second" -# delay_3_sec: "3 seconds" -# delay_5_sec: "5 seconds" -# manual: "Manual" -# fork: "Fork" -# play: "Play" -# retry: "Retry" + saving: "Speichere..." + sending: "Übertrage..." + send: "Senden" + cancel: "Abbrechen" + save: "Speichern" + publish: "Publiziere" + create: "Erstelle" + delay_1_sec: "1 Sekunde" + delay_3_sec: "3 Sekunden" + delay_5_sec: "5 Sekunden" + manual: "Manuell" + fork: "Fork" + play: "Abspielen" + retry: "Erneut versuchen" # watch: "Watch" # unwatch: "Unwatch" # submit_patch: "Submit Patch" -# units: -# second: "second" -# seconds: "seconds" -# minute: "minute" -# minutes: "minutes" -# hour: "hour" -# hours: "hours" -# day: "day" -# days: "days" -# week: "week" -# weeks: "weeks" -# month: "month" -# months: "months" -# year: "year" -# years: "years" + units: + second: "Sekunde" + seconds: "Sekunden" + minute: "Minute" + minutes: "Minuten" + hour: "Stunde" + hours: "Stunden" + day: "Tag" + days: "Tage" + week: "Woche" + weeks: "Wochen" + month: "Monat" + months: "Monate" + year: "Jahr" + years: "Jahre" -# modal: -# close: "Close" -# okay: "Okay" + modal: + close: "Schließen" + okay: "Okay" -# not_found: -# page_not_found: "Page not found" + not_found: + page_not_found: "Seite nicht gefunden" -# nav: -# play: "Levels" + nav: + play: "Spielen" # community: "Community" -# editor: "Editor" -# blog: "Blog" -# forum: "Forum" + editor: "Editor" + blog: "Blog" + forum: "Forum" # account: "Account" # profile: "Profile" # stats: "Stats" # code: "Code" -# admin: "Admin" -# home: "Home" -# contribute: "Contribute" -# legal: "Legal" -# about: "About" -# contact: "Contact" -# twitter_follow: "Follow" -# employers: "Employers" + admin: "Administration" + home: "Home" + contribute: "Helfen" + legal: "Rechtliches" + about: "Über" + contact: "Kontakt" + twitter_follow: "Twitter" + employers: "Mitarbeiter" -# versions: -# save_version_title: "Save New Version" -# new_major_version: "New Major Version" -# cla_prefix: "To save changes, first you must agree to our" -# cla_url: "CLA" -# cla_suffix: "." -# cla_agree: "I AGREE" + versions: + save_version_title: "Neue Version speichern" + new_major_version: "Neue Hauptversion" + cla_prefix: "Damit Änderungen gespeichert werden können, musst du unsere Lizenzbedingungen (" + cla_url: "CLA" + cla_suffix: ") akzeptieren." + cla_agree: "Ich stimme zu" -# login: -# sign_up: "Create Account" -# log_in: "Log In" -# logging_in: "Logging In" -# log_out: "Log Out" -# recover: "recover account" + login: + sign_up: "Registrieren" + log_in: "Einloggen" + logging_in: "Logge ein" + log_out: "Ausloggen" + recover: "Account wiederherstellen" -# recover: -# recover_account_title: "Recover Account" -# send_password: "Send Recovery Password" + recover: + recover_account_title: "Account Wiederherstellung" + send_password: "Wiederherstellungskennwort senden" -# signup: -# create_account_title: "Create Account to Save Progress" -# description: "It's free. Just need a couple things and you'll be good to go:" -# email_announcements: "Receive announcements by email" -# coppa: "13+ or non-USA " -# coppa_why: "(Why?)" -# creating: "Creating Account..." -# sign_up: "Sign Up" -# log_in: "log in with password" -# social_signup: "Or, you can sign up through Facebook or G+:" + signup: + create_account_title: "Account anlegen, um Fortschritt zu speichern" + description: "Es ist kostenlos. Nur noch ein paar Dinge, dann kannst Du loslegen." + email_announcements: "Erhalte Benachrichtigungen per Email" + coppa: "Älter als 13 oder nicht aus den USA" + coppa_why: "(Warum?)" + creating: "Erzeuge Account..." + sign_up: "Neuen Account anlegen" + log_in: "mit Passwort einloggen" + social_signup: "oder, du registriest dich über Facebook oder G+:" # required: "You need to log in before you can go that way." -# home: -# slogan: "Learn to Code by Playing a Game" -# no_ie: "CodeCombat does not run in Internet Explorer 9 or older. Sorry!" -# no_mobile: "CodeCombat wasn't designed for mobile devices and may not work!" -# play: "Play" -# old_browser: "Uh oh, your browser is too old to run CodeCombat. Sorry!" -# old_browser_suffix: "You can try anyway, but it probably won't work." -# campaign: "Campaign" -# for_beginners: "For Beginners" -# multiplayer: "Multiplayer" -# for_developers: "For Developers" -# javascript_blurb: "The language of the web. Great for writing websites, web apps, HTML5 games, and servers." + home: + slogan: "Lerne spielend Programmieren" + no_ie: "CodeCombat läuft nicht im IE8 oder älteren Browsern. Tut uns Leid!" + no_mobile: "CodeCombat ist nicht für Mobilgeräte optimiert und funktioniert möglicherweise nicht." + play: "Spielen" + old_browser: "Oh! Dein Browser ist zu alt für CodeCombat. Sorry!" + old_browser_suffix: "Du kannst es trotzdem versuchen, aber es wird wahrscheinlich nicht funktionieren." + campaign: "Kampagne" + for_beginners: "Für Anfänger" + multiplayer: "Mehrspieler" + for_developers: "Für Entwickler" + 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: -# choose_your_level: "Choose Your Level" -# adventurer_prefix: "You can jump to any level below, or discuss the levels on " -# adventurer_forum: "the Adventurer forum" -# adventurer_suffix: "." -# campaign_beginner: "Beginner Campaign" -# campaign_beginner_description: "... in which you learn the wizardry of programming." -# campaign_dev: "Random Harder Levels" -# campaign_dev_description: "... in which you learn the interface while doing something a little harder." -# campaign_multiplayer: "Multiplayer Arenas" -# campaign_multiplayer_description: "... in which you code head-to-head against other players." -# campaign_player_created: "Player-Created" -# campaign_player_created_description: "... in which you battle against the creativity of your fellow Artisan Wizards." -# level_difficulty: "Difficulty: " -# play_as: "Play As" -# spectate: "Spectate" + play: + choose_your_level: "Wähle dein Level" + adventurer_prefix: "Du kannst zu jedem Level springen oder diskutiere die Level " + adventurer_forum: "im Abenteurerforum" + adventurer_suffix: "." + campaign_beginner: "Anfängerkampagne" + campaign_beginner_description: "... in der Du die Zauberei der Programmierung lernst." + campaign_dev: "Beliebiges schwierigeres Level" + campaign_dev_description: "... in welchem Du die Bedienung erlernst, indem Du etwas schwierigeres machst." + campaign_multiplayer: "Multiplayerarena" + campaign_multiplayer_description: "... in der Du Kopf-an-Kopf gegen andere Spieler programmierst." + campaign_player_created: "Von Spielern erstellt" + campaign_player_created_description: "... in welchem Du gegen die Kreativität eines Artisan Zauberers kämpfst." + level_difficulty: "Schwierigkeit: " + play_as: "Spiele als " + spectate: "Zuschauen" -# contact: -# contact_us: "Contact CodeCombat" -# welcome: "Good to hear from you! Use this form to send us email. " -# contribute_prefix: "If you're interested in contributing, check out our " -# contribute_page: "contribute page" -# contribute_suffix: "!" -# forum_prefix: "For anything public, please try " -# forum_page: "our forum" -# forum_suffix: " instead." -# send: "Send Feedback" -# contact_candidate: "Contact Candidate" -# recruitment_reminder: "Use this form to reach out to candidates you are interested in interviewing. Remember that CodeCombat charges 15% of first-year salary. The fee is due upon hiring the employee and is refundable for 90 days if the employee does not remain employed. Part time, remote, and contract employees are free, as are interns." + contact: + contact_us: "Kontaktiere CodeCombat" + welcome: "Schön von Dir zu hören! Benutze dieses Formular um uns eine Email zu schicken." + contribute_prefix: "Wenn Du Interesse hast, uns zu unterstützen dann sieh dir die " + contribute_page: "Unterstützer Seite" + contribute_suffix: " an!" + forum_prefix: "Für alle öffentlichen Themen, benutze stattdessen " + forum_page: "unser Forum" + forum_suffix: "." + send: "Sende Feedback" + contact_candidate: "Kontaktiere Kandidaten" + recruitment_reminder: "Benutzen Sie dieses Formular um Kontakt zu Kandidaten aufzunehmen, an denen Sie interessiert sind. Bedenken Sie das CodeCombat 15% des ersten Jahresgehaltes berechnet. Diese Gebühr wird fällig wenn Sie den Kandidaten einstellen und ist für 90 Tage rückerstattungsfähig, sollte der Mitarbeiter nicht eingestellt bleiben. Mitarbeiter die für Teilzeit, Remote oder eine Auftragsarbeit eingestellt werden sind kostenlos, das gilt auch für Praktikanten." diplomat_suggestion: -# title: "Help translate CodeCombat!" -# sub_heading: "We need your language skills." + title: "Hilf CodeCombat zu übersetzen!" + sub_heading: "Wir brauchen Deine Sprachfähigkeiten." pitch_body: "Wir entwickeln CodeCombat in Englisch, aber wir haben Spieler in der ganzen Welt. Viele von ihnen wollen in Deutsch (Österreich) spielen, sprechen aber kein Englisch. Wenn Du also beide Sprachen beherrscht, melde Dich an um ein Diplomat zu werden und hilf die Website und die Levels zu Deutsch (Österreich) zu übersetzen." missing_translations: "Solange wir nicht alles ins Deutsche (Österreich) übesetzt haben, siehst Du die englische Übersetzung, wo Deutsch (Österreich) leider noch nicht zur Verfügung steht." -# learn_more: "Learn more about being a Diplomat" -# subscribe_as_diplomat: "Subscribe as a Diplomat" + learn_more: "Finde heraus, wie Du ein Diplomat werden kannst" + subscribe_as_diplomat: "Schreibe dich als Diplomat ein" -# wizard_settings: -# title: "Wizard Settings" -# customize_avatar: "Customize Your Avatar" -# active: "Active" -# color: "Color" -# group: "Group" -# clothes: "Clothes" -# trim: "Trim" -# cloud: "Cloud" -# team: "Team" -# spell: "Spell" -# boots: "Boots" -# hue: "Hue" -# saturation: "Saturation" -# lightness: "Lightness" + wizard_settings: + title: "Zauberer Einstellungen" + customize_avatar: "Individualisiere deinen Avatar" + active: "Aktiv" + color: "Farbe" + group: "Gruppe" + clothes: "Kleidung" + trim: "Applikationen" + cloud: "Wolke" + team: "Team" + spell: "Zauber" + boots: "Stiefel" + hue: "Farbton" + saturation: "Sättigung" + lightness: "Helligkeit" -# account_settings: -# title: "Account Settings" -# not_logged_in: "Log in or create an account to change your settings." -# autosave: "Changes Save Automatically" -# me_tab: "Me" -# picture_tab: "Picture" -# upload_picture: "Upload a picture" -# wizard_tab: "Wizard" -# password_tab: "Password" -# emails_tab: "Emails" -# admin: "Admin" -# wizard_color: "Wizard Clothes Color" -# new_password: "New Password" -# new_password_verify: "Verify" -# email_subscriptions: "Email Subscriptions" -# email_subscriptions_none: "No Email Subscriptions." -# email_announcements: "Announcements" -# email_announcements_description: "Get emails on the latest news and developments at CodeCombat." -# email_notifications: "Notifications" + account_settings: + title: "Accounteinstellungen" + not_logged_in: "Logge Dich ein oder lege einen Account an, um deine Einstellungen ändern zu können." + autosave: "Sichere Änderungen automatisch" + me_tab: "Ich" + picture_tab: "Bild" + upload_picture: "Ein Bild hochladen" + wizard_tab: "Zauberer" + password_tab: "Passwort" + emails_tab: "Emails" + admin: "Admin" + wizard_color: "Die Farbe der Kleidung des Zauberers" + new_password: "Neues Passwort" + new_password_verify: "Passwort verifizieren" + email_subscriptions: "Email Abonnements" + email_subscriptions_none: "Keine Email Abonnements." + email_announcements: "Ankündigungen" + email_announcements_description: "Erhalte regelmäßig Ankündigungen zu deinem Account." + email_notifications: "Benachrichtigungen" # email_notifications_summary: "Controls for personalized, automatic email notifications related to your CodeCombat activity." # email_any_notes: "Any Notifications" # email_any_notes_description: "Disable to stop all activity notification emails." # email_news: "News" -# email_recruit_notes: "Job Opportunities" + email_recruit_notes: "Job-Angebote" # email_recruit_notes_description: "If you play really well, we may contact you about getting you a (better) job." -# contributor_emails: "Contributor Class Emails" -# contribute_prefix: "We're looking for people to join our party! Check out the " -# contribute_page: "contribute page" -# contribute_suffix: " to find out more." -# email_toggle: "Toggle All" -# error_saving: "Error Saving" -# saved: "Changes Saved" -# password_mismatch: "Password does not match." -# password_repeat: "Please repeat your password." -# job_profile: "Job Profile" -# job_profile_approved: "Your job profile has been approved by CodeCombat. Employers will be able to see it until you either mark it inactive or it has not been changed for four weeks." -# job_profile_explanation: "Hi! Fill this out, and we will get in touch about finding you a software developer job." -# sample_profile: "See a sample profile" -# view_profile: "View Your Profile" + contributor_emails: "Unterstützer Email" + contribute_prefix: "Wir suchen nach Leuten, die mitmachen! Schau dir die" + contribute_page: "Unterstützer Seite" + contribute_suffix: " an um mehr zu erfahren." + email_toggle: "Alles wählen" + error_saving: "Fehler beim Speichern" + saved: "Änderungen gespeichert" + password_mismatch: "Passwörter stimmen nicht überein." + 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" + sample_profile: "Ein Beispielprofil ansehen" + view_profile: "Dein Profil ansehen" -# account_profile: -# settings: "Settings" -# edit_profile: "Edit Profile" + account_profile: + settings: "Einstellungen" + edit_profile: "Profil editieren" # done_editing: "Done Editing" -# profile_for_prefix: "Profile for " -# profile_for_suffix: "" + profile_for_prefix: "Profil von " + profile_for_suffix: "" # featured: "Featured" # not_featured: "Not Featured" -# looking_for: "Looking for:" -# last_updated: "Last updated:" -# contact: "Contact" + looking_for: "Suche nach:" + last_updated: "zuletzt geändert:" + contact: "Kontakt" # active: "Looking for interview offers now" # inactive: "Not looking for offers right now" # complete: "complete" # next: "Next" -# next_city: "city?" -# next_country: "pick your country." -# next_name: "name?" -# next_short_description: "write a short description." -# next_long_description: "describe your desired position." -# next_skills: "list at least five skills." + next_city: "Stadt?" + next_country: "Wähle dein Land." + next_name: "Name?" + next_short_description: "Schreibe eine kurze Beschreibung." + next_long_description: "Beschreibe deine gewünschte Position" + next_skills: "Liste mindestens fünf Fähigkeiten." # next_work: "chronicle your work history." # next_education: "recount your educational ordeals." -# next_projects: "show off up to three projects you've worked on." + next_projects: "Zeige bis zu 3 Projekte an denen du gearbeitet hast." # next_links: "add any personal or social links." -# next_photo: "add an optional professional photo." + next_photo: "Füge ein optionales professionelles Foto hinzu." # next_active: "mark yourself open to offers to show up in searches." -# example_blog: "Blog" -# example_personal_site: "Personal Site" -# links_header: "Personal Links" -# links_blurb: "Link any other sites or profiles you want to highlight, like your GitHub, your LinkedIn, or your blog." -# links_name: "Link Name" + example_blog: "Blog" + example_personal_site: "Persönliche Seite" + links_header: "Persönliche Links" + links_blurb: "Verlinke zu anderen Seiten oder Profilen die du hervorheben möchtest, wie z.B. dein GitHub, dein LinkedIn oder deinen Blog." + links_name: "Link-Name" # links_name_help: "What are you linking to?" -# links_link_blurb: "Link URL" + links_link_blurb: "Link URL" # basics_header: "Update basic info" # basics_active: "Open to Offers" # basics_active_help: "Want interview offers right now?" # basics_job_title: "Desired Job Title" # basics_job_title_help: "What role are you looking for?" -# basics_city: "City" -# basics_city_help: "City you want to work in (or live in now)." -# basics_country: "Country" -# basics_country_help: "Country you want to work in (or live in now)." + basics_city: "Stadt" + basics_city_help: "Stadt in der du arbeiten möchtest (oder jetzt lebst)." + basics_country: "Land" + basics_country_help: "Land in dem du arbeiten möchtest (oder jetzt lebst)." # basics_visa: "US Work Status" # basics_visa_help: "Are you authorized to work in the US, or do you need visa sponsorship? (If you live in Canada or Australia, mark authorized.)" # basics_looking_for: "Looking For" -# basics_looking_for_full_time: "Full-time" -# basics_looking_for_part_time: "Part-time" -# basics_looking_for_remote: "Remote" + basics_looking_for_full_time: "Vollzeit" + basics_looking_for_part_time: "Teilzeit" + basics_looking_for_remote: "Remote" # basics_looking_for_contracting: "Contracting" -# basics_looking_for_internship: "Internship" + basics_looking_for_internship: "Praktikum" # basics_looking_for_help: "What kind of developer position do you want?" -# name_header: "Fill in your name" -# name_anonymous: "Anonymous Developer" + name_header: "Trage deinen Namen ein" + name_anonymous: "Anonymer Entwickler" # name_help: "Name you want employers to see, like 'Nick Winter'." # short_description_header: "Write a short description of yourself" # short_description_blurb: "Add a tagline to help an employer quickly learn more about you." # short_description: "Tagline" # short_description_help: "Who are you, and what are you looking for? 140 characters max." -# skills_header: "Skills" + skills_header: "Fähigkeiten" # skills_help: "Tag relevant developer skills in order of proficiency." -# long_description_header: "Describe your desired position" + long_description_header: "Beschreibe deine gewünschte Position" # long_description_blurb: "Tell employers how awesome you are and what role you want." # long_description: "Self Description" # long_description_help: "Describe yourself to potential employers. Keep it short and to the point. We recommend outlining the position that would most interest you. Tasteful markdown okay; 600 characters max." -# work_experience: "Work Experience" + work_experience: "Berufserfahrung" # work_header: "Chronicle your work history" # work_years: "Years of Experience" # work_years_help: "How many years of professional experience (getting paid) developing software do you have?" # work_blurb: "List your relevant work experience, most recent first." -# work_employer: "Employer" -# work_employer_help: "Name of your employer." + work_employer: "Arbeitgeber" + work_employer_help: "Name deines Arbeitgebers." # work_role: "Job Title" # work_role_help: "What was your job title or role?" # work_duration: "Duration" # work_duration_help: "When did you hold this gig?" -# work_description: "Description" -# work_description_help: "What did you do there? (140 chars; optional)" + work_description: "Beschreibung" + work_description_help: "Was hast du dort gemacht (140 Zeichen; optional)" # education: "Education" # education_header: "Recount your academic ordeals" # education_blurb: "List your academic ordeals." -# education_school: "School" -# education_school_help: "Name of your school." -# education_degree: "Degree" + education_school: "Schule" + education_school_help: "Name deiner Schule." + education_degree: "Abschluss" # education_degree_help: "What was your degree and field of study?" # education_duration: "Dates" -# education_duration_help: "When?" -# education_description: "Description" + education_duration_help: "Wann?" + education_description: "Beschreibung" # education_description_help: "Highlight anything about this educational experience. (140 chars; optional)" # our_notes: "CodeCombat's Notes" # remarks: "Remarks" -# projects: "Projects" -# projects_header: "Add 3 projects" -# projects_header_2: "Projects (Top 3)" + projects: "Projekte" + projects_header: "Füge 3 Projekte hinzu" + projects_header_2: "Projekte (Top 3)" # projects_blurb: "Highlight your projects to amaze employers." -# project_name: "Project Name" -# project_name_help: "What was the project called?" -# project_description: "Description" -# project_description_help: "Briefly describe the project." -# project_picture: "Picture" -# project_picture_help: "Upload a 230x115px or larger image showing off the project." -# project_link: "Link" -# project_link_help: "Link to the project." -# player_code: "Player Code" + project_name: "Projekt Name" + project_name_help: "Wie wurde das Projekt genannt?" + project_description: "Beschreibung" + project_description_help: "Beschreibe kurz das Projekt." + project_picture: "Bild" + project_picture_help: "Lade ein 230x115px oder größeres Bild hoch, welches das Projekt darstellt." + project_link: "Link" + project_link_help: "Verlinke zu dem Projekt." + player_code: "Spieler Code" -# employers: + employers: # hire_developers_not_credentials: "Hire developers, not credentials." # get_started: "Get Started" # already_screened: "We've already technically screened all our candidates" @@ -337,14 +337,14 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # pass_screen: "They will pass your technical screen." # pass_screen_blurb: "Review each candidate's code before reaching out. One employer found that 5x as many of our devs passed their technical screen than hiring from Hacker News." # make_hiring_easier: "Make my hiring easier, please." -# what: "What is CodeCombat?" + what: "Was ist CodeCombat?" # what_blurb: "CodeCombat is a multiplayer browser programming game. Players write code to control their forces in battle against other developers. Our players have experience with all major tech stacks." # cost: "How much do we charge?" # cost_blurb: "We charge 15% of first year's salary and offer a 100% money back guarantee for 90 days. We don't charge for candidates who are already actively being interviewed at your company." -# candidate_name: "Name" + candidate_name: "Name" # candidate_location: "Location" # candidate_looking_for: "Looking For" -# candidate_role: "Role" + candidate_role: "Rolle" # candidate_top_skills: "Top Skills" # candidate_years_experience: "Yrs Exp" # candidate_last_updated: "Last Updated" @@ -353,99 +353,99 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # other_developers: "Other Developers" # inactive_developers: "Inactive Developers" -# play_level: -# done: "Done" -# grid: "Grid" -# customize_wizard: "Customize Wizard" -# home: "Home" + play_level: + done: "Fertig" + grid: "Raster" + customize_wizard: "Bearbeite den Zauberer" + home: "Startseite" # stop: "Stop" -# game_menu: "Game Menu" -# guide: "Guide" -# restart: "Restart" -# goals: "Goals" -# success: "Success!" -# incomplete: "Incomplete" -# timed_out: "Ran out of time" + game_menu: "Spielmenü" + guide: "Hilfe" + restart: "Neustart" + goals: "Ziele" + success: "Erfolgreich!" + incomplete: "Unvollständig" + timed_out: "Zeit abgelaufen" # failing: "Failing" -# action_timeline: "Action Timeline" -# click_to_select: "Click on a unit to select it." -# reload_title: "Reload All Code?" -# reload_really: "Are you sure you want to reload this level back to the beginning?" -# reload_confirm: "Reload All" -# victory_title_prefix: "" -# victory_title_suffix: " Complete" -# victory_sign_up: "Sign Up to Save Progress" -# victory_sign_up_poke: "Want to save your code? Create a free account!" -# victory_rate_the_level: "Rate the level: " -# victory_return_to_ladder: "Return to Ladder" -# victory_play_next_level: "Play Next Level" -# victory_go_home: "Go Home" -# victory_review: "Tell us more!" -# victory_hour_of_code_done: "Are You Done?" -# victory_hour_of_code_done_yes: "Yes, I'm finished with my Hour of Code™!" -# guide_title: "Guide" -# tome_minion_spells: "Your Minions' Spells" -# tome_read_only_spells: "Read-Only Spells" -# tome_other_units: "Other Units" -# tome_cast_button_castable: "Cast Spell" -# tome_cast_button_casting: "Casting" -# tome_cast_button_cast: "Spell Cast" -# tome_select_spell: "Select a Spell" -# tome_select_a_thang: "Select Someone for " -# tome_available_spells: "Available Spells" -# hud_continue: "Continue (shift+space)" -# spell_saved: "Spell Saved" -# skip_tutorial: "Skip (esc)" -# keyboard_shortcuts: "Key Shortcuts" -# loading_ready: "Ready!" -# tip_insert_positions: "Shift+Click a point on the map to insert it into the spell editor." -# tip_toggle_play: "Toggle play/paused with Ctrl+P." -# tip_scrub_shortcut: "Ctrl+[ and Ctrl+] rewind and fast-forward." -# tip_guide_exists: "Click the guide at the top of the page for useful info." -# tip_open_source: "CodeCombat is 100% open source!" -# tip_beta_launch: "CodeCombat launched its beta in October, 2013." -# tip_js_beginning: "JavaScript is just the beginning." -# tip_think_solution: "Think of the solution, not the problem." -# tip_theory_practice: "In theory, there is no difference between theory and practice. But in practice, there is. - Yogi Berra" -# tip_error_free: "There are two ways to write error-free programs; only the third one works. - Alan Perlis" -# tip_debugging_program: "If debugging is the process of removing bugs, then programming must be the process of putting them in. - Edsger W. Dijkstra" -# tip_forums: "Head over to the forums and tell us what you think!" -# tip_baby_coders: "In the future, even babies will be Archmages." -# tip_morale_improves: "Loading will continue until morale improves." -# tip_all_species: "We believe in equal opportunities to learn programming for all species." + action_timeline: "Aktionszeitstrahl" + click_to_select: "Klicke auf eine Einheit, um sie auszuwählen." + reload_title: "Gesamten Code neu laden?" + reload_really: "Bist Du sicher, dass Du das Level neu beginnen willst?" + reload_confirm: "Alles neu laden" + victory_title_prefix: "" + victory_title_suffix: " Abgeschlossen" + victory_sign_up: "Melde Dich an, um Fortschritte zu speichern" + victory_sign_up_poke: "Möchtest Du Neuigkeiten per Mail erhalten? Erstelle einen kostenlosen Account und wir halten Dich auf dem Laufenden." + victory_rate_the_level: "Bewerte das Level: " + victory_return_to_ladder: "Zurück zur Rangliste" + victory_play_next_level: "Spiel das nächste Level" + victory_go_home: "Geh auf die Startseite" + victory_review: "Erzähl uns davon!" + victory_hour_of_code_done: "Bist Du fertig?" + victory_hour_of_code_done_yes: "Ja, ich bin mit meiner Code-Stunde fertig!" + guide_title: "Anleitung" + tome_minion_spells: "Die Zaubersprüche Deiner Knechte" + tome_read_only_spells: "Nur-lesen Zauberspüche" + tome_other_units: "Andere Einheiten" + tome_cast_button_castable: "Führe aus" + tome_cast_button_casting: "Ausführen" + tome_cast_button_cast: "Zauberspuch ausführen" + tome_select_spell: "Wähle einen Zauber" + tome_select_a_thang: "Wähle jemanden aus, um " + tome_available_spells: "Verfügbare Zauber" + hud_continue: "Weiter (drücke Shift + Leertaste)" + spell_saved: "Zauber gespeichert" + skip_tutorial: "Überspringen (Esc)" + keyboard_shortcuts: "Tastenkürzel" + loading_ready: "Bereit!" + tip_insert_positions: "Halte 'Umschalt' gedrückt und klicke auf die Karte um die Koordinaten einzufügen." + tip_toggle_play: "Wechsel zwischen Play und Pause mit Strg+P." + tip_scrub_shortcut: "Spule vor und zurück mit Strg+[ und Strg+]" + tip_guide_exists: "Klicke auf die Anleitung am oberen Ende der Seite für nützliche Informationen" + tip_open_source: "CodeCombat ist 100% quelloffen!" + tip_beta_launch: "CodeCombat startete seine Beta im Oktober 2013." + tip_js_beginning: "JavaScript ist nur der Anfang." + tip_think_solution: "Denke über die Lösung nach, nicht über das Problem." + tip_theory_practice: "In der Theorie gibt es keinen Unterschied zwischen Theorie und Praxis. In der Praxis schon. - Yogi Berra" + tip_error_free: "Es gibt zwei Wege fehlerfreie Programme zu schreiben; nur der Dritte funktioniert. - Alan Perlis" + tip_debugging_program: "Wenn Debugging der Prozess zum Fehler entfernen ist, dann muss Programmieren der Prozess sein Fehler zu machen. - Edsger W. Dijkstra" + tip_forums: "Gehe zum Forum und sage uns was du denkst!" + tip_baby_coders: "In der Zukunft werden sogar Babies Erzmagier sein." + tip_morale_improves: "Das Laden wird weiter gehen bis die Stimmung sich verbessert." + tip_all_species: "Wir glauben an gleiche Chancen für alle Arten Programmieren zu lernen." # tip_reticulating: "Reticulating spines." -# tip_harry: "Yer a Wizard, " -# tip_great_responsibility: "With great coding skill comes great debug responsibility." -# tip_munchkin: "If you don't eat your vegetables, a munchkin will come after you while you're asleep." -# tip_binary: "There are only 10 types of people in the world: those who understand binary, and those who don't." -# tip_commitment_yoda: "A programmer must have the deepest commitment, the most serious mind. ~ Yoda" -# tip_no_try: "Do. Or do not. There is no try. - Yoda" -# tip_patience: "Patience you must have, young Padawan. - Yoda" -# tip_documented_bug: "A documented bug is not a bug; it is a feature." -# tip_impossible: "It always seems impossible until it's done. - Nelson Mandela" -# tip_talk_is_cheap: "Talk is cheap. Show me the code. - Linus Torvalds" -# tip_first_language: "The most disastrous thing that you can ever learn is your first programming language. - Alan Kay" -# tip_hardware_problem: "Q: How many programmers does it take to change a light bulb? A: None, it's a hardware problem." -# time_current: "Now:" -# time_total: "Max:" -# time_goto: "Go to:" -# infinite_loop_try_again: "Try Again" + tip_harry: "Du bist ein Zauberer, " + tip_great_responsibility: "Mit großen Programmierfähigkeiten kommt große Verantwortung." + tip_munchkin: "Wenn du dein Gemüse nicht isst, besucht dich ein Zwerg während du schläfst." + tip_binary: "Es gibt auf der Welt nur 10 Arten von Menschen: die, welche Binär verstehen und die, welche nicht." + tip_commitment_yoda: "Ein Programmier muss die größte Hingabe haben, den ernstesten Verstand. ~ Yoda" + tip_no_try: "Tu. Oder tu nicht. Es gibt kein Versuchen. - Yoda" + tip_patience: "Geduld du musst haben, junger Padawan. - Yoda" + tip_documented_bug: "Ein dokumentierter Fehler ist kein Fehler; er ist ein Merkmal." + 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: 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" + infinite_loop_try_again: "Erneut versuchen" # infinite_loop_reset_level: "Reset Level" -# infinite_loop_comment_out: "Comment Out My Code" + infinite_loop_comment_out: "Meinen Code auskommentieren" # 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" @@ -457,47 +457,47 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # granularity_saved_games: "Saved" # granularity_change_history: "History" -# options: -# general_options: "General Options" -# music_label: "Music" -# music_description: "Turn background music on/off." + options: + 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 Config" -# editor_config_title: "Editor Configuration" -# editor_config_level_language_label: "Language for This Level" -# editor_config_level_language_description: "Define the programming language for this particular level." -# editor_config_default_language_label: "Default Programming Language" -# editor_config_default_language_description: "Define the programming language you want to code in when starting new levels." -# editor_config_keybindings_label: "Key Bindings" -# editor_config_keybindings_default: "Default (Ace)" -# editor_config_keybindings_description: "Adds additional shortcuts known from the common editors." -# editor_config_livecompletion_label: "Live Autocompletion" -# editor_config_livecompletion_description: "Displays autocomplete suggestions while typing." -# editor_config_invisibles_label: "Show Invisibles" -# editor_config_invisibles_description: "Displays invisibles such as spaces or tabs." -# editor_config_indentguides_label: "Show Indent Guides" -# editor_config_indentguides_description: "Displays vertical lines to see indentation better." -# editor_config_behaviors_label: "Smart Behaviors" -# editor_config_behaviors_description: "Autocompletes brackets, braces, and quotes." + editor_config: "Editor Einstellungen" + editor_config_title: "Editor Einstellungen" + editor_config_level_language_label: "Sprache für dieses Level" + editor_config_level_language_description: "Lege die Programmiersprache für dieses bestimmte Level fest." + editor_config_default_language_label: "Voreinstellung Programmiersprache" + editor_config_default_language_description: "Definiere die Programmiersprache in der du programmieren möchtest wenn du ein neues Level beginnst." + 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 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" + editor_config_indentguides_description: "Zeigt vertikale Linien an um Einrückungen besser zu sehen." + editor_config_behaviors_label: "Intelligentes Verhalten" + editor_config_behaviors_description: "Vervollständigt automatisch Klammern und Anführungszeichen." # guide: # temp: "Temp" -# multiplayer: -# multiplayer_title: "Multiplayer Settings" + multiplayer: + multiplayer_title: "Mehrspieler Einstellungen" # multiplayer_toggle: "Enable multiplayer" -# multiplayer_toggle_description: "Allow others to join your game." -# multiplayer_link_description: "Give this link to anyone to have them join you." -# multiplayer_hint_label: "Hint:" -# multiplayer_hint: " Click the link to select all, then press ⌘-C or Ctrl-C to copy the link." -# multiplayer_coming_soon: "More multiplayer features to come!" + 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." + multiplayer_coming_soon: "Mehr Multiplayerfeatures werden kommen!" # multiplayer_sign_in_leaderboard: "Sign in or create an account and get your solution on the leaderboard." -# keyboard_shortcuts: -# keyboard_shortcuts: "Keyboard Shortcuts" -# space: "Space" -# enter: "Enter" + keyboard_shortcuts: + keyboard_shortcuts: "Tastaturkürzel" + space: "Leertaste" + enter: "Eingabetaste" # escape: "Escape" # shift: "Shift" # cast_spell: "Cast current spell." @@ -514,20 +514,20 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # beautify: "Beautify your code by standardizing its formatting." # move_wizard: "Move your Wizard around the level." -# admin: -# av_title: "Admin Views" -# av_entities_sub_title: "Entities" -# av_entities_users_url: "Users" -# av_entities_active_instances_url: "Active Instances" -# av_entities_employer_list_url: "Employer List" -# av_other_sub_title: "Other" -# av_other_debug_base_url: "Base (for debugging base.jade)" -# u_title: "User List" -# lg_title: "Latest Games" + admin: + av_title: "Administrator Übersicht" + av_entities_sub_title: "Entitäten" + av_entities_users_url: "Benutzer" + av_entities_active_instances_url: "Aktive Instanzen" + av_entities_employer_list_url: "Arbeitgeberliste" + av_other_sub_title: "Sonstige" + av_other_debug_base_url: "Base (um base.jade zu debuggen)" + u_title: "Benutzerliste" + lg_title: "Letzte Spiele" # clas: "CLAs" -# community: -# main_title: "CodeCombat Community" + community: + main_title: "CodeCombat Community" # introduction: "Check out the ways you can get involved below and decide what sounds the most fun. We look forward to working with you!" # level_editor_prefix: "Use the CodeCombat" # level_editor_suffix: "to create and edit levels. Users have created levels for their classes, friends, hackathons, students, and siblings. If create a new level sounds intimidating you can start by forking one of ours!" @@ -535,65 +535,65 @@ module.exports = nativeDescription: "Deutsch (Österreich)", 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: -# main_title: "CodeCombat Editors" -# article_title: "Article Editor" -# thang_title: "Thang Editor" -# level_title: "Level Editor" + editor: + main_title: "CodeCombat Editoren" + article_title: "Artikel Editor" + thang_title: "Thang Editor" + level_title: "Level Editor" # achievement_title: "Achievement Editor" -# back: "Back" -# revert: "Revert" -# revert_models: "Revert Models" -# pick_a_terrain: "Pick A Terrain" -# small: "Small" + back: "Zurück" + revert: "Zurücksetzen" + revert_models: "Models zurücksetzen." + pick_a_terrain: "Wähle ein Terrain" + small: "Klein" # grassy: "Grassy" -# fork_title: "Fork New Version" -# fork_creating: "Creating Fork..." + fork_title: "Forke neue Version" + fork_creating: "Erzeuge Fork..." # randomize: "Randomize" -# more: "More" -# wiki: "Wiki" -# live_chat: "Live Chat" -# level_some_options: "Some Options?" -# level_tab_thangs: "Thangs" -# level_tab_scripts: "Scripts" -# level_tab_settings: "Settings" -# level_tab_components: "Components" -# level_tab_systems: "Systems" -# level_tab_thangs_title: "Current Thangs" -# level_tab_thangs_all: "All" -# level_tab_thangs_conditions: "Starting Conditions" -# level_tab_thangs_add: "Add Thangs" -# delete: "Delete" -# duplicate: "Duplicate" -# level_settings_title: "Settings" -# level_component_tab_title: "Current Components" -# level_component_btn_new: "Create New Component" -# level_systems_tab_title: "Current Systems" -# level_systems_btn_new: "Create New System" -# level_systems_btn_add: "Add System" -# level_components_title: "Back to All Thangs" -# level_components_type: "Type" -# level_component_edit_title: "Edit Component" -# level_component_config_schema: "Config Schema" -# level_component_settings: "Settings" -# level_system_edit_title: "Edit System" -# create_system_title: "Create New System" -# new_component_title: "Create New Component" -# new_component_field_system: "System" -# new_article_title: "Create a New Article" -# new_thang_title: "Create a New Thang Type" -# new_level_title: "Create a New Level" -# new_article_title_login: "Log In to Create a New Article" -# new_thang_title_login: "Log In to Create a New Thang Type" -# new_level_title_login: "Log In to Create a New Level" + more: "Mehr" + wiki: "Wiki" + live_chat: "Live Chat" + level_some_options: "Einige Einstellungsmöglichkeiten?" + level_tab_thangs: "Thangs" + level_tab_scripts: "Skripte" + level_tab_settings: "Einstellungen" + level_tab_components: "Komponenten" + level_tab_systems: "Systeme" + level_tab_thangs_title: "Aktuelle Thangs" + level_tab_thangs_all: "Alle" + level_tab_thangs_conditions: "Startbedingungen" + level_tab_thangs_add: "Thangs hinzufügen" + delete: "Löschen" + duplicate: "Duplizieren" + level_settings_title: "Einstellungen" + level_component_tab_title: "Aktuelle Komponenten" + level_component_btn_new: "neue Komponente erstellen" + level_systems_tab_title: "Aktuelle Systeme" + level_systems_btn_new: "neues System erstellen" + level_systems_btn_add: "System hinzufügen" + level_components_title: "Zurück zu allen Thangs" + level_components_type: "Typ" + level_component_edit_title: "Komponente bearbeiten" + level_component_config_schema: "Konfigurationsschema" + level_component_settings: "Einstellungen" + level_system_edit_title: "System bearbeiten" + create_system_title: "neues System erstellen" + new_component_title: "Neue Komponente erstellen" + new_component_field_system: "System" + new_article_title: "Erstelle einen neuen Artikel" + new_thang_title: "Erstelle einen neuen Thang-Typen" + new_level_title: "Erstelle ein neues Level" + new_article_title_login: "Melde dich an um einen neuen Artikel zu erstellen" + new_thang_title_login: "Melde dich an um einen neuen Thang-Typen zu erstellen" + new_level_title_login: "Melde dich an um ein neues Level zu erstellen" # new_achievement_title: "Create a New Achievement" # new_achievement_title_login: "Log In to Create a New Achievement" -# article_search_title: "Search Articles Here" -# thang_search_title: "Search Thang Types Here" -# level_search_title: "Search Levels Here" + article_search_title: "Durchsuche Artikel hier" + thang_search_title: "Durchsuche Thang-Typen hier" + level_search_title: "Durchsuche Levels hier" # achievement_search_title: "Search Achievements" # read_only_warning2: "Note: you can't save any edits here, because you're not logged in." # no_achievements: "No achievements have been added for this level yet." @@ -601,104 +601,104 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # achievement_query_goals: "Key achievement off of level goals" # level_completion: "Level Completion" -# article: -# edit_btn_preview: "Preview" -# edit_article_title: "Edit Article" + article: + edit_btn_preview: "Vorschau" + edit_article_title: "Artikel bearbeiten" -# general: -# and: "and" -# name: "Name" -# date: "Date" -# body: "Body" -# version: "Version" -# commit_msg: "Commit Message" -# version_history: "Version History" -# version_history_for: "Version History for: " -# result: "Result" -# results: "Results" -# description: "Description" -# or: "or" -# subject: "Subject" -# email: "Email" -# password: "Password" -# message: "Message" -# code: "Code" -# ladder: "Ladder" -# when: "When" -# opponent: "Opponent" -# rank: "Rank" -# score: "Score" -# win: "Win" -# loss: "Loss" -# tie: "Tie" -# easy: "Easy" -# medium: "Medium" -# hard: "Hard" -# player: "Player" + general: + and: "und" + name: "Name" + date: "Datum" + body: "Inhalt" + version: "Version" + commit_msg: "Commit Nachricht" + version_history: "Versionshistorie" + version_history_for: "Versionsgeschichte für: " + result: "Ergebnis" + results: "Ergebnisse" + description: "Beschreibung" + or: "oder" + subject: "Betreff" + email: "Email" + password: "Passwort" + message: "Nachricht" + code: "Code" + ladder: "Rangliste" + when: "Wann" + opponent: "Gegner" + rank: "Rang" + score: "Punktzahl" + win: "Sieg" + loss: "Niederlage" + tie: "Unentschieden" + easy: "Einfach" + medium: "Mittel" + hard: "Schwer" + player: "Spieler" -# about: -# who_is_codecombat: "Who is CodeCombat?" -# why_codecombat: "Why CodeCombat?" -# who_description_prefix: "together started CodeCombat in 2013. We also created " -# who_description_suffix: "in 2008, growing it to the #1 web and iOS application for learning to write Chinese and Japanese characters." -# who_description_ending: "Now it's time to teach people to write code." -# why_paragraph_1: "When making Skritter, George didn't know how to program and was constantly frustrated by his inability to implement his ideas. Afterwards, he tried learning, but the lessons were too slow. His housemate, wanting to reskill and stop teaching, tried Codecademy, but \"got bored.\" Each week another friend started Codecademy, then dropped off. We realized it was the same problem we'd solved with Skritter: people learning a skill via slow, intensive lessons when what they need is fast, extensive practice. We know how to fix that." -# why_paragraph_2: "Need to learn to code? You don't need lessons. You need to write a lot of code and have a great time doing it." -# why_paragraph_3_prefix: "That's what programming is about. It's gotta be fun. Not fun like" -# why_paragraph_3_italic: "yay a badge" -# why_paragraph_3_center: "but fun like" -# why_paragraph_3_italic_caps: "NO MOM I HAVE TO FINISH THE LEVEL!" -# why_paragraph_3_suffix: "That's why CodeCombat is a multiplayer game, not a gamified lesson course. We won't stop until you can't stop--but this time, that's a good thing." -# why_paragraph_4: "If you're going to get addicted to some game, get addicted to this one and become one of the wizards of the tech age." -# why_ending: "And hey, it's free. " -# why_ending_url: "Start wizarding now!" -# george_description: "CEO, business guy, web designer, game designer, and champion of beginning programmers everywhere." -# scott_description: "Programmer extraordinaire, software architect, kitchen wizard, and master of finances. Scott is the reasonable one." -# nick_description: "Programming wizard, eccentric motivation mage, and upside-down experimenter. Nick can do anything and chooses to build CodeCombat." -# jeremy_description: "Customer support mage, usability tester, and community organizer; you've probably already spoken with Jeremy." -# michael_description: "Programmer, sys-admin, and undergrad technical wunderkind, Michael is the person keeping our servers online." + about: + who_is_codecombat: "Wer ist CodeCombat?" + why_codecombat: "Warum CodeCombat?" + who_description_prefix: "gründeten CodeCombat im Jahre 2013 zusammen. Wir entwickelten außerdem " + who_description_suffix: ", die meist benutzte (#1) Web and iOS Applikation 2008 zum Lernen des Schreibens von chinesischen und japanischen Schriftzeichen." + who_description_ending: "Nun ist es an der Zeit, den Leuten das Programmieren beizubringen." + why_paragraph_1: "Als er Skritter machte, wusste George nicht wie man programmiert und war permanent darüber frustriert, dass er seine Ideen nicht umsetzen konnte. Danach versuchte er es zu lernen, aber das ging ihm zu langsam. Sein Mitbewohner versuchte Codecademy, als er sich umorientierte und aufhörte zu lehren, aber \"langweilte sich\". Jede Woche begann ein neuer Freund mit Codecademy und ließ es dann wieder bleiben. Wir erkannten, dass es das gleiche Problem war, welches wir mit Skritter gelöst hatten: Leute lernen eine Fähigkeit mittels langsamer, intersiver Lerneinheiten, wobei sie schnelle, umfassende Übung bräuchten. Wir kennen Abhilfe." + why_paragraph_2: "Programmieren lernen? Du brauchst keine Stunden. Du musst einen Haufen Code schreiben und dabei Spaß haben." + why_paragraph_3_prefix: "Darum geht's beim Programmieren. Es soll Spaß machen. Nicht so einen Spaß wie" + why_paragraph_3_italic: "jau, 'ne Plakette" + why_paragraph_3_center: "sondern Spaß wie" + why_paragraph_3_italic_caps: "NEIN MUTTI ICH MUSS NOCH DEN LEVEL BEENDEN !" + why_paragraph_3_suffix: "Deshalb ist CodeCombat ein Multiplayerspiel und kein spielähnlicher Kurs. Wir werden nicht aufhören bis du nicht mehr aufhören kannst -- nur diesmal ist das eine gute Sache." + why_paragraph_4: "Wenn dich Spiele süchtig machen, dass lass dich von diesem süchtig machen und werde ein Zauberer des Technologiezeitalters." + why_ending: "Und hey, es kostet nichts. " + why_ending_url: "Beginne jetzt zu zaubern!" + george_description: "CEO, Businesstyp, Web Designer, Game Designer und Champion der Programmieranfänger überall." + scott_description: "Außergewöhnlicher Programmierer, Softwarearchitekt, Küchenzauberer und Finanzmeister. Scott ist der Vernünftige." + nick_description: "Programmierzauberer, exzentrischer Motivationskünstler und Auf-den-Kopf-stell-Experimentierer. Nick könnte alles mögliche tun und entschied CodeCombat zu bauen." + jeremy_description: "Kundendienstmagier, Usability Tester und Community-Organisator. Wahrscheinlich hast du schon mit Jeremy gesprochen." + michael_description: "Programmierer, Systemadministrator und studentisch technisches Wunderkind, Michael hält unsere Server am Laufen." # matt_description: "Bicyclist, Software Engineer, reader of heroic fantasy, connoisseur of peanut butter, sipper of coffee." -# legal: -# page_title: "Legal" -# opensource_intro: "CodeCombat is free to play and completely open source." -# opensource_description_prefix: "Check out " -# github_url: "our GitHub" -# opensource_description_center: "and help out if you like! CodeCombat is built on dozens of open source projects, and we love them. See " -# archmage_wiki_url: "our Archmage wiki" -# opensource_description_suffix: "for a list of the software that makes this game possible." -# practices_title: "Respectful Best Practices" -# practices_description: "These are our promises to you, the player, in slightly less legalese." -# privacy_title: "Privacy" -# privacy_description: "We will not sell any of your personal information. We intend to make money through recruitment eventually, but rest assured we will not distribute your personal information to interested companies without your explicit consent." -# security_title: "Security" -# security_description: "We strive to keep your personal information safe. As an open source project, our site is freely open to anyone to review and improve our security systems." -# email_title: "Email" -# email_description_prefix: "We will not inundate you with spam. Through" -# email_settings_url: "your email settings" -# email_description_suffix: "or through links in the emails we send, you can change your preferences and easily unsubscribe at any time." -# cost_title: "Cost" -# cost_description: "Currently, CodeCombat is 100% free! One of our main goals is to keep it that way, so that as many people can play as possible, regardless of place in life. If the sky darkens, we might have to charge subscriptions or for some content, but we'd rather not. With any luck, we'll be able to sustain the company with:" -# recruitment_title: "Recruitment" -# recruitment_description_prefix: "Here on CodeCombat, you're going to become a powerful wizard–not just in the game, but also in real life." -# url_hire_programmers: "No one can hire programmers fast enough" -# recruitment_description_suffix: "so once you've sharpened your skills and if you agree, we will demo your best coding accomplishments to the thousands of employers who are drooling for the chance to hire you. They pay us a little, they pay you" -# recruitment_description_italic: "a lot" -# recruitment_description_ending: "the site remains free and everybody's happy. That's the plan." -# copyrights_title: "Copyrights and Licenses" + legal: + page_title: "Rechtliches" + opensource_intro: "CodeCombat ist Free-to-Play und vollständig Open Source." + opensource_description_prefix: "Schau dir " + github_url: "unsere GitHub-Seite" + opensource_description_center: " an und mach mit wenn Du möchtest! CodeCombat baut auf duzenden Open Source Projekten auf, und wir lieben sie. Schau dir die Liste in " + archmage_wiki_url: "unserem Erzmagier-Wiki" + opensource_description_suffix: " an, welche Software dieses Spiel möglich macht." + practices_title: "Best Practices" + practices_description: "Dies sind unsere Versprechen an dich, den Spieler, in weniger Fachchinesisch." + privacy_title: "Datenschutz" + privacy_description: "Wir werden deine persönlichen Daten nicht verkaufen. Letztenendes beabsichtigen wir, durch Vermittlung von Jobs zu verdienen, aber sei versichert, dass wir nicht deine persönlichen Daten ohne deine ausdrückliche Einwilligung interessierten Firmen zur Verfügung stellen werden." + security_title: "Datensicherheit" + security_description: "Wir streben an, deine persönlichen Daten sicher zu verwahren. Als Open Source Projekt ist unsere Site frei zugänglich für jedermann, auch um unsere Sicherheitsmaßnahmen in Augenschein zu nehmen und zu verbessern." + email_title: "Email" + email_description_prefix: "Wir werden dich nicht mit Spam überschwemmen. Mittels" + email_settings_url: "deiner Emaileinstellungen" + email_description_suffix: "oder durch von uns gesendete Links kannst du jederzeit deine Einstellungen ändern und Abonnements kündigen." + cost_title: "Kosten" + cost_description: "CodeCombat ist zur Zeit 100% kostenlos! Eines unserer Hauptziele ist, es dabei zu belassen, so dass es so viele Leute wie möglich spielen können, unabhängig davon in welcher Lebenssituation sie sich befinden. Falls dunkle Wolken aufziehen, könnten wir manche Inhalte im Rahmen eines Abonnements anbieten, aber lieber nicht. Mit etwas Glück können wir die Firma erhalten durch:" + recruitment_title: "Recruiting" + recruitment_description_prefix: "Hier bei CodeCombat kannst du ein mächtiger Zauberer werden, nicht nur im Spiel, sondern auch in der Realität." + url_hire_programmers: "Niemand kann schnell genug Programmierer einstellen." + 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 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" @@ -716,13 +716,13 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # rights_writings: "Writings" # rights_media: "Media (sounds, music) and any other creative content made specifically for that Level and not made generally available when creating Levels." # rights_clarification: "To clarify, anything that is made available in the Level Editor for the purpose of making levels is under CC, whereas the content created with the Level Editor or uploaded in the course of creation of Levels is not." -# nutshell_title: "In a Nutshell" + nutshell_title: "Zusammenfassung" # nutshell_description: "Any resources we provide in the Level Editor are free to use as you like for creating Levels. But we reserve the right to restrict distribution of the Levels themselves (that are created on codecombat.com) so that they may be charged for in the future, if that's what ends up happening." -# canonical: "The English version of this document is the definitive, canonical version. If there are any discrepencies between translations, the English document takes precedence." + canonical: "Die englische Version dieses Dokuments ist die definitive, kanonische Version. Sollte es Unterschiede zwischen den Übersetzungen geben, dann hat das englische Dokument Vorrang." -# contribute: + contribute: # page_title: "Contributing" -# character_classes_title: "Character Classes" + character_classes_title: "Charakter Klassen" # introduction_desc_intro: "We have high hopes for CodeCombat." # introduction_desc_pref: "We want to be where programmers of all stripes come to learn and play together, introduce others to the wonderful world of coding, and reflect the best parts of the community. We can't and don't want to do that alone; what makes projects like GitHub, Stack Overflow and Linux great are the people who use them and build on them. To that end, " # introduction_desc_github_url: "CodeCombat is totally open source" @@ -733,7 +733,7 @@ module.exports = nativeDescription: "Deutsch (Österreich)", 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." @@ -742,7 +742,7 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # join_desc_2: "to get started, and check the box below to mark yourself as a brave Archmage and get the latest news by email. Want to chat about what to do or how to get more deeply involved? " # join_desc_3: ", or find us in our " # join_desc_4: "and we'll go from there!" -# join_url_email: "Email us" + join_url_email: "Emaile uns" # join_url_hipchat: "public HipChat room" # more_about_archmage: "Learn More About Becoming an Archmage" # archmage_subscribe_desc: "Get emails on new coding opportunities and announcements." @@ -775,7 +775,7 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # scribe_introduction_url_mozilla: "Mozilla Developer Network" # scribe_introduction_suf: " has built. If your idea of fun is articulating the concepts of programming in Markdown form, then this class might be for you." # scribe_attribute_1: "Skill in words is pretty much all you need. Not only grammar and spelling, but able to convey complicated ideas to others." -# contact_us_url: "Contact us" + contact_us_url: "Kontaktiere uns" # scribe_join_description: "tell us a little about yourself, your experience with programming and what sort of things you'd like to write about. We'll go from there!" # more_about_scribe: "Learn More About Becoming a Scribe" # scribe_subscribe_desc: "Get emails about article writing announcements." @@ -798,44 +798,44 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # more_about_ambassador: "Learn More About Becoming an Ambassador" # ambassador_subscribe_desc: "Get emails on support updates and multiplayer developments." # changes_auto_save: "Changes are saved automatically when you toggle checkboxes." -# diligent_scribes: "Our Diligent Scribes:" -# powerful_archmages: "Our Powerful Archmages:" -# creative_artisans: "Our Creative Artisans:" -# brave_adventurers: "Our Brave Adventurers:" -# translating_diplomats: "Our Translating Diplomats:" -# helpful_ambassadors: "Our Helpful Ambassadors:" + diligent_scribes: "Unsere fleißgen Schreiber:" + powerful_archmages: "Unsere mächtigen Erzmagier:" + creative_artisans: "Unsere kreativen Handwerker:" + brave_adventurers: "Unsere mutigen Abenteurer:" + translating_diplomats: "Unsere übersetzenden Diplomaten:" + helpful_ambassadors: "Unsere hilfreichen Botschafter:" -# classes: -# archmage_title: "Archmage" -# archmage_title_description: "(Coder)" -# artisan_title: "Artisan" -# artisan_title_description: "(Level Builder)" -# adventurer_title: "Adventurer" -# adventurer_title_description: "(Level Playtester)" -# scribe_title: "Scribe" -# scribe_title_description: "(Article Editor)" -# diplomat_title: "Diplomat" -# diplomat_title_description: "(Translator)" -# ambassador_title: "Ambassador" -# ambassador_title_description: "(Support)" + classes: + archmage_title: "Erzmagier" + archmage_title_description: "(Programmierer)" + artisan_title: "Handwerker" + artisan_title_description: "(Level Entwickler)" + adventurer_title: "Abenteurer" + adventurer_title_description: "(Level Spieltester)" + scribe_title: "Schreiber" + scribe_title_description: "(Artikel Editor)" + diplomat_title: "Diplomat" + diplomat_title_description: "(Übersetzer)" + ambassador_title: "Botschafter" + ambassador_title_description: "(Support)" -# ladder: -# please_login: "Please log in first before playing a ladder game." -# my_matches: "My Matches" -# simulate: "Simulate" + ladder: + please_login: "Bitte logge dich zunächst ein, bevor du ein Ladder-Game spielst." + my_matches: "Meine Matches" + simulate: "Simuliere" # simulation_explanation: "By simulating games you can get your game ranked faster!" -# simulate_games: "Simulate Games!" + simulate_games: "Simuliere Spiele!" # simulate_all: "RESET AND SIMULATE GAMES" -# games_simulated_by: "Games simulated by you:" -# games_simulated_for: "Games simulated for you:" -# games_simulated: "Games simulated" -# games_played: "Games played" -# ratio: "Ratio" + games_simulated_by: "Spiele die durch dich simuliert worden:" + games_simulated_for: "Spiele die für dich simuliert worden:" + games_simulated: "simulierte Spiele" + games_played: "gespielte Spiele" + ratio: "Ratio" # leaderboard: "Leaderboard" # battle_as: "Battle as " -# summary_your: "Your " -# summary_matches: "Matches - " -# summary_wins: " Wins, " + summary_your: "Deine " + summary_matches: "Matches - " + summary_wins: " Siege, " # summary_losses: " Losses" # rank_no_code: "No New Code to Rank" # rank_my_game: "Rank My Game!" @@ -848,41 +848,41 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in." # no_ranked_matches_pre: "No ranked matches for the " # no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked." -# choose_opponent: "Choose an Opponent" + choose_opponent: "Wähle einen Gegner" # select_your_language: "Select your language!" -# tutorial_play: "Play Tutorial" -# tutorial_recommended: "Recommended if you've never played before" -# tutorial_skip: "Skip Tutorial" + tutorial_play: "Spiele Tutorial" + tutorial_recommended: "Empfohlen, wenn du noch nie zuvor gespielt hast." + tutorial_skip: "Überspringe Tutorial" # tutorial_not_sure: "Not sure what's going on?" -# tutorial_play_first: "Play the Tutorial first." -# simple_ai: "Simple AI" -# warmup: "Warmup" -# vs: "VS" -# friends_playing: "Friends Playing" -# log_in_for_friends: "Log in to play with your friends!" -# social_connect_blurb: "Connect and play against your friends!" + tutorial_play_first: "Spiele zuerst das Tutorial." + simple_ai: "Einfache KI" + warmup: "Aufwärmen" + vs: "VS" + friends_playing: "spielende Freunde" + log_in_for_friends: "Melde dich an um mit deinen Freunden zu spielen!" + social_connect_blurb: "Verbinde und spiele gegen deine Freunde!" # invite_friends_to_battle: "Invite your friends to join you in battle!" # fight: "Fight!" # watch_victory: "Watch your victory" # defeat_the: "Defeat the" -# tournament_ends: "Tournament ends" -# tournament_ended: "Tournament ended" -# tournament_rules: "Tournament Rules" + 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" # tournament_blurb_blog: "on our blog" -# rules: "Rules" -# winners: "Winners" + rules: "Regeln" + winners: "Gewinner" -# ladder_prizes: -# title: "Tournament Prizes" + ladder_prizes: + 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." -# blurb_4: "Two teams means double the prizes!" + blurb_4: "Zwei Teams heißt die doppelte Anzahl zu gewinnender Preise!" # blurb_5: "(There will be two first place winners, two second-place winners, etc.)" -# rank: "Rank" -# prizes: "Prizes" + rank: "Rang" + prizes: "Gewinne" # total_value: "Total Value" # in_cash: "in cash" # custom_wizard: "Custom CodeCombat Wizard" @@ -891,72 +891,72 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription: # credits: "credits" # one_month_coupon: "coupon: choose either Rails or HTML" # one_month_discount: "discount, 30% off: choose either Rails or HTML" -# license: "license" -# oreilly: "ebook of your choice" + license: "Lizenz" + oreilly: "Ebook deiner Wahl" -# loading_error: -# could_not_load: "Error loading from server" -# connection_failure: "Connection failed." -# unauthorized: "You need to be signed in. Do you have cookies disabled?" -# forbidden: "You do not have the permissions." -# not_found: "Not found." -# not_allowed: "Method not allowed." -# timeout: "Server timeout." -# conflict: "Resource conflict." -# bad_input: "Bad input." -# server_error: "Server error." -# unknown: "Unknown error." + loading_error: + could_not_load: "Fehler beim Laden vom Server" + connection_failure: "Verbindung fehlgeschlagen." + unauthorized: "Du musst angemeldet sein. Hast du Cookies ausgeschaltet?" + forbidden: "Sie haben nicht die nötigen Berechtigungen." + not_found: "Nicht gefunden." + not_allowed: "Methode nicht erlaubt." + timeout: "Server timeout." + conflict: "Resourcen Konflikt." + bad_input: "Falsche Eingabe." + server_error: "Server Fehler." + unknown: "Unbekannter Fehler." -# resources: -# your_sessions: "Your Sessions" -# level: "Level" -# social_network_apis: "Social Network APIs" -# facebook_status: "Facebook Status" -# facebook_friends: "Facebook Friends" -# facebook_friend_sessions: "Facebook Friend Sessions" -# gplus_friends: "G+ Friends" -# gplus_friend_sessions: "G+ Friend Sessions" + resources: + your_sessions: "Meine Sessions" + level: "Level" + social_network_apis: "Social Network APIs" + facebook_status: "Facebook Status" + facebook_friends: "Facebook Freunde" + facebook_friend_sessions: "Facebook Freunde Sessions" + gplus_friends: "G+ Freunde" + gplus_friend_sessions: "G+ Freunde Sessions" # leaderboard: "Leaderboard" -# user_schema: "User Schema" -# user_profile: "User Profile" + user_schema: "Benutzerschema" + user_profile: "Benutzerprofil" # patches: "Patches" # patched_model: "Source Document" -# model: "Model" -# system: "System" -# component: "Component" -# components: "Components" -# thang: "Thang" -# thangs: "Thangs" -# level_session: "Your Session" -# opponent_session: "Opponent Session" -# article: "Article" -# user_names: "User Names" -# thang_names: "Thang Names" -# files: "Files" -# top_simulators: "Top Simulators" + model: "Model" + system: "System" + component: "Komponente" + components: "Komponenten" + thang: "Thang" + thangs: "Thangs" + level_session: "Deine Session" + opponent_session: "Gegner-Session" + article: "Artikel" + user_names: "Benutzernamen" + thang_names: "Thang Namen" + files: "Dateien" + top_simulators: "Top Simulatoren" # source_document: "Source Document" -# document: "Document" -# sprite_sheet: "Sprite Sheet" -# candidate_sessions: "Candidate Sessions" -# user_remark: "User Remark" -# versions: "Versions" -# items: "Items" + document: "Dokument" + sprite_sheet: "Sprite Sheet" + candidate_sessions: "Kandidat-Sessions" + user_remark: "Benutzerkommentar" + versions: "Versionen" + items: "Gegenstände" -# delta: -# added: "Added" -# modified: "Modified" -# deleted: "Deleted" + delta: + added: "hinzugefügt" + modified: "modifiziert" + 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" diff --git a/app/locale/de-DE.coffee b/app/locale/de-DE.coffee index 7726401ad..ed5bed64e 100644 --- a/app/locale/de-DE.coffee +++ b/app/locale/de-DE.coffee @@ -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" diff --git a/app/locale/de.coffee b/app/locale/de.coffee index 91a105ded..ec1df6b59 100644 --- a/app/locale/de.coffee +++ b/app/locale/de.coffee @@ -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" From ee9e453896d1b66aabc45ef9e95741e67e5c7c24 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 27 Aug 2014 12:24:03 -0700 Subject: [PATCH 13/13] Fixed #828. Added many other minor refactorings. --- app/Router.coffee | 2 +- app/initialize.coffee | 6 +- app/lib/Angel.coffee | 2 +- app/lib/AudioPlayer.coffee | 2 +- app/lib/Bus.coffee | 8 +- app/lib/DefaultScripts.coffee | 4 +- app/lib/FacebookHandler.coffee | 10 +- app/lib/GPlusHandler.coffee | 6 +- app/lib/GitHubHandler.coffee | 4 +- app/lib/God.coffee | 2 +- app/lib/LevelBus.coffee | 25 +- app/lib/LinkedInHandler.coffee | 2 +- app/lib/auth.coffee | 4 +- app/lib/scripts/DOMScriptModule.coffee | 14 +- app/lib/scripts/GoalsScriptModule.coffee | 31 -- app/lib/scripts/PlaybackScriptModule.coffee | 5 +- app/lib/scripts/ScriptManager.coffee | 41 +-- app/lib/scripts/SoundScriptModule.coffee | 4 +- app/lib/scripts/SpriteScriptModule.coffee | 8 +- app/lib/scripts/SurfaceScriptModule.coffee | 8 +- app/lib/services/facebook.coffee | 7 +- app/lib/services/google.coffee | 4 +- app/lib/services/linkedin.coffee | 2 +- app/lib/surface/Camera.coffee | 12 +- app/lib/surface/CocoSprite.coffee | 20 +- app/lib/surface/CoordinateGrid.coffee | 2 +- app/lib/surface/DebugDisplay.coffee | 2 +- app/lib/surface/Dimmer.coffee | 6 +- app/lib/surface/IndieSprite.coffee | 4 +- app/lib/surface/Letterbox.coffee | 2 +- app/lib/surface/Mark.coffee | 2 +- app/lib/surface/MusicPlayer.coffee | 2 +- app/lib/surface/PointChooser.coffee | 3 +- app/lib/surface/RegionChooser.coffee | 2 +- app/lib/surface/SpriteBoss.coffee | 16 +- app/lib/surface/Surface.coffee | 33 +- app/lib/surface/WizardSprite.coffee | 13 +- app/models/CocoModel.coffee | 2 +- app/schemas/models/level.coffee | 2 +- app/schemas/subscriptions/app.coffee | 45 --- app/schemas/subscriptions/auth.coffee | 39 ++ app/schemas/subscriptions/bus.coffee | 84 ++--- app/schemas/subscriptions/editor.coffee | 95 ++--- app/schemas/subscriptions/errors.coffee | 6 +- app/schemas/subscriptions/god.coffee | 53 +++ app/schemas/subscriptions/misc.coffee | 38 +- app/schemas/subscriptions/play.coffee | 308 +++++++--------- app/schemas/subscriptions/scripts.coffee | 27 ++ app/schemas/subscriptions/surface.coffee | 220 ++++++++---- app/schemas/subscriptions/tome.coffee | 332 +++++------------- app/schemas/subscriptions/user.coffee | 9 - app/schemas/subscriptions/world.coffee | 18 - app/styles/base.sass | 8 + .../editor/article/ArticleEditView.coffee | 4 +- app/views/editor/level/LevelEditView.coffee | 14 +- .../level/components/ComponentsTabView.coffee | 12 +- .../components/LevelComponentEditView.coffee | 9 +- .../components/NewLevelComponentModal.coffee | 5 +- .../level/modals/TerrainRandomizeModal.coffee | 24 +- .../level/modals/WorldSelectModal.coffee | 4 +- .../level/scripts/ScriptsTabView.coffee | 6 +- .../level/settings/SettingsTabView.coffee | 4 +- .../level/systems/LevelSystemEditView.coffee | 9 +- .../level/systems/NewLevelSystemModal.coffee | 2 +- .../level/systems/SystemsTabView.coffee | 18 +- .../level/thangs/LevelThangEditView.coffee | 7 +- .../editor/level/thangs/ThangsTabView.coffee | 21 +- .../editor/thang/ThangTypeEditView.coffee | 4 +- app/views/game-menu/ChooseHeroView.coffee | 2 +- app/views/game-menu/OptionsView.coffee | 4 +- app/views/kinds/CocoView.coffee | 6 +- app/views/kinds/RootView.coffee | 4 +- app/views/modal/AuthModal.coffee | 8 +- app/views/modal/EmployerSignupModal.coffee | 4 +- app/views/modal/RecoverModal.coffee | 2 +- app/views/modal/SaveVersionModal.coffee | 4 +- app/views/play/SpectateView.coffee | 169 +-------- app/views/play/ladder/LadderTabView.coffee | 8 +- app/views/play/ladder/MyMatchesTabView.coffee | 4 +- app/views/play/level/ControlBarView.coffee | 2 +- app/views/play/level/LevelChatView.coffee | 2 +- app/views/play/level/LevelGoalsView.coffee | 2 +- app/views/play/level/LevelGoldView.coffee | 4 +- app/views/play/level/LevelHUDView.coffee | 16 +- app/views/play/level/LevelLoadingView.coffee | 2 +- app/views/play/level/LevelPlaybackView.coffee | 42 +-- app/views/play/level/PlayLevelView.coffee | 62 ++-- .../play/level/modal/InfiniteLoopModal.coffee | 6 +- .../play/level/modal/LevelGuideModal.coffee | 4 +- .../play/level/modal/VictoryModal.coffee | 7 +- .../play/level/tome/CastButtonView.coffee | 6 +- .../play/level/tome/ProblemAlertView.coffee | 2 +- .../play/level/tome/SpellDebugView.coffee | 8 +- .../tome/SpellListEntryThangsView.coffee | 2 +- .../play/level/tome/SpellListEntryView.coffee | 6 +- .../level/tome/SpellListTabEntryView.coffee | 10 +- .../play/level/tome/SpellPaletteView.coffee | 4 +- .../play/level/tome/SpellToolbarView.coffee | 6 +- app/views/play/level/tome/SpellView.coffee | 36 +- .../play/level/tome/ThangListEntryView.coffee | 10 +- app/views/play/level/tome/TomeView.coffee | 2 +- app/views/user/JobProfileView.coffee | 2 +- bower.json | 2 +- test/app/lib/FacebookHandler.spec.coffee | 2 +- test/app/lib/ScriptManager.spec.coffee | 4 +- 105 files changed, 911 insertions(+), 1304 deletions(-) delete mode 100644 app/lib/scripts/GoalsScriptModule.coffee delete mode 100644 app/schemas/subscriptions/app.coffee create mode 100644 app/schemas/subscriptions/auth.coffee create mode 100644 app/schemas/subscriptions/god.coffee create mode 100644 app/schemas/subscriptions/scripts.coffee delete mode 100644 app/schemas/subscriptions/user.coffee delete mode 100644 app/schemas/subscriptions/world.coffee diff --git a/app/Router.coffee b/app/Router.coffee index 9788b66c6..58f93b3b5 100644 --- a/app/Router.coffee +++ b/app/Router.coffee @@ -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: diff --git a/app/initialize.coffee b/app/initialize.coffee index a27c1f7a2..11921b81b 100644 --- a/app/initialize.coffee +++ b/app/initialize.coffee @@ -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' diff --git a/app/lib/Angel.coffee b/app/lib/Angel.coffee index 3e7a8efce..84a5dbf80 100644 --- a/app/lib/Angel.coffee +++ b/app/lib/Angel.coffee @@ -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! diff --git a/app/lib/AudioPlayer.coffee b/app/lib/AudioPlayer.coffee index b0039cc25..8f752a226 100644 --- a/app/lib/AudioPlayer.coffee +++ b/app/lib/AudioPlayer.coffee @@ -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() diff --git a/app/lib/Bus.coffee b/app/lib/Bus.coffee index a79f6a67c..cd52e5f4d 100644 --- a/app/lib/Bus.coffee +++ b/app/lib/Bus.coffee @@ -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) diff --git a/app/lib/DefaultScripts.coffee b/app/lib/DefaultScripts.coffee index c1dd80277..8fbd50439 100644 --- a/app/lib/DefaultScripts.coffee +++ b/app/lib/DefaultScripts.coffee @@ -11,7 +11,7 @@ module.exports = [ scriptPrereqs: ["Introduction"] } { - channel: "level-set-playing" + channel: "level:set-playing" noteChain: [] scriptPrereqs: ["Victory Playback"] id: "Victory Playback Started" @@ -22,4 +22,4 @@ module.exports = [ scriptPrereqs: ["Victory Playback Started"] id: "Show Victory" } -] \ No newline at end of file +] diff --git a/app/lib/FacebookHandler.coffee b/app/lib/FacebookHandler.coffee index 61553d946..808a3acbf 100644 --- a/app/lib/FacebookHandler.coffee +++ b/app/lib/FacebookHandler.coffee @@ -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({ diff --git a/app/lib/GPlusHandler.coffee b/app/lib/GPlusHandler.coffee index 997a25ab4..7abf8878b 100644 --- a/app/lib/GPlusHandler.coffee +++ b/app/lib/GPlusHandler.coffee @@ -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() diff --git a/app/lib/GitHubHandler.coffee b/app/lib/GitHubHandler.coffee index 1ae7bd8c0..b0679c080 100644 --- a/app/lib/GitHubHandler.coffee +++ b/app/lib/GitHubHandler.coffee @@ -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 diff --git a/app/lib/God.coffee b/app/lib/God.coffee index 8d1b90228..8574aff99 100644 --- a/app/lib/God.coffee +++ b/app/lib/God.coffee @@ -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 diff --git a/app/lib/LevelBus.coffee b/app/lib/LevelBus.coffee index 6fc3816e7..daaa779c8 100644 --- a/app/lib/LevelBus.coffee +++ b/app/lib/LevelBus.coffee @@ -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) diff --git a/app/lib/LinkedInHandler.coffee b/app/lib/LinkedInHandler.coffee index 2a6be9a9e..a1a7d0b5a 100644 --- a/app/lib/LinkedInHandler.coffee +++ b/app/lib/LinkedInHandler.coffee @@ -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 diff --git a/app/lib/auth.coffee b/app/lib/auth.coffee index 6d218608d..18cf4f661 100644 --- a/app/lib/auth.coffee +++ b/app/lib/auth.coffee @@ -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 diff --git a/app/lib/scripts/DOMScriptModule.coffee b/app/lib/scripts/DOMScriptModule.coffee index 041dbcc7c..ca87988c7 100644 --- a/app/lib/scripts/DOMScriptModule.coffee +++ b/app/lib/scripts/DOMScriptModule.coffee @@ -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}} diff --git a/app/lib/scripts/GoalsScriptModule.coffee b/app/lib/scripts/GoalsScriptModule.coffee deleted file mode 100644 index 0e6737b92..000000000 --- a/app/lib/scripts/GoalsScriptModule.coffee +++ /dev/null @@ -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 diff --git a/app/lib/scripts/PlaybackScriptModule.coffee b/app/lib/scripts/PlaybackScriptModule.coffee index 40487be16..fb0543629 100644 --- a/app/lib/scripts/PlaybackScriptModule.coffee +++ b/app/lib/scripts/PlaybackScriptModule.coffee @@ -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 - diff --git a/app/lib/scripts/ScriptManager.coffee b/app/lib/scripts/ScriptManager.coffee index 6983ac199..9892e0201 100644 --- a/app/lib/scripts/ScriptManager.coffee +++ b/app/lib/scripts/ScriptManager.coffee @@ -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 diff --git a/app/lib/scripts/SoundScriptModule.coffee b/app/lib/scripts/SoundScriptModule.coffee index 616c07f88..ce8d54661 100644 --- a/app/lib/scripts/SoundScriptModule.coffee +++ b/app/lib/scripts/SoundScriptModule.coffee @@ -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 diff --git a/app/lib/scripts/SpriteScriptModule.coffee b/app/lib/scripts/SpriteScriptModule.coffee index bff0d3c28..7a61ff474 100644 --- a/app/lib/scripts/SpriteScriptModule.coffee +++ b/app/lib/scripts/SpriteScriptModule.coffee @@ -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] diff --git a/app/lib/scripts/SurfaceScriptModule.coffee b/app/lib/scripts/SurfaceScriptModule.coffee index d6c3b3016..3f95e3f9b 100644 --- a/app/lib/scripts/SurfaceScriptModule.coffee +++ b/app/lib/scripts/SurfaceScriptModule.coffee @@ -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} } diff --git a/app/lib/services/facebook.coffee b/app/lib/services/facebook.coffee index e4e08d52d..5114ba2a1 100644 --- a/app/lib/services/facebook.coffee +++ b/app/lib/services/facebook.coffee @@ -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) -> diff --git a/app/lib/services/google.coffee b/app/lib/services/google.coffee index 0e470a375..bda5d1d24 100644 --- a/app/lib/services/google.coffee +++ b/app/lib/services/google.coffee @@ -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') diff --git a/app/lib/services/linkedin.coffee b/app/lib/services/linkedin.coffee index 9134d77bb..7c1a22a63 100644 --- a/app/lib/services/linkedin.coffee +++ b/app/lib/services/linkedin.coffee @@ -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 = '' diff --git a/app/lib/surface/Camera.coffee b/app/lib/surface/Camera.coffee index 4a65f52db..d359561cc 100644 --- a/app/lib/surface/Camera.coffee +++ b/app/lib/surface/Camera.coffee @@ -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 diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index 711b0cca0..23e16cec8 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -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 @@ -680,7 +677,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass sound = e.sound ? AudioPlayer.soundForDialogue e.message, @thangType.get 'soundTriggers' @dialogueSoundInstance?.stop() if @dialogueSoundInstance = @playSound sound, false - @dialogueSoundInstance.addEventListener 'complete', -> Backbone.Mediator.publish 'dialogue-sound-completed' + @dialogueSoundInstance.addEventListener 'complete', -> Backbone.Mediator.publish 'sprite:dialogue-sound-completed', {} @notifySpeechUpdated e onClearDialogue: (e) -> @@ -688,6 +685,9 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass @dialogueSoundInstance?.stop() @notifySpeechUpdated {} + onSetLetterbox: (e) -> + @letterboxOn = e.on + setNameLabel: (name) -> label = @addLabel 'name', Label.STYLE_NAME label.setText name @@ -750,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? diff --git a/app/lib/surface/CoordinateGrid.coffee b/app/lib/surface/CoordinateGrid.coffee index 1d796ada2..113731141 100644 --- a/app/lib/surface/CoordinateGrid.coffee +++ b/app/lib/surface/CoordinateGrid.coffee @@ -2,7 +2,7 @@ CocoClass = require 'lib/CocoClass' module.exports = class CoordinateGrid extends CocoClass subscriptions: - 'level-toggle-grid': 'onToggleGrid' + 'level:toggle-grid': 'onToggleGrid' shortcuts: 'ctrl+g, ⌘+g': 'onToggleGrid' diff --git a/app/lib/surface/DebugDisplay.coffee b/app/lib/surface/DebugDisplay.coffee index da287e6ed..cb4eee996 100644 --- a/app/lib/surface/DebugDisplay.coffee +++ b/app/lib/surface/DebugDisplay.coffee @@ -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() diff --git a/app/lib/surface/Dimmer.coffee b/app/lib/surface/Dimmer.coffee index a34740468..2d902fb0f 100644 --- a/app/lib/surface/Dimmer.coffee +++ b/app/lib/surface/Dimmer.coffee @@ -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' diff --git a/app/lib/surface/IndieSprite.coffee b/app/lib/surface/IndieSprite.coffee index a914a96fb..833b360e2 100644 --- a/app/lib/surface/IndieSprite.coffee +++ b/app/lib/surface/IndieSprite.coffee @@ -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 diff --git a/app/lib/surface/Letterbox.coffee b/app/lib/surface/Letterbox.coffee index 1e829d3df..a29815e48 100644 --- a/app/lib/surface/Letterbox.coffee +++ b/app/lib/surface/Letterbox.coffee @@ -1,6 +1,6 @@ module.exports = class Letterbox extends createjs.Container subscriptions: - 'level-set-letterbox': 'onSetLetterbox' + 'level:set-letterbox': 'onSetLetterbox' constructor: (options) -> super() diff --git a/app/lib/surface/Mark.coffee b/app/lib/surface/Mark.coffee index bce9d84be..b730cabd8 100644 --- a/app/lib/surface/Mark.coffee +++ b/app/lib/surface/Mark.coffee @@ -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 diff --git a/app/lib/surface/MusicPlayer.coffee b/app/lib/surface/MusicPlayer.coffee index e01f32372..4d3e8b47d 100644 --- a/app/lib/surface/MusicPlayer.coffee +++ b/app/lib/surface/MusicPlayer.coffee @@ -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: -> diff --git a/app/lib/surface/PointChooser.coffee b/app/lib/surface/PointChooser.coffee index 88c61db98..16bacd5c6 100644 --- a/app/lib/surface/PointChooser.coffee +++ b/app/lib/surface/PointChooser.coffee @@ -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 diff --git a/app/lib/surface/RegionChooser.coffee b/app/lib/surface/RegionChooser.coffee index 3b15ec4f7..c5147b25c 100644 --- a/app/lib/surface/RegionChooser.coffee +++ b/app/lib/surface/RegionChooser.coffee @@ -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 diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index c7e22b56c..1a912b555 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -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' @@ -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 diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index 9ba6ab0b6..73fef4d89 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -52,19 +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-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' @@ -127,7 +127,7 @@ module.exports = Surface = class Surface extends CocoClass @showLevel() @updateState true if @loaded @onFrameChanged() - Backbone.Mediator.publish 'surface:world-set-up' + Backbone.Mediator.publish 'surface:world-set-up', {world: @world} onTogglePathFinding: (e) -> e?.preventDefault?() @@ -311,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 @@ -321,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 @@ -368,7 +367,7 @@ module.exports = Surface = class Surface extends CocoClass # 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) @@ -450,11 +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() createjs.Ticker.addEventListener 'tick', @tick - Backbone.Mediator.publish 'level:started' + Backbone.Mediator.publish 'level:started', {} createOpponentWizard: (opponent) -> @spriteBoss.createOpponentWizard opponent @@ -464,7 +462,7 @@ module.exports = Surface = class Surface extends CocoClass 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 @@ -488,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 diff --git a/app/lib/surface/WizardSprite.coffee b/app/lib/surface/WizardSprite.coffee index e0cb356f1..c577dae28 100644 --- a/app/lib/surface/WizardSprite.coffee +++ b/app/lib/surface/WizardSprite.coffee @@ -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 diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index 759505283..952d807e6 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -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 diff --git a/app/schemas/models/level.coffee b/app/schemas/models/level.coffee index 2fa229ee1..7a8fd713c 100644 --- a/app/schemas/models/level.coffee +++ b/app/schemas/models/level.coffee @@ -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'} diff --git a/app/schemas/subscriptions/app.coffee b/app/schemas/subscriptions/app.coffee deleted file mode 100644 index f107935c4..000000000 --- a/app/schemas/subscriptions/app.coffee +++ /dev/null @@ -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'] diff --git a/app/schemas/subscriptions/auth.coffee b/app/schemas/subscriptions/auth.coffee new file mode 100644 index 000000000..2c19aac0c --- /dev/null +++ b/app/schemas/subscriptions/auth.coffee @@ -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 {} diff --git a/app/schemas/subscriptions/bus.coffee b/app/schemas/subscriptions/bus.coffee index 72bdd6b07..f56c18170 100644 --- a/app/schemas/subscriptions/bus.coffee +++ b/app/schemas/subscriptions/bus.coffee @@ -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'} diff --git a/app/schemas/subscriptions/editor.coffee b/app/schemas/subscriptions/editor.coffee index b75649c9e..04ee81e13 100644 --- a/app/schemas/subscriptions/editor.coffee +++ b/app/schemas/subscriptions/editor.coffee @@ -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'} diff --git a/app/schemas/subscriptions/errors.coffee b/app/schemas/subscriptions/errors.coffee index 598dfc6d9..c50c4fe20 100644 --- a/app/schemas/subscriptions/errors.coffee +++ b/app/schemas/subscriptions/errors.coffee @@ -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'} diff --git a/app/schemas/subscriptions/god.coffee b/app/schemas/subscriptions/god.coffee new file mode 100644 index 000000000..5a8f0f09f --- /dev/null +++ b/app/schemas/subscriptions/god.coffee @@ -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'} diff --git a/app/schemas/subscriptions/misc.coffee b/app/schemas/subscriptions/misc.coffee index 439464851..bb41e1e7a 100644 --- a/app/schemas/subscriptions/misc.coffee +++ b/app/schemas/subscriptions/misc.coffee @@ -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'} diff --git a/app/schemas/subscriptions/play.coffee b/app/schemas/subscriptions/play.coffee index ee52d5fd3..3575cc1fc 100644 --- a/app/schemas/subscriptions/play.coffee +++ b/app/schemas/subscriptions/play.coffee @@ -1,203 +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:restarted': - {} # TODO schema + 'level:restart': c.object {} - 'level-set-volume': - {} # TODO schema + 'level:restarted': c.object {} - 'level-set-time': - {} # TODO schema + 'level:set-volume': c.object {required: ['volume']}, + volume: {type: 'number', minimum: 0, maximum: 1} - 'level-select-sprite': - {} # 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-set-playing': - {} # TODO schema + 'level:select-sprite': c.object {}, + thangID: {type: ['string', 'null', 'undefined']} + spellName: {type: ['string', 'null', 'undefined']} - 'level:team-set': - {} # TODO schema + 'level:set-playing': c.object {required: ['playing']}, + playing: {type: 'boolean'} - 'level:docs-shown': {} + 'level:team-set': c.object {required: ['team']}, + team: c.shortString() - 'level:docs-hidden': {} + 'level:docs-shown': c.object {} - 'level:victory-hidden': - {} # TODO schema + 'level:docs-hidden': c.object {} - '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-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-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 {} diff --git a/app/schemas/subscriptions/scripts.coffee b/app/schemas/subscriptions/scripts.coffee new file mode 100644 index 000000000..75bfa3fbc --- /dev/null +++ b/app/schemas/subscriptions/scripts.coffee @@ -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 {} diff --git a/app/schemas/subscriptions/surface.coffee b/app/schemas/subscriptions/surface.coffee index ee3b98458..22b59643a 100644 --- a/app/schemas/subscriptions/surface.coffee +++ b/app/schemas/subscriptions/surface.coffee @@ -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'} diff --git a/app/schemas/subscriptions/tome.coffee b/app/schemas/subscriptions/tome.coffee index a582156e1..f79cb62b5 100644 --- a/app/schemas/subscriptions/tome.coffee +++ b/app/schemas/subscriptions/tome.coffee @@ -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'} diff --git a/app/schemas/subscriptions/user.coffee b/app/schemas/subscriptions/user.coffee deleted file mode 100644 index b9ae1e4c0..000000000 --- a/app/schemas/subscriptions/user.coffee +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = - 'me:synced': - {} # TODO schema - - 'user-fetched': - {} # TODO schema - - 'edit-wizard-settings': - {} # TODO schema diff --git a/app/schemas/subscriptions/world.coffee b/app/schemas/subscriptions/world.coffee deleted file mode 100644 index 0eb748c5e..000000000 --- a/app/schemas/subscriptions/world.coffee +++ /dev/null @@ -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 diff --git a/app/styles/base.sass b/app/styles/base.sass index a00d037ee..443073605 100644 --- a/app/styles/base.sass +++ b/app/styles/base.sass @@ -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 diff --git a/app/views/editor/article/ArticleEditView.coffee b/app/views/editor/article/ArticleEditView.coffee index a61f19b2e..420c44356 100644 --- a/app/views/editor/article/ArticleEditView.coffee +++ b/app/views/editor/article/ArticleEditView.coffee @@ -15,7 +15,7 @@ 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 @@ -98,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', {} diff --git a/app/views/editor/level/LevelEditView.coffee b/app/views/editor/level/LevelEditView.coffee index 7dd827254..567dd6d54 100644 --- a/app/views/editor/level/LevelEditView.coffee +++ b/app/views/editor/level/LevelEditView.coffee @@ -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') diff --git a/app/views/editor/level/components/ComponentsTabView.coffee b/app/views/editor/level/components/ComponentsTabView.coffee index 3cfb953b8..4507184ec 100644 --- a/app/views/editor/level/components/ComponentsTabView.coffee +++ b/app/views/editor/level/components/ComponentsTabView.coffee @@ -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 diff --git a/app/views/editor/level/components/LevelComponentEditView.coffee b/app/views/editor/level/components/LevelComponentEditView.coffee index c09600241..67fba26d1 100644 --- a/app/views/editor/level/components/LevelComponentEditView.coffee +++ b/app/views/editor/level/components/LevelComponentEditView.coffee @@ -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') diff --git a/app/views/editor/level/components/NewLevelComponentModal.coffee b/app/views/editor/level/components/NewLevelComponentModal.coffee index c4ead45de..a65b5c921 100644 --- a/app/views/editor/level/components/NewLevelComponentModal.coffee +++ b/app/views/editor/level/components/NewLevelComponentModal.coffee @@ -13,12 +13,12 @@ module.exports = class NewLevelComponentModal extends ModalView events: 'click #new-level-component-submit': 'makeNewLevelComponent' 'submit form': 'makeNewLevelComponent' - + getRenderData: -> c = super() c.systems = LevelComponent.schema.properties.system.enum c - + makeNewLevelComponent: (e) -> e.preventDefault() system = @$el.find('#level-component-system').val() @@ -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() diff --git a/app/views/editor/level/modals/TerrainRandomizeModal.coffee b/app/views/editor/level/modals/TerrainRandomizeModal.coffee index 7dc37d7c8..fa6da998a 100644 --- a/app/views/editor/level/modals/TerrainRandomizeModal.coffee +++ b/app/views/editor/level/modals/TerrainRandomizeModal.coffee @@ -102,7 +102,7 @@ presets = { 'width': [8, 12] 'height': [8, 12] 'numBarrels': [4,6] - 'cluster': 'barrel' + 'cluster': 'barrel' } 'cave': { 'num':[1,1] @@ -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) -> @@ -272,29 +270,29 @@ module.exports = class TerrainRandomizeModal extends ModalView @addThang { 'id': @getRandomThang(clusters[preset.borders].thangs) 'pos': { - 'x': i + preset.borderSize/2 + 'x': i + preset.borderSize/2 'y': presetSize.y - 3 * preset.borderSize/2 } 'margin': clusters[preset.borders].margin - } + } if ( i / preset.borderSize ) % 2 and i isnt presetSize.x - thangSizes.borderSize.x @addThang { 'id': @getRandomThang(clusters['torch'].thangs) 'pos': { - 'x': i + preset.borderSize + 'x': i + preset.borderSize 'y': presetSize.y - preset.borderSize } 'margin': clusters['torch'].margin - } + } else if ( i / preset.borderSize ) % 2 is 0 and i and _.random(100) < 30 @addThang { 'id': @getRandomThang(clusters['chains'].thangs) 'pos': { - 'x': i + preset.borderSize + 'x': i + preset.borderSize 'y': presetSize.y - preset.borderSize } 'margin': clusters['chains'].margin - } + } for i in _.range(0, presetSize.y, thangSizes.borderSize.y) for j in _.range(preset.borderThickness) @@ -395,7 +393,7 @@ module.exports = class TerrainRandomizeModal extends ModalView 'pos': { 'x': thang.pos.x - preset.borderSize / 2 'y': thang.pos.y + preset.borderSize / 2 - } + } 'margin': clusters['torch'].margin } @@ -415,7 +413,7 @@ module.exports = class TerrainRandomizeModal extends ModalView for t in _.range(0, roomThickness) for i in _.range(rect.y - rect.height/2 - t * preset.borderSize, rect.y + rect.height/2 + (t+1) * preset.borderSize, preset.borderSize) - # Left wall + # Left wall @addThang { 'id': @getRandomThang(clusters[room.cluster].thangs) 'pos': { @@ -425,7 +423,7 @@ module.exports = class TerrainRandomizeModal extends ModalView 'margin': clusters[room.cluster].margin } - # Right wall + # Right wall @addThang { 'id': @getRandomThang(clusters[room.cluster].thangs) 'pos': { diff --git a/app/views/editor/level/modals/WorldSelectModal.coffee b/app/views/editor/level/modals/WorldSelectModal.coffee index 4274a76ec..38ba12fc6 100644 --- a/app/views/editor/level/modals/WorldSelectModal.coffee +++ b/app/views/editor/level/modals/WorldSelectModal.coffee @@ -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' diff --git a/app/views/editor/level/scripts/ScriptsTabView.coffee b/app/views/editor/level/scripts/ScriptsTabView.coffee index cf412a649..a7f066be0 100644 --- a/app/views/editor/level/scripts/ScriptsTabView.coffee +++ b/app/views/editor/level/scripts/ScriptsTabView.coffee @@ -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 @@ -133,7 +133,7 @@ class ScriptNode extends TreemaObjectNode onDeletePressed: (e) -> returnVal = super(e) if @callbacks.removeChild - @callbacks.removeChild() + @callbacks.removeChild() returnVal onRightArrowPressed: -> @@ -159,7 +159,7 @@ class EventPropsNode extends TreemaNode.nodeMap.string joined = '(unset)' if not joined.length @buildValueForDisplaySimply valEl, joined - buildValueForEditing: (valEl) -> + buildValueForEditing: (valEl) -> super(valEl) channel = @getRoot().data.channel channelSchema = Backbone.Mediator.channelSchemas[channel] diff --git a/app/views/editor/level/settings/SettingsTabView.coffee b/app/views/editor/level/settings/SettingsTabView.coffee index cf2c57196..dabca773a 100644 --- a/app/views/editor/level/settings/SettingsTabView.coffee +++ b/app/views/editor/level/settings/SettingsTabView.coffee @@ -17,7 +17,7 @@ module.exports = class SettingsTabView extends CocoView ] subscriptions: - 'level-loaded': 'onLevelLoaded' + 'editor:level-loaded': 'onLevelLoaded' constructor: (options) -> super options @@ -56,4 +56,4 @@ module.exports = class SettingsTabView extends CocoView @level.set key, @settingsTreema.data[key] class SettingsNode extends TreemaObjectNode - nodeDescription: 'Settings' \ No newline at end of file + nodeDescription: 'Settings' diff --git a/app/views/editor/level/systems/LevelSystemEditView.coffee b/app/views/editor/level/systems/LevelSystemEditView.coffee index b1bcf8f67..455cf13ca 100644 --- a/app/views/editor/level/systems/LevelSystemEditView.coffee +++ b/app/views/editor/level/systems/LevelSystemEditView.coffee @@ -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?' diff --git a/app/views/editor/level/systems/NewLevelSystemModal.coffee b/app/views/editor/level/systems/NewLevelSystemModal.coffee index d2f509dbf..dd66343f9 100644 --- a/app/views/editor/level/systems/NewLevelSystemModal.coffee +++ b/app/views/editor/level/systems/NewLevelSystemModal.coffee @@ -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() diff --git a/app/views/editor/level/systems/SystemsTabView.coffee b/app/views/editor/level/systems/SystemsTabView.coffee index 89fa16bf1..2ade6d0bd 100644 --- a/app/views/editor/level/systems/SystemsTabView.coffee +++ b/app/views/editor/level/systems/SystemsTabView.coffee @@ -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 diff --git a/app/views/editor/level/thangs/LevelThangEditView.coffee b/app/views/editor/level/thangs/LevelThangEditView.coffee index 7ed5dce9e..a7c6e1f9f 100644 --- a/app/views/editor/level/thangs/LevelThangEditView.coffee +++ b/app/views/editor/level/thangs/LevelThangEditView.coffee @@ -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' diff --git a/app/views/editor/level/thangs/ThangsTabView.coffee b/app/views/editor/level/thangs/ThangsTabView.coffee index ee7954d58..2ca8211e5 100644 --- a/app/views/editor/level/thangs/ThangsTabView.coffee +++ b/app/views/editor/level/thangs/ThangsTabView.coffee @@ -34,15 +34,15 @@ module.exports = class ThangsTabView extends CocoView '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' @@ -232,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 @@ -402,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) => @@ -449,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() @@ -530,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 diff --git a/app/views/editor/thang/ThangTypeEditView.coffee b/app/views/editor/thang/ThangTypeEditView.coffee index 1522ddeb5..e54bb9274 100644 --- a/app/views/editor/thang/ThangTypeEditView.coffee +++ b/app/views/editor/thang/ThangTypeEditView.coffee @@ -44,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 @@ -438,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' diff --git a/app/views/game-menu/ChooseHeroView.coffee b/app/views/game-menu/ChooseHeroView.coffee index 8568877e9..88632e1c4 100644 --- a/app/views/game-menu/ChooseHeroView.coffee +++ b/app/views/game-menu/ChooseHeroView.coffee @@ -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) diff --git a/app/views/game-menu/OptionsView.coffee b/app/views/game-menu/OptionsView.coffee index e1bd2c53e..f2cf46b2e 100644 --- a/app/views/game-menu/OptionsView.coffee +++ b/app/views/game-menu/OptionsView.coffee @@ -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') diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index a562621dd..eb6d4859f 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -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 @@ -268,7 +268,7 @@ module.exports = class CocoView extends Backbone.View view.parentKey = key @subviews[key] = view view - + makeSubViewKey: (view) -> key = view.id or (view.constructor.name+classCount++) key = _.string.underscored(key) # handy for autocomplete in dev console diff --git a/app/views/kinds/RootView.coffee b/app/views/kinds/RootView.coffee index 59603ccd1..e44b3b0ba 100644 --- a/app/views/kinds/RootView.coffee +++ b/app/views/kinds/RootView.coffee @@ -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) diff --git a/app/views/modal/AuthModal.coffee b/app/views/modal/AuthModal.coffee index fd87dd988..67abf2537 100644 --- a/app/views/modal/AuthModal.coffee +++ b/app/views/modal/AuthModal.coffee @@ -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 @@ -39,7 +39,7 @@ module.exports = class AuthModal extends ModalView c.onEmployersPage = Backbone.history.fragment is "employers" c.me = me c - + afterInsert: -> super() _.delay application.router.renderLoginButtons, 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', {} diff --git a/app/views/modal/EmployerSignupModal.coffee b/app/views/modal/EmployerSignupModal.coffee index 65c9f1392..2c5306356 100644 --- a/app/views/modal/EmployerSignupModal.coffee +++ b/app/views/modal/EmployerSignupModal.coffee @@ -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: diff --git a/app/views/modal/RecoverModal.coffee b/app/views/modal/RecoverModal.coffee index 64cdd8154..cb7781bed 100644 --- a/app/views/modal/RecoverModal.coffee +++ b/app/views/modal/RecoverModal.coffee @@ -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) diff --git a/app/views/modal/SaveVersionModal.coffee b/app/views/modal/SaveVersionModal.coffee index 16367273f..77c5556a7 100644 --- a/app/views/modal/SaveVersionModal.coffee +++ b/app/views/modal/SaveVersionModal.coffee @@ -43,9 +43,9 @@ module.exports = class SaveVersionModal extends ModalView onSubmitForm: (e) -> e.preventDefault() if @isPatch then @submitPatch() else @saveChanges() - + saveChanges: -> - Backbone.Mediator.publish 'save-new-version', { + Backbone.Mediator.publish 'editor:save-new-version', { major: @$el.find('#major-version').prop('checked') commitMessage: @$el.find('#commit-message').val() } diff --git a/app/views/play/SpectateView.coffee b/app/views/play/SpectateView.coffee index eb11eda33..30fb92aca 100644 --- a/app/views/play/SpectateView.coffee +++ b/app/views/play/SpectateView.coffee @@ -37,38 +37,21 @@ module.exports = class SpectateLevelView extends RootView id: 'spectate-level-view' template: template cache: false - shortcutsEnabled: true isEditorPreview: false subscriptions: - 'level-set-volume': (e) -> createjs.Sound.setVolume(e.volume) - 'level-highlight-dom': 'onHighlightDom' - 'end-level-highlight-dom': 'onEndHighlight' - 'level-focus-dom': 'onFocusDom' - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:set-volume': (e) -> createjs.Sound.setVolume(e.volume) 'god:new-world-created': 'onNewWorld' + 'god:streaming-world-updated': 'onNewWorld' 'god:infinite-loop': 'onInfiniteLoop' - 'level-reload-from-data': 'onLevelReloadFromData' - 'play-next-level': 'onPlayNextLevel' 'surface:world-set-up': 'onSurfaceSetUpNewWorld' - 'level:set-team': 'setTeam' - 'god:new-world-created': 'loadSoundsForWorld' - 'god:streaming-world-updated': 'loadSoundsForWorld' - 'next-game-pressed': 'onNextGamePressed' + 'level:next-game-pressed': 'onNextGamePressed' 'level:started': 'onLevelStarted' 'level:loading-view-unveiled': 'onLoadingViewUnveiled' - events: - 'click #level-done-button': 'onDonePressed' - - shortcuts: - 'ctrl+s': 'onCtrlS' - constructor: (options, @levelID) -> console.profile?() if PROFILE_ME super options - $(window).on('resize', @onWindowResize) @sessionOne = @getQueryVariable 'session-one' @sessionTwo = @getQueryVariable 'session-two' @@ -207,143 +190,16 @@ module.exports = class SpectateLevelView extends RootView @insertSubView new HUDView {} worldName = utils.i18n @level.attributes, 'name' @controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel, playableTeams: @world.playableTeams, spectateGame: true} - #Backbone.Mediator.publish('level-set-debug', debug: true) if me.displayName() is 'Nick' - - afterInsert: -> - super() # callbacks - onCtrlS: (e) -> - e.preventDefault() - - onLevelReloadFromData: (e) -> - isReload = Boolean @world - @setLevel e.level, e.supermodel - if isReload - @scriptManager.setScripts(e.level.get('scripts')) - Backbone.Mediator.publish 'tome:cast-spell' # a bit hacky - - onWindowResize: (s...) -> - $('#pointer').css('opacity', 0.0) - - onDisableControls: (e) -> - return if e.controls and not ('level' in e.controls) - @shortcutsEnabled = false - @wasFocusedOn = document.activeElement - $('body').focus() - - onEnableControls: (e) -> - return if e.controls? and not ('level' in e.controls) - @shortcutsEnabled = true - $(@wasFocusedOn).focus() if @wasFocusedOn - @wasFocusedOn = null - - onDonePressed: -> return - - - onNewWorld: (e) -> - @world = e.world - onInfiniteLoop: (e) -> return unless e.firstWorld @openModalView new InfiniteLoopModal() window.tracker?.trackEvent 'Saw Initial Infinite Loop', level: @world.name, label: @world.name - onPlayNextLevel: -> - nextLevel = @getNextLevel() - nextLevelID = nextLevel.get('slug') or nextLevel.id - url = "/play/level/#{nextLevelID}" - Backbone.Mediator.publish 'router:navigate', { - route: url, - viewClass: PlayLevelView, - viewArgs: [{supermodel:@supermodel}, nextLevelID]} - - getNextLevel: -> - nextLevelOriginal = @level.get('nextLevel')?.original - levels = @supermodel.getModels(Level) - return l for l in levels when l.get('original') is nextLevelOriginal - - onHighlightDom: (e) -> - if e.delay - delay = e.delay - delete e.delay - @pointerInterval = _.delay((=> @onHighlightDom e), delay) - return - @addPointer() - selector = e.selector + ':visible' - dom = $(selector) - return if parseFloat(dom.css('opacity')) is 0.0 - offset = dom.offset() - return if not offset - target_left = offset.left + dom.outerWidth() * 0.5 - target_top = offset.top + dom.outerHeight() * 0.5 - body = $('#level-view') - - if e.sides - if 'left' in e.sides then target_left = offset.left - if 'right' in e.sides then target_left = offset.left + dom.outerWidth() - if 'top' in e.sides then target_top = offset.top - if 'bottom' in e.sides then target_top = offset.top + dom.outerHeight() - else - # aim to hit the side if the target is entirely on one side of the screen - if offset.left > body.outerWidth()*0.5 - target_left = offset.left - else if offset.left + dom.outerWidth() < body.outerWidth()*0.5 - target_left = offset.left + dom.outerWidth() - - # aim to hit the bottom or top if the target is entirely on the top or bottom of the screen - if offset.top > body.outerWidth()*0.5 - target_top = offset.top - else if offset.top + dom.outerHeight() < body.outerHeight()*0.5 - target_top = offset.top + dom.outerHeight() - - if e.offset - target_left += e.offset.x - target_top += e.offset.y - - @pointerRadialDistance = -47 # - Math.sqrt(Math.pow(dom.outerHeight()*0.5, 2), Math.pow(dom.outerWidth()*0.5)) - @pointerRotation = e.rotation ? Math.atan2(body.outerWidth()*0.5 - target_left, target_top - body.outerHeight()*0.5) - pointer = $('#pointer') - pointer - .css('opacity', 1.0) - .css('transition', 'none') - .css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)") - .css('top', target_top - 50) - .css('left', target_left - 50) - setTimeout((=> - @animatePointer() - clearInterval(@pointerInterval) - @pointerInterval = setInterval(@animatePointer, 1200) - ), 1) - - animatePointer: -> - pointer = $('#pointer') - pointer.css('transition', 'all 0.6s ease-out') - pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance-50}px)") - setTimeout((=> - pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)").css('transition', 'all 0.4s ease-in')), 800) - - onFocusDom: (e) -> $(e.selector).focus() - - onEndHighlight: -> - $('#pointer').css('opacity', 0.0) - clearInterval(@pointerInterval) - - onMultiplayerChanged: (e) -> - if @session.get('multiplayer') - @bus.connect() - else - @bus.removeFirebaseData => - @bus.disconnect() - # initialization - addPointer: -> - p = $('#pointer') - return if p.length - @$el.append($('')) - initSurface: -> surfaceCanvas = $('canvas#surface', @$el) @surface = new Surface(@world, surfaceCanvas, thangTypes: @supermodel.getModels(ThangType), playJingle: not @isEditorPreview, spectateGame: true) @@ -372,14 +228,14 @@ module.exports = class SpectateLevelView extends RootView initVolume: -> volume = me.get('volume') volume = 1.0 unless volume? - Backbone.Mediator.publish 'level-set-volume', volume: volume + Backbone.Mediator.publish 'level:set-volume', volume: volume onSurfaceSetUpNewWorld: -> return if @alreadyLoadedState @alreadyLoadedState = true state = @originalSessionState if state.playing? - Backbone.Mediator.publish 'level-set-playing', { playing: state.playing } + Backbone.Mediator.publish 'level:set-playing', playing: state.playing register: -> return @@ -400,17 +256,22 @@ module.exports = class SpectateLevelView extends RootView # Dynamic sound loading - loadSoundsForWorld: (e) -> + onNewWorld: (e) -> return if @headless - world = e.world + scripts = @world.scripts # Since these worlds don't have scripts, preserve them. + @world = e.world thangTypes = @supermodel.getModels(ThangType) - for [spriteName, message] in world.thangDialogueSounds() + startFrame = @lastWorldFramesLoaded ? 0 + if @world.frames.length is @world.totalFrames # Finished loading + @lastWorldFramesLoaded = 0 + else + @lastWorldFramesLoaded = @world.frames.length + for [spriteName, message] in @world.thangDialogueSounds startFrame continue unless thangType = _.find thangTypes, (m) -> m.get('name') is spriteName continue unless sound = AudioPlayer.soundForDialogue message, thangType.get('soundTriggers') AudioPlayer.preloadSoundReference sound onNextGamePressed: (e) -> - console.log 'You want to see the next game!' @fetchRandomSessionPair (err, data) => if err? then return console.log "There was an error fetching the random session pair: #{data}" @sessionOne = data[0]._id @@ -445,10 +306,8 @@ module.exports = class SpectateLevelView extends RootView @levelLoader?.destroy() @surface?.destroy() @god?.destroy() - $(window).off('resize', @onWindowResize) @goalManager?.destroy() @scriptManager?.destroy() delete window.world # not sure where this is set, but this is one way to clean it up - clearInterval(@pointerInterval) console.profileEnd?() if PROFILE_ME super() diff --git a/app/views/play/ladder/LadderTabView.coffee b/app/views/play/ladder/LadderTabView.coffee index 27a43c4b6..cd437bc6c 100644 --- a/app/views/play/ladder/LadderTabView.coffee +++ b/app/views/play/ladder/LadderTabView.coffee @@ -21,10 +21,10 @@ module.exports = class LadderTabView extends CocoView 'click .load-more-ladder-entries': 'onLoadMoreLadderEntries' subscriptions: - 'fbapi-loaded': 'checkFriends' - 'gapi-loaded': 'checkFriends' - 'facebook-logged-in': 'onConnectedWithFacebook' - 'gplus-logged-in': 'onConnectedWithGPlus' + 'auth:facebook-api-loaded': 'checkFriends' + 'auth:gplus-api-loaded': 'checkFriends' + 'auth:logged-in-with-facebook': 'onConnectedWithFacebook' + 'auth:logged-in-with-gplus': 'onConnectedWithGPlus' constructor: (options, @level, @sessions) -> super(options) diff --git a/app/views/play/ladder/MyMatchesTabView.coffee b/app/views/play/ladder/MyMatchesTabView.coffee index 13bd52882..0b9b1afa1 100644 --- a/app/views/play/ladder/MyMatchesTabView.coffee +++ b/app/views/play/ladder/MyMatchesTabView.coffee @@ -61,7 +61,7 @@ module.exports = class MyMatchesTabView extends CocoView state = 'tie' if match.metrics.rank is opponent.metrics.rank fresh = match.date > (new Date(new Date() - 20 * 1000)).toISOString() if fresh - Backbone.Mediator.publish 'play-sound', trigger: 'chat_received' + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'chat_received' { state: state opponentName: @nameMap[opponent.userID] @@ -88,7 +88,7 @@ module.exports = class MyMatchesTabView extends CocoView team.scoreHistory = scoreHistory if not team.isRanking and @previouslyRankingTeams[team.id] - Backbone.Mediator.publish 'play-sound', trigger: 'cast-end' + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'cast-end' @previouslyRankingTeams[team.id] = team.isRanking ctx diff --git a/app/views/play/level/ControlBarView.coffee b/app/views/play/level/ControlBarView.coffee index d4fbe91c6..0afcf7e95 100644 --- a/app/views/play/level/ControlBarView.coffee +++ b/app/views/play/level/ControlBarView.coffee @@ -16,7 +16,7 @@ module.exports = class ControlBarView extends CocoView window.tracker?.trackEvent 'Clicked Docs', level: @level.get('name'), label: @level.get('name') @showGuideModal() - 'click #next-game-button': -> Backbone.Mediator.publish 'next-game-pressed', {} + 'click #next-game-button': -> Backbone.Mediator.publish 'level:next-game-pressed', {} 'click #game-menu-button': 'showGameMenuModal' diff --git a/app/views/play/level/LevelChatView.coffee b/app/views/play/level/LevelChatView.coffee index 5c4fe650a..8e71c2c24 100644 --- a/app/views/play/level/LevelChatView.coffee +++ b/app/views/play/level/LevelChatView.coffee @@ -51,7 +51,7 @@ module.exports = class LevelChatView extends CocoView @playNoise() if e.message.authorID isnt me.id playNoise: -> - Backbone.Mediator.publish 'play-sound', trigger: 'chat_received' + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'chat_received' messageObjectToJQuery: (message) -> td = $('') diff --git a/app/views/play/level/LevelGoalsView.coffee b/app/views/play/level/LevelGoalsView.coffee index f0388ccc1..cbc4c2075 100644 --- a/app/views/play/level/LevelGoalsView.coffee +++ b/app/views/play/level/LevelGoalsView.coffee @@ -14,7 +14,7 @@ module.exports = class LevelGoalsView extends CocoView subscriptions: 'goal-manager:new-goal-states': 'onNewGoalStates' - 'level-set-letterbox': 'onSetLetterbox' + 'level:set-letterbox': 'onSetLetterbox' 'surface:playback-restarted': 'onSurfacePlaybackRestarted' 'surface:playback-ended': 'onSurfacePlaybackEnded' diff --git a/app/views/play/level/LevelGoldView.coffee b/app/views/play/level/LevelGoldView.coffee index 414ac60b3..48bf426eb 100644 --- a/app/views/play/level/LevelGoldView.coffee +++ b/app/views/play/level/LevelGoldView.coffee @@ -8,14 +8,14 @@ module.exports = class LevelGoldView extends CocoView subscriptions: 'surface:gold-changed': 'onGoldChanged' - 'level-set-letterbox': 'onSetLetterbox' + 'level:set-letterbox': 'onSetLetterbox' constructor: (options) -> super options @teamGold = {} @teamGoldEarned = {} @shownOnce = false - + onGoldChanged: (e) -> return if @teamGold[e.team] is e.gold and @teamGoldEarned[e.team] is e.goldEarned @teamGold[e.team] = e.gold diff --git a/app/views/play/level/LevelHUDView.coffee b/app/views/play/level/LevelHUDView.coffee index 0f10fa330..ba37fc42c 100644 --- a/app/views/play/level/LevelHUDView.coffee +++ b/app/views/play/level/LevelHUDView.coffee @@ -11,16 +11,16 @@ module.exports = class LevelHUDView extends CocoView subscriptions: 'surface:frame-changed': 'onFrameChanged' - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'surface:sprite-selected': 'onSpriteSelected' 'sprite:speech-updated': 'onSpriteDialogue' - 'level-sprite-clear-dialogue': 'onSpriteClearDialogue' + 'level:sprite-clear-dialogue': 'onSpriteClearDialogue' 'level:shift-space-pressed': 'onShiftSpacePressed' 'level:escape-pressed': 'onEscapePressed' - 'dialogue-sound-completed': 'onDialogueSoundCompleted' - 'thang-began-talking': 'onThangBeganTalking' - 'thang-finished-talking': 'onThangFinishedTalking' + 'sprite:dialogue-sound-completed': 'onDialogueSoundCompleted' + 'sprite:thang-began-talking': 'onThangBeganTalking' + 'sprite:thang-finished-talking': 'onThangFinishedTalking' 'god:new-world-created': 'onNewWorld' events: @@ -210,13 +210,13 @@ module.exports = class LevelHUDView extends CocoView f = (r) => => setTimeout((-> Backbone.Mediator.publish(r.channel, r.event)), 10) $(buttons[i]).click(f(response)) else - $('.enter', @bubble).click(-> Backbone.Mediator.publish('end-current-script')) + $('.enter', @bubble).click(-> Backbone.Mediator.publish('script:end-current-script')) return @animator.tick() onShiftSpacePressed: (e) -> @shiftSpacePressed = (@shiftSpacePressed || 0) + 1 - # We don't need to handle end-current-script--that's done--but if we do have + # We don't need to handle script:end-current-script--that's done--but if we do have # custom buttons, then we need to trigger the one that should fire (the last one). # If we decide that always having the last one fire is bad, we should make it smarter. return unless @lastResponses?.length diff --git a/app/views/play/level/LevelLoadingView.coffee b/app/views/play/level/LevelLoadingView.coffee index 6c40e9de9..acd15c67d 100644 --- a/app/views/play/level/LevelLoadingView.coffee +++ b/app/views/play/level/LevelLoadingView.coffee @@ -18,7 +18,7 @@ module.exports = class LevelLoadingView extends CocoView @shownReady = true ready = $.i18n.t('play_level.loading_ready', defaultValue: 'Ready!') @$el.find('#tip-wrapper .tip').addClass('ready').text ready - Backbone.Mediator.publish 'play-sound', trigger: 'level_loaded', volume: 0.75 # old: loading_ready + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'level_loaded', volume: 0.75 # old: loading_ready unveil: -> _.delay @reallyUnveil, 1000 diff --git a/app/views/play/level/LevelPlaybackView.coffee b/app/views/play/level/LevelPlaybackView.coffee index deddab970..cbe7e6633 100644 --- a/app/views/play/level/LevelPlaybackView.coffee +++ b/app/views/play/level/LevelPlaybackView.coffee @@ -10,18 +10,18 @@ module.exports = class LevelPlaybackView extends CocoView template: template subscriptions: - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' - 'level-set-playing': 'onSetPlaying' - 'level-toggle-playing': 'onTogglePlay' - 'level-scrub-forward': 'onScrubForward' - 'level-scrub-back': 'onScrubBack' - 'level-set-volume': 'onSetVolume' - 'level-set-debug': 'onSetDebug' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' + 'level:set-playing': 'onSetPlaying' + 'level:toggle-playing': 'onTogglePlay' + 'level:scrub-forward': 'onScrubForward' + 'level:scrub-back': 'onScrubBack' + 'level:set-volume': 'onSetVolume' + 'level:set-debug': 'onSetDebug' 'surface:frame-changed': 'onFrameChanged' 'god:new-world-created': 'onNewWorld' 'god:streaming-world-updated': 'onNewWorld' - 'level-set-letterbox': 'onSetLetterbox' + 'level:set-letterbox': 'onSetLetterbox' 'tome:cast-spells': 'onTomeCast' 'playback:real-time-playback-ended': 'onRealTimePlaybackEnded' 'playback:stop-real-time-playback': 'onStopRealTimePlayback' @@ -32,8 +32,8 @@ module.exports = class LevelPlaybackView extends CocoView 'click #edit-editor-config': 'onEditEditorConfig' 'click #view-keyboard-shortcuts': 'onViewKeyboardShortcuts' 'click #music-button': 'onToggleMusic' - 'click #zoom-in-button': -> Backbone.Mediator.publish('camera-zoom-in', {}) unless @shouldIgnore() - 'click #zoom-out-button': -> Backbone.Mediator.publish('camera-zoom-out', {}) unless @shouldIgnore() + 'click #zoom-in-button': -> Backbone.Mediator.publish 'camera:zoom-in', {} unless @shouldIgnore() + 'click #zoom-out-button': -> Backbone.Mediator.publish 'camera:zoom-out', {} unless @shouldIgnore() 'click #volume-button': 'onToggleVolume' 'click #play-button': 'onTogglePlay' 'click': -> Backbone.Mediator.publish 'tome:focus-editor', {} unless @realTime @@ -183,10 +183,10 @@ module.exports = class LevelPlaybackView extends CocoView onToggleDebug: -> return if @shouldIgnore() flag = $('#debug-toggle i.icon-ok') - Backbone.Mediator.publish('level-set-debug', {debug: flag.hasClass('invisible')}) + Backbone.Mediator.publish('level:set-debug', {debug: flag.hasClass('invisible')}) onEditWizardSettings: -> - Backbone.Mediator.publish 'edit-wizard-settings' + Backbone.Mediator.publish 'level:edit-wizard-settings', {} onEditEditorConfig: -> @openModalView new EditorConfigModal session: @options.session @@ -236,7 +236,7 @@ module.exports = class LevelPlaybackView extends CocoView onScrub: (e, options) -> e?.preventDefault() options.scrubDuration = 500 - Backbone.Mediator.publish('level-set-time', options) + Backbone.Mediator.publish('level:set-time', options) onScrubForward: (e) -> @onScrub e, ratioOffset: 0.05 @@ -324,16 +324,16 @@ module.exports = class LevelPlaybackView extends CocoView return if @shouldIgnore() @slideCount = 0 @wasPlaying = @playing - Backbone.Mediator.publish 'level-set-playing', {playing: false} + Backbone.Mediator.publish 'level:set-playing', {playing: false} stop: (event, ui) => return if @shouldIgnore() @actualProgress = ui.value / @sliderIncrements - Backbone.Mediator.publish 'playback:manually-scrubbed', ratio: @actualProgress - Backbone.Mediator.publish 'level-set-playing', {playing: @wasPlaying} + Backbone.Mediator.publish 'playback:manually-scrubbed', ratio: @actualProgress # For scripts + Backbone.Mediator.publish 'level:set-playing', {playing: @wasPlaying} if @slideCount < 3 @wasPlaying = false - Backbone.Mediator.publish 'level-set-playing', {playing: false} + Backbone.Mediator.publish 'level:set-playing', {playing: false} @$el.find('.scrubber-handle').effect('bounce', {times: 2}) ) @@ -342,7 +342,7 @@ module.exports = class LevelPlaybackView extends CocoView scrubTo: (ratio, duration=0) -> return if @shouldIgnore() - Backbone.Mediator.publish 'level-set-time', ratio: ratio, scrubDuration: duration + Backbone.Mediator.publish 'level:set-time', ratio: ratio, scrubDuration: duration shouldIgnore: -> return @disabled or @realTime @@ -351,7 +351,7 @@ module.exports = class LevelPlaybackView extends CocoView return if @shouldIgnore() button = $('#play-button') willPlay = button.hasClass('paused') or button.hasClass('ended') - Backbone.Mediator.publish 'level-set-playing', playing: willPlay + Backbone.Mediator.publish 'level:set-playing', playing: willPlay $(document.activeElement).blur() onToggleVolume: (e) -> @@ -364,7 +364,7 @@ module.exports = class LevelPlaybackView extends CocoView break else if i is classes.length - 1 # no oldClass newI = 2 - Backbone.Mediator.publish 'level-set-volume', volume: volumes[newI] + Backbone.Mediator.publish 'level:set-volume', volume: volumes[newI] $(document.activeElement).blur() onToggleMusic: (e) -> diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index 1121b8d47..246f10cab 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -44,24 +44,23 @@ module.exports = class PlayLevelView extends RootView isEditorPreview: false subscriptions: - 'level-set-volume': (e) -> createjs.Sound.setVolume(e.volume) - 'level-show-victory': 'onShowVictory' - 'restart-level': 'onRestartLevel' - 'level-highlight-dom': 'onHighlightDom' - 'end-level-highlight-dom': 'onEndHighlight' - 'level-focus-dom': 'onFocusDom' - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:set-volume': (e) -> createjs.Sound.setVolume(e.volume) + 'level:show-victory': 'onShowVictory' + 'level:restart': 'onRestartLevel' + 'level:highlight-dom': 'onHighlightDom' + 'level:end-highlight-dom': 'onEndHighlight' + 'level:focus-dom': 'onFocusDom' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'god:new-world-created': 'onNewWorld' 'god:streaming-world-updated': 'onNewWorld' 'god:infinite-loop': 'onInfiniteLoop' - 'level-reload-from-data': 'onLevelReloadFromData' - 'level-reload-thang-type': 'onLevelReloadThangType' - 'play-next-level': 'onPlayNextLevel' - 'edit-wizard-settings': 'showWizardSettingsModal' + 'level:reload-from-data': 'onLevelReloadFromData' + 'level:reload-thang-type': 'onLevelReloadThangType' + 'level:play-next-level': 'onPlayNextLevel' + 'level:edit-wizard-settings': 'showWizardSettingsModal' 'surface:world-set-up': 'onSurfaceSetUpNewWorld' 'level:session-will-save': 'onSessionWillSave' - 'level:set-team': 'setTeam' 'level:started': 'onLevelStarted' 'level:loading-view-unveiled': 'onLoadingViewUnveiled' 'playback:real-time-playback-started': 'onRealTimePlaybackStarted' @@ -143,13 +142,13 @@ module.exports = class PlayLevelView extends RootView supermodel: @supermodel firstOnly: true @openModalView(new LevelGuideModal(options), true) - onGuideOpened = -> + onGuideOpened = (e) -> @guideOpenTime = new Date() - onGuideClosed = -> + onGuideClosed = (e) -> application.tracker?.trackTiming new Date() - @guideOpenTime, 'Intro Guide Time', @levelID, @levelID, 100 @onLevelStarted() - Backbone.Mediator.subscribeOnce 'modal-opened', onGuideOpened, @ - Backbone.Mediator.subscribeOnce 'modal-closed', onGuideClosed, @ + Backbone.Mediator.subscribeOnce 'modal:opened', onGuideOpened, @ + Backbone.Mediator.subscribeOnce 'modal:closed', onGuideClosed, @ return true getRenderData: -> @@ -224,7 +223,7 @@ module.exports = class PlayLevelView extends RootView team = team?.team unless _.isString team team ?= 'humans' me.team = team - Backbone.Mediator.publish 'level:team-set', team: team + Backbone.Mediator.publish 'level:team-set', team: team # Needed for scripts @team = team initGoalManager: -> @@ -241,12 +240,12 @@ module.exports = class PlayLevelView extends RootView @insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session worldName = utils.i18n @level.attributes, 'name' @controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel, playableTeams: @world.playableTeams} - #Backbone.Mediator.publish('level-set-debug', debug: true) if me.displayName() is 'Nick' + #Backbone.Mediator.publish('level:set-debug', debug: true) if me.displayName() is 'Nick' initVolume: -> volume = me.get('volume') volume = 1.0 unless volume? - Backbone.Mediator.publish 'level-set-volume', volume: volume + Backbone.Mediator.publish 'level:set-volume', volume: volume initScriptManager: -> @scriptManager = new ScriptManager({scripts: @world.scripts or [], view: @, session: @session}) @@ -289,7 +288,7 @@ module.exports = class PlayLevelView extends RootView return unless @surface? @loadingView.showReady() if window.currentModal and not window.currentModal.destroyed - return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelStarted, @ + return Backbone.Mediator.subscribeOnce 'modal:closed', @onLevelStarted, @ @surface.showLevel() if @otherSession # TODO: colorize name and cloud by team, colorize wizard by user's color config @@ -312,12 +311,12 @@ module.exports = class PlayLevelView extends RootView @alreadyLoadedState = true state = @originalSessionState if state.frame and @level.get('type') isnt 'ladder' # https://github.com/codecombat/codecombat/issues/714 - Backbone.Mediator.publish 'level-set-time', { time: 0, frameOffset: state.frame } + Backbone.Mediator.publish 'level:set-time', time: 0, frameOffset: state.frame if state.selected # TODO: Should also restore selected spell here by saving spellName - Backbone.Mediator.publish 'level-select-sprite', { thangID: state.selected, spellName: null } + Backbone.Mediator.publish 'level:select-sprite', thangID: state.selected, spellName: null if state.playing? - Backbone.Mediator.publish 'level-set-playing', { playing: state.playing } + Backbone.Mediator.publish 'level:set-playing', playing: state.playing # callbacks @@ -377,7 +376,7 @@ module.exports = class PlayLevelView extends RootView onRestartLevel: -> @tome.reloadAllCode() - Backbone.Mediator.publish 'level:restarted' + Backbone.Mediator.publish 'level:restarted', {} $('#level-done-button', @$el).hide() application.tracker?.trackEvent 'Confirmed Restart', level: @level.get('name'), label: @level.get('name') @@ -421,7 +420,6 @@ module.exports = class PlayLevelView extends RootView return if not offset target_left = offset.left + dom.outerWidth() * 0.5 target_top = offset.top + dom.outerHeight() * 0.5 - body = $('#level-view') if e.sides if 'left' in e.sides then target_left = offset.left @@ -430,15 +428,15 @@ module.exports = class PlayLevelView extends RootView if 'bottom' in e.sides then target_top = offset.top + dom.outerHeight() else # aim to hit the side if the target is entirely on one side of the screen - if offset.left > body.outerWidth()*0.5 + if offset.left > @$el.outerWidth()*0.5 target_left = offset.left - else if offset.left + dom.outerWidth() < body.outerWidth()*0.5 + else if offset.left + dom.outerWidth() < @$el.outerWidth()*0.5 target_left = offset.left + dom.outerWidth() # aim to hit the bottom or top if the target is entirely on the top or bottom of the screen - if offset.top > body.outerWidth()*0.5 + if offset.top > @$el.outerWidth()*0.5 target_top = offset.top - else if offset.top + dom.outerHeight() < body.outerHeight()*0.5 + else if offset.top + dom.outerHeight() < @$el.outerHeight()*0.5 target_top = offset.top + dom.outerHeight() if e.offset @@ -446,7 +444,7 @@ module.exports = class PlayLevelView extends RootView target_top += e.offset.y @pointerRadialDistance = -47 # - Math.sqrt(Math.pow(dom.outerHeight()*0.5, 2), Math.pow(dom.outerWidth()*0.5)) - @pointerRotation = e.rotation ? Math.atan2(body.outerWidth()*0.5 - target_left, target_top - body.outerHeight()*0.5) + @pointerRotation = e.rotation ? Math.atan2(@$el.outerWidth()*0.5 - target_left, target_top - @$el.outerHeight()*0.5) pointer = $('#pointer') pointer .css('opacity', 1.0) @@ -465,7 +463,7 @@ module.exports = class PlayLevelView extends RootView pointer = $('#pointer') pointer.css('transition', 'all 0.6s ease-out') pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance-50}px)") - Backbone.Mediator.publish 'play-sound', trigger: 'dom_highlight', volume: 0.75 + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'dom_highlight', volume: 0.75 setTimeout((=> pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)").css('transition', 'all 0.4s ease-in')), 800) diff --git a/app/views/play/level/modal/InfiniteLoopModal.coffee b/app/views/play/level/modal/InfiniteLoopModal.coffee index 6436c7667..632f400fa 100644 --- a/app/views/play/level/modal/InfiniteLoopModal.coffee +++ b/app/views/play/level/modal/InfiniteLoopModal.coffee @@ -6,6 +6,6 @@ module.exports = class InfiniteLoopModal extends ModalView template: template events: - 'click #restart-level-infinite-loop-retry-button': -> Backbone.Mediator.publish 'tome:cast-spell' - 'click #restart-level-infinite-loop-confirm-button': -> Backbone.Mediator.publish 'restart-level' - 'click #restart-level-infinite-loop-comment-button': -> Backbone.Mediator.publish 'tome:comment-my-code' + 'click #restart-level-infinite-loop-retry-button': -> Backbone.Mediator.publish 'tome:cast-spell', {} + 'click #restart-level-infinite-loop-confirm-button': -> Backbone.Mediator.publish 'level:restart', {} + 'click #restart-level-infinite-loop-comment-button': -> Backbone.Mediator.publish 'tome:comment-my-code', {} diff --git a/app/views/play/level/modal/LevelGuideModal.coffee b/app/views/play/level/modal/LevelGuideModal.coffee index 5ba7fe01a..4f454b380 100644 --- a/app/views/play/level/modal/LevelGuideModal.coffee +++ b/app/views/play/level/modal/LevelGuideModal.coffee @@ -52,7 +52,7 @@ module.exports = class LevelGuideModal extends ModalView afterInsert: -> super() - Backbone.Mediator.publish 'level:docs-shown' + Backbone.Mediator.publish 'level:docs-shown', {} onHidden: -> - Backbone.Mediator.publish 'level:docs-hidden' + Backbone.Mediator.publish 'level:docs-hidden', {} diff --git a/app/views/play/level/modal/VictoryModal.coffee b/app/views/play/level/modal/VictoryModal.coffee index 1e9b0a7fd..083963193 100644 --- a/app/views/play/level/modal/VictoryModal.coffee +++ b/app/views/play/level/modal/VictoryModal.coffee @@ -59,7 +59,7 @@ module.exports = class VictoryModal extends ModalView onPlayNextLevel: -> @saveReview() if @$el.find('.review textarea').val() - Backbone.Mediator.publish('play-next-level') + Backbone.Mediator.publish 'level:play-next-level', {} onGameSubmitted: (e) -> ladderURL = "/play/ladder/#{@level.get('slug')}#my-matches" @@ -95,14 +95,11 @@ module.exports = class VictoryModal extends ModalView afterInsert: -> super() - Backbone.Mediator.publish 'play-sound', trigger: 'victory' + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'victory' gapi?.plusone?.go? @$el[0] FB?.XFBML?.parse? @$el[0] twttr?.widgets?.load?() - onHidden: -> - Backbone.Mediator.publish 'level:victory-hidden' - destroy: -> @saveReview() if @$el.find('.review textarea').val() @feedback.off() diff --git a/app/views/play/level/tome/CastButtonView.coffee b/app/views/play/level/tome/CastButtonView.coffee index f28500fdf..f024043de 100644 --- a/app/views/play/level/tome/CastButtonView.coffee +++ b/app/views/play/level/tome/CastButtonView.coffee @@ -51,7 +51,7 @@ module.exports = class CastButtonView extends CocoView Backbone.Mediator.publish 'tome:manual-cast', {realTime: true} onCastOptionsClick: (e) => - Backbone.Mediator.publish 'tome:focus-editor' + Backbone.Mediator.publish 'tome:focus-editor', {} @castButtonGroup.removeClass 'open' @setAutocastDelay $(e.target).attr 'data-delay' false @@ -63,7 +63,7 @@ module.exports = class CastButtonView extends CocoView return if e.preload @casting = true if @hasStartedCastingOnce # Don't play this sound the first time - Backbone.Mediator.publish 'play-sound', trigger: 'cast', volume: 0.5 + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'cast', volume: 0.5 @hasStartedCastingOnce = true @updateCastButton() @onWorldLoadProgressChanged progress: 0 @@ -76,7 +76,7 @@ module.exports = class CastButtonView extends CocoView onNewWorld: (e) -> @casting = false if @hasCastOnce # Don't play this sound the first time - Backbone.Mediator.publish 'play-sound', trigger: 'cast-end', volume: 0.5 + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'cast-end', volume: 0.5 @hasCastOnce = true @updateCastButton() diff --git a/app/views/play/level/tome/ProblemAlertView.coffee b/app/views/play/level/tome/ProblemAlertView.coffee index f90bab513..80785b932 100644 --- a/app/views/play/level/tome/ProblemAlertView.coffee +++ b/app/views/play/level/tome/ProblemAlertView.coffee @@ -33,7 +33,7 @@ module.exports = class ProblemAlertView extends CocoView super() @$el.addClass('alert').addClass("alert-#{@problem.aetherProblem.level}").hide().fadeIn('slow') @$el.addClass('no-hint') unless @problem.aetherProblem.hint - Backbone.Mediator.publish 'play-sound', trigger: 'error_appear', volume: 1.0 + Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'error_appear', volume: 1.0 onRemoveClicked: -> @$el.remove() diff --git a/app/views/play/level/tome/SpellDebugView.coffee b/app/views/play/level/tome/SpellDebugView.coffee index 623e70d25..efb27e0a4 100644 --- a/app/views/play/level/tome/SpellDebugView.coffee +++ b/app/views/play/level/tome/SpellDebugView.coffee @@ -102,15 +102,15 @@ module.exports = class SpellDebugView extends CocoView @thang = thangAndSpellObject.thang @spell = thangAndSpellObject.spell - handleDebugValue: (returnObject) -> + handleDebugValue: (e) -> + {key, value} = e @workerIsSimulating = false - {key, value} = returnObject @updateCache(@thang.id, @spell.name, key.split('.'), @lastFrameRequested, value) if @variableChain and not key is @variableChain.join('.') then return @setTooltipKeyAndValue(key, value) - handleWorldLoadProgressChanged: (data) -> - @progress = data.progress + handleWorldLoadProgressChanged: (e) -> + @progress = e.progress afterRender: -> super() diff --git a/app/views/play/level/tome/SpellListEntryThangsView.coffee b/app/views/play/level/tome/SpellListEntryThangsView.coffee index 6d730072b..75d34f9b2 100644 --- a/app/views/play/level/tome/SpellListEntryThangsView.coffee +++ b/app/views/play/level/tome/SpellListEntryThangsView.coffee @@ -30,7 +30,7 @@ module.exports = class SpellListEntryThangsView extends CocoView avatar.render() avatar.setSelected thang is @thang avatar.$el.data('thang-id', thang.id).click (e) -> - Backbone.Mediator.publish 'level-select-sprite', thangID: $(@).data('thang-id'), spellName: spellName + Backbone.Mediator.publish 'level:select-sprite', thangID: $(@).data('thang-id'), spellName: spellName avatar.onProblemsUpdated spell: @spell @avatars.push avatar diff --git a/app/views/play/level/tome/SpellListEntryView.coffee b/app/views/play/level/tome/SpellListEntryView.coffee index 0ea75d5d4..0a9fa82bb 100644 --- a/app/views/play/level/tome/SpellListEntryView.coffee +++ b/app/views/play/level/tome/SpellListEntryView.coffee @@ -14,8 +14,8 @@ module.exports = class SpellListEntryView extends CocoView subscriptions: 'tome:problems-updated': 'onProblemsUpdated' 'tome:spell-changed-language': 'onSpellChangedLanguage' - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'god:new-world-created': 'onNewWorld' events: @@ -88,7 +88,7 @@ module.exports = class SpellListEntryView extends CocoView onClick: (e) -> spellThang = @getPrimarySpellThang() - Backbone.Mediator.publish 'level-select-sprite', thangID: spellThang.thang.id, spellName: @spell.name + Backbone.Mediator.publish 'level:select-sprite', thangID: spellThang.thang.id, spellName: @spell.name onMouseEnterAvatar: (e) -> return unless @controlsEnabled and _.size(@spell.thangs) > 1 diff --git a/app/views/play/level/tome/SpellListTabEntryView.coffee b/app/views/play/level/tome/SpellListTabEntryView.coffee index 36059c504..93e06f548 100644 --- a/app/views/play/level/tome/SpellListTabEntryView.coffee +++ b/app/views/play/level/tome/SpellListTabEntryView.coffee @@ -10,8 +10,8 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView id: 'spell-list-tab-entry-view' subscriptions: - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'tome:spell-loaded': 'onSpellLoaded' 'tome:spell-changed': 'onSpellChanged' 'god:new-world-created': 'onNewWorld' @@ -84,7 +84,7 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView onDropdownClick: (e) -> return unless @controlsEnabled - Backbone.Mediator.publish 'tome:toggle-spell-list' + Backbone.Mediator.publish 'tome:toggle-spell-list', {} onCodeReload: -> return unless @controlsEnabled @@ -92,7 +92,7 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView onBeautifyClick: -> return unless @controlsEnabled - Backbone.Mediator.publish 'spell-beautify', spell: @spell + Backbone.Mediator.publish 'tome:spell-beautify', spell: @spell onFullscreenClick: -> $codearea = $('html') @@ -140,7 +140,7 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView attachTransitionEventListener: => transitionListener = '' testEl = document.createElement 'fakeelement' - transitions = + transitions = 'transition':'transitionend' 'OTransition':'oTransitionEnd' 'MozTransition':'transitionend' diff --git a/app/views/play/level/tome/SpellPaletteView.coffee b/app/views/play/level/tome/SpellPaletteView.coffee index 769cd8f92..6c00bd785 100644 --- a/app/views/play/level/tome/SpellPaletteView.coffee +++ b/app/views/play/level/tome/SpellPaletteView.coffee @@ -14,8 +14,8 @@ module.exports = class SpellPaletteView extends CocoView controlsEnabled: true subscriptions: - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'surface:frame-changed': 'onFrameChanged' 'tome:change-language': 'onTomeChangedLanguage' diff --git a/app/views/play/level/tome/SpellToolbarView.coffee b/app/views/play/level/tome/SpellToolbarView.coffee index 39916d56c..a3ed56b0e 100644 --- a/app/views/play/level/tome/SpellToolbarView.coffee +++ b/app/views/play/level/tome/SpellToolbarView.coffee @@ -7,8 +7,8 @@ module.exports = class SpellToolbarView extends CocoView progressHoverDelay: 500 subscriptions: - 'spell-step-backward': 'onStepBackward' - 'spell-step-forward': 'onStepForward' + 'tome:spell-step-backward': 'onStepBackward' + 'tome:spell-step-forward': 'onStepForward' events: 'mousemove .spell-progress': 'onProgressHover' @@ -100,7 +100,7 @@ module.exports = class SpellToolbarView extends CocoView @maintainIndexScrub = true clearTimeout @maintainIndexScrubTimeout if @maintainIndexScrubTimeout @maintainIndexScrubTimeout = _.delay (=> @maintainIndexScrub = false), 500 - Backbone.Mediator.publish 'level-set-time', time: @statementTime, scrubDuration: 500 + Backbone.Mediator.publish 'level:set-time', time: @statementTime, scrubDuration: 500 updateScroll: -> return unless statementStart = @callState?.statements?[@statementIndex]?.range[0] diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 80c86296f..d23212a5d 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -31,8 +31,8 @@ module.exports = class SpellView extends CocoView 'emacs': 'ace/keyboard/emacs' subscriptions: - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'surface:frame-changed': 'onFrameChanged' 'surface:coordinate-selected': 'onCoordinateSelected' 'god:new-world-created': 'onNewWorld' @@ -42,14 +42,14 @@ module.exports = class SpellView extends CocoView 'tome:reload-code': 'onCodeReload' 'tome:spell-changed': 'onSpellChanged' 'level:session-will-save': 'onSessionWillSave' - 'modal-closed': 'focus' + 'modal:closed': 'focus' 'tome:focus-editor': 'focus' 'tome:spell-statement-index-updated': 'onStatementIndexUpdated' 'tome:change-language': 'onChangeLanguage' 'tome:change-config': 'onChangeEditorConfig' 'tome:update-snippets': 'addZatannaSnippets' 'tome:insert-snippet': 'onInsertSnippet' - 'spell-beautify': 'onSpellBeautify' + 'tome:spell-beautify': 'onSpellBeautify' 'script:state-changed': 'onScriptStateChange' events: @@ -125,7 +125,7 @@ module.exports = class SpellView extends CocoView addCommand name: 'toggle-playing' bindKey: {win: 'Ctrl-P', mac: 'Command-P|Ctrl-P'} - exec: -> Backbone.Mediator.publish 'level-toggle-playing' + exec: -> Backbone.Mediator.publish 'level:toggle-playing', {} addCommand name: 'end-current-script' bindKey: {win: 'Shift-Space', mac: 'Shift-Space'} @@ -134,46 +134,46 @@ module.exports = class SpellView extends CocoView # Maybe we could temporarily set ourselves to read-only if we somehow know that a script is active? exec: => if @scriptRunning - Backbone.Mediator.publish 'level:shift-space-pressed' + Backbone.Mediator.publish 'level:shift-space-pressed', {} else @ace.insert ' ' addCommand name: 'end-all-scripts' bindKey: {win: 'Escape', mac: 'Escape'} - exec: -> Backbone.Mediator.publish 'level:escape-pressed' + exec: -> Backbone.Mediator.publish 'level:escape-pressed', {} addCommand name: 'toggle-grid' bindKey: {win: 'Ctrl-G', mac: 'Command-G|Ctrl-G'} - exec: -> Backbone.Mediator.publish 'level-toggle-grid' + exec: -> Backbone.Mediator.publish 'level:toggle-grid', {} addCommand name: 'toggle-debug' bindKey: {win: 'Ctrl-\\', mac: 'Command-\\|Ctrl-\\'} - exec: -> Backbone.Mediator.publish 'level-toggle-debug' + exec: -> Backbone.Mediator.publish 'level:toggle-debug', {} addCommand name: 'toggle-pathfinding' bindKey: {win: 'Ctrl-O', mac: 'Command-O|Ctrl-O'} - exec: -> Backbone.Mediator.publish 'level-toggle-pathfinding' + exec: -> Backbone.Mediator.publish 'level:toggle-pathfinding', {} addCommand name: 'level-scrub-forward' bindKey: {win: 'Ctrl-]', mac: 'Command-]|Ctrl-]'} - exec: -> Backbone.Mediator.publish 'level-scrub-forward' + exec: -> Backbone.Mediator.publish 'level:scrub-forward', {} addCommand name: 'level-scrub-back' bindKey: {win: 'Ctrl-[', mac: 'Command-[|Ctrl-]'} - exec: -> Backbone.Mediator.publish 'level-scrub-back' + exec: -> Backbone.Mediator.publish 'level:scrub-back', {} addCommand name: 'spell-step-forward' bindKey: {win: 'Ctrl-Alt-]', mac: 'Command-Alt-]|Ctrl-Alt-]'} - exec: -> Backbone.Mediator.publish 'spell-step-forward' + exec: -> Backbone.Mediator.publish 'tome:spell-step-forward', {} addCommand name: 'spell-step-backward' bindKey: {win: 'Ctrl-Alt-[', mac: 'Command-Alt-[|Ctrl-Alt-]'} - exec: -> Backbone.Mediator.publish 'spell-step-backward' + exec: -> Backbone.Mediator.publish 'tome:spell-step-backward', {} addCommand name: 'spell-beautify' bindKey: {win: 'Ctrl-Shift-B', mac: 'Command-Shift-B|Ctrl-Shift-B'} - exec: -> Backbone.Mediator.publish 'spell-beautify' + exec: -> Backbone.Mediator.publish 'tome:spell-beautify', {} addCommand name: 'prevent-line-jump' bindKey: {win: 'Ctrl-L', mac: 'Command-L'} @@ -182,7 +182,7 @@ module.exports = class SpellView extends CocoView addCommand name: 'open-fullscreen-editor' bindKey: {win: 'Alt-Shift-F', mac: 'Ctrl-Shift-F'} - exec: -> Backbone.Mediator.publish 'tome:fullscreen-view' + exec: -> Backbone.Mediator.publish 'tome:fullscreen-view', {} fillACE: -> @ace.setValue @spell.source @@ -281,11 +281,11 @@ module.exports = class SpellView extends CocoView notifyEditingEnded: => return if @aceDoc.undergoingFirepadOperation # from my Firepad ACE adapter - Backbone.Mediator.publish('tome:editing-ended') + Backbone.Mediator.publish 'tome:editing-ended', {} notifyEditingBegan: => return if @aceDoc.undergoingFirepadOperation # from my Firepad ACE adapter - Backbone.Mediator.publish('tome:editing-began') + Backbone.Mediator.publish 'tome:editing-began', {} onManualCast: (e) -> cast = @$el.parent().length diff --git a/app/views/play/level/tome/ThangListEntryView.coffee b/app/views/play/level/tome/ThangListEntryView.coffee index 442dbe0e9..52bfe8ce0 100644 --- a/app/views/play/level/tome/ThangListEntryView.coffee +++ b/app/views/play/level/tome/ThangListEntryView.coffee @@ -16,10 +16,10 @@ module.exports = class ThangListEntryView extends CocoView subscriptions: 'tome:problems-updated': 'onProblemsUpdated' - 'level-disable-controls': 'onDisableControls' - 'level-enable-controls': 'onEnableControls' + 'level:disable-controls': 'onDisableControls' + 'level:enable-controls': 'onEnableControls' 'surface:frame-changed': 'onFrameChanged' - 'level-set-letterbox': 'onSetLetterbox' + 'level:set-letterbox': 'onSetLetterbox' 'tome:thang-list-entry-popover-shown': 'onThangListEntryPopoverShown' 'surface:coordinates-shown': 'onSurfaceCoordinatesShown' @@ -83,7 +83,7 @@ module.exports = class ThangListEntryView extends CocoView onClick: (e) -> return unless @controlsEnabled @sortSpells() - Backbone.Mediator.publish 'level-select-sprite', thangID: @thang.id, spellName: @spells[0]?.name + Backbone.Mediator.publish 'level:select-sprite', thangID: @thang.id, spellName: @spells[0]?.name onMouseEnter: (e) -> return unless @controlsEnabled and @spells.length @@ -122,7 +122,7 @@ module.exports = class ThangListEntryView extends CocoView @popover.mouseleave (e) => @hideSpells() thangID = @thang.id @popover.find('code').click (e) -> - Backbone.Mediator.publish 'level-select-sprite', thangID: thangID, spellName: $(@).data 'spell-name' + Backbone.Mediator.publish 'level:select-sprite', thangID: thangID, spellName: $(@).data 'spell-name' Backbone.Mediator.publish 'tome:thang-list-entry-popover-shown', entry: @ hideSpells: => diff --git a/app/views/play/level/tome/TomeView.coffee b/app/views/play/level/tome/TomeView.coffee index 246fae8d3..87fef0715 100644 --- a/app/views/play/level/tome/TomeView.coffee +++ b/app/views/play/level/tome/TomeView.coffee @@ -168,7 +168,7 @@ module.exports = class TomeView extends CocoView @spellList.$el.hide() onClick: (e) -> - Backbone.Mediator.publish 'tome:focus-editor' unless $(e.target).parents('.popover').length + Backbone.Mediator.publish 'tome:focus-editor', {} unless $(e.target).parents('.popover').length clearSpellView: -> @spellView?.dismiss() diff --git a/app/views/user/JobProfileView.coffee b/app/views/user/JobProfileView.coffee index 836b75676..6d5448ba5 100644 --- a/app/views/user/JobProfileView.coffee +++ b/app/views/user/JobProfileView.coffee @@ -32,7 +32,7 @@ module.exports = class JobProfileView extends UserView showBackground: false subscriptions: - 'linkedin-loaded': 'onLinkedInLoaded' + 'auth:linkedin-api-loaded': 'onLinkedInLoaded' events: 'click #toggle-editing': 'toggleEditing' diff --git a/bower.json b/bower.json index 8ac33ff3c..e6b9d3868 100644 --- a/bower.json +++ b/bower.json @@ -39,7 +39,7 @@ "d3": "~3.4.4", "jsondiffpatch": "~0.1.5", "nanoscroller": "~0.8.0", - "jquery.tablesorter": "~2.15.13", + "jquery.tablesorter": "~2", "treema": "~0.0.14", "bootstrap": "~3.1.1", "validated-backbone-mediator": "~0.1.3", diff --git a/test/app/lib/FacebookHandler.spec.coffee b/test/app/lib/FacebookHandler.spec.coffee index 49766391e..f808ea1e5 100644 --- a/test/app/lib/FacebookHandler.spec.coffee +++ b/test/app/lib/FacebookHandler.spec.coffee @@ -62,7 +62,7 @@ describe 'lib/FacebookHandler.coffee', -> spyOn FB, 'api' new FacebookHandler() - Backbone.Mediator.publish 'facebook-logged-in', mockAuthEvent + Backbone.Mediator.publish 'auth:logged-in-with-facebook', mockAuthEvent expect(FB.api).toHaveBeenCalled() apiArgs = FB.api.calls.argsFor(0) diff --git a/test/app/lib/ScriptManager.spec.coffee b/test/app/lib/ScriptManager.spec.coffee index 1bf82b168..6cfcdbf64 100644 --- a/test/app/lib/ScriptManager.spec.coffee +++ b/test/app/lib/ScriptManager.spec.coffee @@ -108,7 +108,7 @@ describe('ScriptManager', -> expect(gotCnnEvent[1]).toBe(1) expect(gotCbsEvent).toBeNull() expect(sm.scriptInProgress).toBe(true) - runs(-> Backbone.Mediator.publish('end-current-script')) + runs(-> Backbone.Mediator.publish('script:end-current-script')) f = -> gotCbsEvent? waitsFor(f, 'The next event should have been published', 20) f = -> @@ -144,7 +144,7 @@ describe('ScriptManager', -> expect(gotCbsEvent).toBeNull() # channel2 needs to be triggered again Backbone.Mediator.publish('channel2') expect(gotCbsEvent).toBeNull() # channel1 is still waiting for user confirmation - Backbone.Mediator.publish('end-current-script') + Backbone.Mediator.publish('script:end-current-script') expect(gotCbsEvent[1]).toBe(2) # and finally the second script is fired sm.destroy() Backbone.Mediator.unsubscribe('cnn', f, @)