mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 18:15:52 -05:00
Merge pull request #528 from codecombat/master
Merge master into production
This commit is contained in:
commit
8440968ea5
39 changed files with 266 additions and 196 deletions
|
@ -167,18 +167,19 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
@imageObject?.play?()
|
||||
mark.play() for name, mark of @marks
|
||||
|
||||
update: ->
|
||||
update: (frameChanged) ->
|
||||
# Gets the sprite to reflect what the current state of the thangs and surface are
|
||||
return if @stillLoading
|
||||
@updatePosition()
|
||||
@updateScale()
|
||||
@updateAlpha()
|
||||
@updateRotation()
|
||||
@updateAction()
|
||||
@updateStats()
|
||||
if frameChanged
|
||||
@updateScale()
|
||||
@updateAlpha()
|
||||
@updateRotation()
|
||||
@updateAction()
|
||||
@updateStats()
|
||||
@updateGold()
|
||||
@updateMarks()
|
||||
@updateLabels()
|
||||
@updateGold()
|
||||
|
||||
cache: ->
|
||||
bounds = @imageObject.getBounds()
|
||||
|
@ -251,7 +252,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
return unless @currentAction
|
||||
return if _.string.endsWith(@currentAction.name, 'back')
|
||||
return if _.string.endsWith(@currentAction.name, 'fore')
|
||||
@imageObject.scaleX *= -1 if Math.abs(rotation) >= 90
|
||||
imageObject.scaleX *= -1 if Math.abs(rotation) >= 90
|
||||
|
||||
##################################################
|
||||
updateAction: ->
|
||||
|
@ -402,6 +403,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
|
||||
if @previousEffectNames
|
||||
for effect in @previousEffectNames
|
||||
continue if effect in @thang.effectNames
|
||||
mark = @marks[effect]
|
||||
mark.toggle false
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ module.exports = class Mark extends CocoClass
|
|||
onLoadedThangType: ->
|
||||
@build()
|
||||
@toggle(@toggleTo) if @toggleTo?
|
||||
Backbone.Mediator.publish 'sprite:loaded'
|
||||
|
||||
update: (pos=null) ->
|
||||
return false unless @on and @mark
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = class MusicPlayer extends CocoClass
|
|||
src = e.file
|
||||
if src
|
||||
src = "/file#{src}#{AudioPlayer.ext}"
|
||||
return @currentMusic.play() if src is @currentMusic?.src
|
||||
return @currentMusic.play('none', 0, 0, -1, 0.3) if src is @currentMusic?.src
|
||||
media = AudioPlayer.getStatus(src)
|
||||
if not media?.loaded
|
||||
AudioPlayer.preloadSound(src)
|
||||
|
|
|
@ -22,6 +22,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
'god:new-world-created': 'onNewWorld'
|
||||
'tome:cast-spells': 'onCastSpells'
|
||||
'camera:dragged': 'onCameraDragged'
|
||||
'sprite:loaded': -> @update(true)
|
||||
|
||||
constructor: (@options) ->
|
||||
super()
|
||||
|
@ -158,7 +159,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
|
||||
update: (frameChanged) ->
|
||||
@adjustSpriteExistence() if frameChanged
|
||||
sprite.update() for thangID, sprite of @sprites
|
||||
sprite.update frameChanged for thangID, sprite of @sprites
|
||||
@updateSelection()
|
||||
@spriteLayers["Default"].updateLayerOrder()
|
||||
@cache()
|
||||
|
@ -181,7 +182,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
sprite.hasMoved = false
|
||||
@removeSprite sprite if missing
|
||||
@cache true if updateCache and @cached
|
||||
|
||||
|
||||
# mainly for handling selecting thangs from session when the thang is not always in existence
|
||||
if @willSelectThang and @sprites[@willSelectThang[0]]
|
||||
@selectThang @willSelectThang...
|
||||
|
@ -212,12 +213,12 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
@play()
|
||||
|
||||
onCastSpells: -> @stop()
|
||||
|
||||
|
||||
play: ->
|
||||
sprite.imageObject.play() for thangID, sprite of @sprites
|
||||
@selectionMark?.play()
|
||||
@targetMark?.play()
|
||||
|
||||
|
||||
stop: ->
|
||||
sprite.imageObject.stop() for thangID, sprite of @sprites
|
||||
@selectionMark?.stop()
|
||||
|
|
|
@ -208,10 +208,12 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@onFramesScrubbed() # For performance, don't play these for instant transitions.
|
||||
onTweenEnd()
|
||||
|
||||
return unless @loaded
|
||||
@updateState true
|
||||
@onFrameChanged()
|
||||
|
||||
onFramesScrubbed: (e) =>
|
||||
return unless @loaded
|
||||
if e
|
||||
# Gotta play all the sounds when scrubbing (but not when doing an immediate transition).
|
||||
rising = @currentFrame > @lastFrame
|
||||
|
|
|
@ -250,6 +250,8 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
|
|||
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"
|
||||
|
@ -271,6 +273,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
|
|||
body: "Body"
|
||||
version: "Version"
|
||||
commit_msg: "Commit Message"
|
||||
history: "History"
|
||||
version_history_for: "Version History for: "
|
||||
results: "Results"
|
||||
description: "Description"
|
||||
|
@ -278,6 +281,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
|
|||
email: "Email"
|
||||
password: "Password"
|
||||
message: "Message"
|
||||
code: "Code"
|
||||
|
||||
about:
|
||||
who_is_codecombat: "Who is CodeCombat?"
|
||||
|
|
|
@ -244,6 +244,8 @@ module.exports = nativeDescription: "Nederlands", englishDescription: "Dutch", t
|
|||
level_components_title: "Terug naar Alle Elementen"
|
||||
level_components_type: "Type"
|
||||
level_component_edit_title: "Wijzig Component"
|
||||
level_component_config_schema: "Schema"
|
||||
level_component_settings: "Instellingen"
|
||||
level_system_edit_title: "Wijzig Systeem"
|
||||
create_system_title: "Maak een nieuw Systeem aan"
|
||||
new_component_title: "Maak een nieuw Component aan"
|
||||
|
@ -265,12 +267,14 @@ module.exports = nativeDescription: "Nederlands", englishDescription: "Dutch", t
|
|||
body: "Inhoud"
|
||||
version: "Versie"
|
||||
commit_msg: "Commit Bericht"
|
||||
history: "Geschiedenis"
|
||||
version_history_for: "Versie geschiedenis voor: "
|
||||
results: "Resultaten"
|
||||
description: "Beschrijving"
|
||||
or: "of"
|
||||
email: "Email"
|
||||
message: "Bericht"
|
||||
code: "Code"
|
||||
|
||||
about:
|
||||
who_is_codecombat: "Wie is CodeCombat?"
|
||||
|
|
|
@ -81,8 +81,9 @@ class CocoModel extends Backbone.Model
|
|||
return super attrs, options
|
||||
|
||||
fetch: ->
|
||||
super(arguments...)
|
||||
res = super(arguments...)
|
||||
@loading = true
|
||||
res
|
||||
|
||||
markToRevert: ->
|
||||
@_revertAttributes = _.clone @attributes
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
@import "app/styles/bootstrap/mixins"
|
||||
@import "app/styles/mixins"
|
||||
|
||||
body
|
||||
height: 100%
|
||||
|
||||
#spectate-level-view
|
||||
margin: 0 auto
|
||||
height: 100%
|
||||
@include user-select(none)
|
||||
|
||||
.level-content
|
||||
|
@ -11,6 +14,7 @@
|
|||
#canvas-wrapper
|
||||
width: 55%
|
||||
position: relative
|
||||
margin: 0 auto
|
||||
|
||||
canvas#surface
|
||||
background-color: #ddd
|
||||
|
@ -22,18 +26,15 @@
|
|||
//max-width: 1680px // guideline, but for now let's let it stretch out
|
||||
min-width: 1024px
|
||||
position: relative
|
||||
|
||||
#code-area
|
||||
@include box-sizing(border-box)
|
||||
padding: 10px 1%
|
||||
width: 45%
|
||||
background: transparent url(/images/level/wood_texture.png)
|
||||
background-size: 100% 100%
|
||||
position: absolute
|
||||
right: 0
|
||||
top: 0px
|
||||
bottom: 0
|
||||
|
||||
#playback-view
|
||||
margin: 0 auto
|
||||
#thang-hud
|
||||
margin: 0 auto
|
||||
|
||||
#control-bar-view
|
||||
margin: 0 auto
|
||||
.title
|
||||
margin-left: 500px
|
||||
#pointer
|
||||
position: absolute
|
||||
left: 0
|
||||
|
|
|
@ -10,6 +10,7 @@ block content
|
|||
li.active
|
||||
| #{article.attributes.name}
|
||||
|
||||
button(data-i18n="general.history").btn.btn-primary#history-button History
|
||||
button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="editor.revert", disabled=authorized === true ? undefined : "true").btn.btn-primary#revert-button Revert
|
||||
button(data-i18n="article.edit_btn_preview", disabled=authorized === true ? undefined : "true").btn.btn-primary#preview-button Preview
|
||||
button(data-toggle="coco-modal", data-target="modal/save_version", data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/article/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/article/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
td #{data.version.major}.#{data.version.minor}
|
|
@ -1,21 +1,21 @@
|
|||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/component/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/component/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
td #{data.version.major}.#{data.version.minor}
|
|
@ -9,11 +9,13 @@ nav.navbar.navbar-default(role='navigation')
|
|||
.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav.nav-tabs
|
||||
li.active
|
||||
a(href="#component-code" data-toggle="tab") Code
|
||||
a(href="#component-code" data-toggle="tab" data-i18n="general.code") Code
|
||||
li
|
||||
a(href="#component-config-schema" data-toggle="tab") Config Schema
|
||||
a(href="#component-config-schema" data-toggle="tab" data-i18n="editor.level_component_config_schema") Config Schema
|
||||
li
|
||||
a(href="#component-settings" data-toggle="tab") Settings
|
||||
a(href="#component-settings" data-toggle="tab" data-i18n="editor.level_component_settings") Settings
|
||||
ul.nav.navbar-nav.navbar-left
|
||||
li(data-i18n="general.history").btn.btn-primary.navbar-btn#history-button History
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
li(data-i18n="editor.level_component_btn_new").btn.btn-primary.navbar-btn#create-new-component-button Create New Component
|
||||
|
||||
|
|
|
@ -38,9 +38,11 @@ block outer_content
|
|||
|
||||
li.dropdown
|
||||
a.dropdown-toggle(href='#', data-toggle='dropdown')
|
||||
| Help
|
||||
| More
|
||||
b.caret
|
||||
ul.dropdown-menu
|
||||
li#history-button
|
||||
a(href='#', data-i18n="general.version_history") Version History
|
||||
li
|
||||
a(href='https://github.com/codecombat/codecombat/wiki/Artisan-Home') Wiki
|
||||
li
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/level/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/level/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
td #{data.version.major}.#{data.version.minor}
|
|
@ -12,6 +12,7 @@ block content
|
|||
|
||||
img#portrait.img-thumbnail
|
||||
|
||||
button.btn.btn-secondary#history-button(data-i18n="general.history") History
|
||||
button.btn.btn-primary#save-button(data-toggle="coco-modal", data-target="modal/save_version", disabled=authorized === true ? undefined : "true") Save
|
||||
button.btn.btn-primary#revert-button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="editor.revert", disabled=authorized === true ? undefined : "true") Revert
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th#portrait-col
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
- path = '/file/db/thang.type/'+data.original+'/portrait.png'
|
||||
img(title="Add " + data.name, src=path, alt="").portrait
|
||||
td
|
||||
a(href="/editor/thang/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th#portrait-col
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
- path = '/file/db/thang.type/'+data.original+'/portrait.png'
|
||||
img(title="Add " + data.name, src=path, alt="").portrait
|
||||
td
|
||||
a(href="/editor/thang/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
td #{data.version.major}.#{data.version.minor}
|
|
@ -1,21 +1,21 @@
|
|||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/#{page}/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
table.table
|
||||
tr
|
||||
th(colspan=3)
|
||||
span(data-i18n="general.results")
|
||||
| Results
|
||||
span
|
||||
|: #{documents.length}
|
||||
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.description") Description
|
||||
th(data-i18n="general.version") Version
|
||||
|
||||
for data in documents
|
||||
- data = data.attributes;
|
||||
tr
|
||||
td
|
||||
a(href="/editor/#{page}/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td.body-row #{data.description}
|
||||
td #{data.version.major}.#{data.version.minor}
|
|
@ -1,19 +1,24 @@
|
|||
extends /templates/base
|
||||
|
||||
block content
|
||||
if dataList
|
||||
h3(data-i18n="general.version_history_for") Version History for: "#{dataList[0].name}"
|
||||
|
||||
table.table
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.version") Version
|
||||
th(data-i18n="general.commit_msg") Commit Message
|
||||
|
||||
for data in dataList
|
||||
tr
|
||||
td
|
||||
a(href="/editor/#{page}/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td #{data.version.major}.#{data.version.minor}
|
||||
td #{data.commitMessage}
|
||||
extends /templates/modal/modal_base
|
||||
|
||||
block modal-header-content
|
||||
if dataList
|
||||
h3
|
||||
span(data-i18n="general.version_history_for") Version History for:
|
||||
|"#{dataList[0].name}"
|
||||
|
||||
block modal-body-content
|
||||
if dataList
|
||||
table.table
|
||||
tr
|
||||
th(data-i18n="general.name") Name
|
||||
th(data-i18n="general.version") Version
|
||||
th(data-i18n="general.commit_msg") Commit Message
|
||||
for data in dataList
|
||||
tr
|
||||
td
|
||||
a(href="/editor/#{page}/#{data.slug || data._id}")
|
||||
| #{data.name}
|
||||
td #{data.version.major}.#{data.version.minor}
|
||||
td #{data.commitMessage}
|
||||
|
||||
block modal-footer-content
|
|
@ -11,12 +11,4 @@
|
|||
.footer
|
||||
.content
|
||||
p(class='footer-link-text')
|
||||
a(title='Send CodeCombat a message', tabindex=-1, data-toggle="coco-modal", data-target="modal/contact", data-i18n="nav.contact") Contact
|
||||
if explainHourOfCode
|
||||
// Does not show up unless lang is en-US.
|
||||
div.hour-of-code-explanation
|
||||
| The 'Hour of Code' is a nationwide initiative by
|
||||
a(href="http://csedweek.org") Computer Science Education Week
|
||||
| and
|
||||
a(href="http://code.org") Code.org
|
||||
| to introduce millions of students to one hour of computer science and computer programming.
|
||||
a(title='Send CodeCombat a message', tabindex=-1, data-toggle="coco-modal", data-target="modal/contact", data-i18n="nav.contact") Contact
|
|
@ -107,7 +107,7 @@ class SoundFileTreema extends TreemaNode.nodeMap.string
|
|||
if @data
|
||||
valEl.append(playButton)
|
||||
valEl.append(stopButton)
|
||||
valEl.append(dropdown) if files.length
|
||||
valEl.append(dropdown) if files.length and @canEdit()
|
||||
if @data
|
||||
path = @data.split('/')
|
||||
name = path[path.length-1]
|
||||
|
|
|
@ -19,4 +19,6 @@ module.exports = class ArtisanView extends ContributeClassView
|
|||
{name: "Axandre Oge", avatar: "axandre"}
|
||||
{name: "Katharine Chan", avatar: "katharine"}
|
||||
{name: "Derek Wong", avatar: "derek"}
|
||||
{name: "Alexandru Caciulescu", avatar: ""}
|
||||
{name: "Prabh Simran Singh Baweja", avatar: ""}
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
View = require 'views/kinds/RootView'
|
||||
VersionHistoryView = require './versions_view'
|
||||
template = require 'templates/editor/article/edit'
|
||||
Article = require 'models/Article'
|
||||
|
||||
|
@ -9,6 +10,7 @@ module.exports = class ArticleEditView extends View
|
|||
|
||||
events:
|
||||
'click #preview-button': 'openPreview'
|
||||
'click #history-button': 'showVersionHistory'
|
||||
|
||||
subscriptions:
|
||||
'save-new-version': 'saveNewArticle'
|
||||
|
@ -84,3 +86,8 @@ module.exports = class ArticleEditView extends View
|
|||
modal.modal('hide')
|
||||
url = "/editor/article/#{newArticle.get('slug') or newArticle.id}"
|
||||
document.location.href = url
|
||||
|
||||
showVersionHistory: (e) ->
|
||||
versionHistoryView = new VersionHistoryView article:@article, @articleID
|
||||
@openModalView versionHistoryView
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
VersionsView = require 'views/kinds/VersionsView'
|
||||
VersionsModalView = require 'views/modal/versions_modal'
|
||||
|
||||
module.exports = class SuperVersionsView extends VersionsView
|
||||
module.exports = class ArticleVersionsView extends VersionsModalView
|
||||
id: "editor-article-versions-view"
|
||||
url: "/db/article/"
|
||||
page: "article"
|
|
@ -1,6 +1,6 @@
|
|||
VersionsView = require 'views/kinds/VersionsView'
|
||||
VersionsModalView = require 'views/modal/versions_modal'
|
||||
|
||||
module.exports = class SuperVersionsView extends VersionsView
|
||||
module.exports = class ComponentVersionsView extends VersionsModalView
|
||||
id: "editor-component-versions-view"
|
||||
url: "/db/level.component/"
|
||||
page: "component"
|
|
@ -1,4 +1,5 @@
|
|||
View = require 'views/kinds/CocoView'
|
||||
VersionHistoryView = require 'views/editor/component/versions_view'
|
||||
template = require 'templates/editor/level/component/edit'
|
||||
LevelComponent = require 'models/LevelComponent'
|
||||
|
||||
|
@ -9,6 +10,7 @@ module.exports = class LevelComponentEditView extends View
|
|||
|
||||
events:
|
||||
'click #done-editing-component-button': 'endEditing'
|
||||
'click #history-button': 'showVersionHistory'
|
||||
'click .nav a': (e) -> $(e.target).tab('show')
|
||||
|
||||
constructor: (options) ->
|
||||
|
@ -91,3 +93,8 @@ module.exports = class LevelComponentEditView extends View
|
|||
destroy: ->
|
||||
@editor?.destroy()
|
||||
super()
|
||||
|
||||
showVersionHistory: (e) ->
|
||||
versionHistoryView = new VersionHistoryView component:@levelComponent, @levelComponent.id
|
||||
@openModalView versionHistoryView
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
|
@ -12,6 +12,7 @@ ComponentsTabView = require './components_tab_view'
|
|||
SystemsTabView = require './systems_tab_view'
|
||||
LevelSaveView = require './save_view'
|
||||
LevelForkView = require './fork_view'
|
||||
VersionHistoryView = require './versions_view'
|
||||
|
||||
module.exports = class EditorLevelView extends View
|
||||
id: "editor-level-view"
|
||||
|
@ -23,6 +24,7 @@ module.exports = class EditorLevelView extends View
|
|||
'click #play-button': 'onPlayLevel'
|
||||
'click #commit-level-start-button': 'startCommittingLevel'
|
||||
'click #fork-level-start-button': 'startForkingLevel'
|
||||
'click #history-button': 'showVersionHistory'
|
||||
|
||||
constructor: (options, @levelID) ->
|
||||
super options
|
||||
|
@ -102,3 +104,8 @@ module.exports = class EditorLevelView extends View
|
|||
levelForkView = new LevelForkView level: @level
|
||||
@openModalView levelForkView
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
||||
|
||||
showVersionHistory: (e) ->
|
||||
versionHistoryView = new VersionHistoryView level:@level, @levelID
|
||||
@openModalView versionHistoryView
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
|
@ -1,6 +1,6 @@
|
|||
VersionsView = require 'views/kinds/VersionsView'
|
||||
VersionsModalView = require 'views/modal/versions_modal'
|
||||
|
||||
module.exports = class SuperVersionsView extends VersionsView
|
||||
module.exports = class LevelVersionsView extends VersionsModalView
|
||||
id: "editor-level-versions-view"
|
||||
url: "/db/level/"
|
||||
page: "level"
|
|
@ -6,6 +6,7 @@ SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
|||
CocoSprite = require 'lib/surface/CocoSprite'
|
||||
Camera = require 'lib/surface/Camera'
|
||||
ThangComponentEditView = require 'views/editor/components/main'
|
||||
VersionHistoryView = require './versions_view'
|
||||
DocumentFiles = require 'collections/DocumentFiles'
|
||||
|
||||
ColorsTabView = require './colors_tab_view'
|
||||
|
@ -30,6 +31,7 @@ module.exports = class ThangTypeEditView extends View
|
|||
'change #animations-select': 'showAnimation'
|
||||
'click #marker-button': 'toggleDots'
|
||||
'click #end-button': 'endAnimation'
|
||||
'click #history-button': 'showVersionHistory'
|
||||
|
||||
subscriptions:
|
||||
'save-new-version': 'saveNewThangType'
|
||||
|
@ -383,3 +385,8 @@ module.exports = class ThangTypeEditView extends View
|
|||
destroy: ->
|
||||
@camera?.destroy()
|
||||
super()
|
||||
|
||||
showVersionHistory: (e) ->
|
||||
versionHistoryView = new VersionHistoryView thangType:@thangType, @thangTypeID
|
||||
@openModalView versionHistoryView
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
VersionsView = require 'views/kinds/VersionsView'
|
||||
VersionsModalView = require 'views/modal/versions_modal'
|
||||
|
||||
module.exports = class SuperVersionsView extends VersionsView
|
||||
module.exports = class ComponentVersionsView extends VersionsModalView
|
||||
id: "editor-thang-versions-view"
|
||||
url: "/db/thang.type/"
|
||||
page: "thang"
|
|
@ -1,5 +1,5 @@
|
|||
View = require 'views/kinds/RootView'
|
||||
template = require 'templates/kinds/versions'
|
||||
ModalView = require 'views/kinds/ModalView'
|
||||
template = require 'templates/modal/versions'
|
||||
tableTemplate = require 'templates/kinds/table'
|
||||
|
||||
class VersionsViewCollection extends Backbone.Collection
|
||||
|
@ -10,14 +10,14 @@ class VersionsViewCollection extends Backbone.Collection
|
|||
@url = url + levelID + '/versions'
|
||||
@model = model
|
||||
|
||||
module.exports = class SuperVersionsView extends View
|
||||
module.exports = class VersionsModalView extends ModalView
|
||||
template: template
|
||||
startsLoading: true
|
||||
|
||||
# needs to be overwritten by child
|
||||
id: ""
|
||||
url = ""
|
||||
page = ""
|
||||
url: ""
|
||||
page: ""
|
||||
|
||||
constructor: (options, @ID, @model) ->
|
||||
super options
|
|
@ -33,20 +33,15 @@ module.exports = class LadderView extends RootView
|
|||
constructor: (options, @levelID) ->
|
||||
super(options)
|
||||
@level = new Level(_id:@levelID)
|
||||
@level.fetch()
|
||||
@level.once 'sync', @onLevelLoaded, @
|
||||
p1 = @level.fetch()
|
||||
@sessions = new LevelSessionsCollection(levelID)
|
||||
@sessions.fetch({})
|
||||
@sessions.once 'sync', @onMySessionsLoaded, @
|
||||
p2 = @sessions.fetch({})
|
||||
@simulator = new Simulator()
|
||||
@simulator.on 'statusUpdate', @updateSimulationStatus, @
|
||||
@teams = []
|
||||
$.when(p1, p2).then @onLoaded
|
||||
|
||||
onLevelLoaded: -> @renderMaybe()
|
||||
onMySessionsLoaded: -> @renderMaybe()
|
||||
|
||||
renderMaybe: ->
|
||||
return unless @level.loaded and @sessions.loaded
|
||||
onLoaded: =>
|
||||
@teams = teamDataFromLevel @level
|
||||
@startsLoading = false
|
||||
@render()
|
||||
|
|
|
@ -44,6 +44,7 @@ module.exports = class SpellPaletteView extends View
|
|||
allDocs = {}
|
||||
for lc in lcs
|
||||
for doc in (lc.get('propertyDocumentation') ? [])
|
||||
doc = _.clone doc
|
||||
allDocs['__' + doc.name] ?= []
|
||||
allDocs['__' + doc.name].push doc
|
||||
if doc.type is 'snippet' then doc.owner = 'snippets'
|
||||
|
|
|
@ -91,6 +91,9 @@ module.exports = class SpellView extends View
|
|||
addCommand
|
||||
name: 'end-current-script'
|
||||
bindKey: {win: 'Shift-Space', mac: 'Shift-Space'}
|
||||
passEvent: true # https://github.com/ajaxorg/ace/blob/master/lib/ace/keyboard/keybinding.js#L114
|
||||
# No easy way to selectively cancel shift+space, since we don't get access to the event.
|
||||
# Maybe we could temporarily set ourselves to read-only if we somehow know that a script is active?
|
||||
exec: -> Backbone.Mediator.publish 'level:shift-space-pressed'
|
||||
addCommand
|
||||
name: 'end-all-scripts'
|
||||
|
|
|
@ -71,8 +71,10 @@ module.exports = class SpectateLevelView extends View
|
|||
constructor: (options, @levelID) ->
|
||||
console.profile?() if PROFILE_ME
|
||||
super options
|
||||
|
||||
@sessionID = @getQueryVariable 'session'
|
||||
@sessionOne = @getQueryVariable 'session-one'
|
||||
@sessionTwo = @getQueryVariable 'session-two'
|
||||
|
||||
@sessionID = @sessionOne
|
||||
|
||||
$(window).on('resize', @onWindowResize)
|
||||
@supermodel.once 'error', @onLevelLoadError
|
||||
|
@ -91,7 +93,7 @@ module.exports = class SpectateLevelView extends View
|
|||
@load()
|
||||
|
||||
load: ->
|
||||
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @getQueryVariable('opponent'), team: @getQueryVariable("team")
|
||||
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @sessionTwo, team: @getQueryVariable("team")
|
||||
@levelLoader.once 'loaded-all', @onLevelLoaderLoaded, @
|
||||
@levelLoader.on 'progress', @onLevelLoaderProgressChanged, @
|
||||
@god = new God()
|
||||
|
@ -135,9 +137,8 @@ module.exports = class SpectateLevelView extends View
|
|||
@loadingScreen.showReady()
|
||||
return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @
|
||||
|
||||
localStorage["lastLevel"] = @levelID if localStorage?
|
||||
@grabLevelLoaderData()
|
||||
team = @getQueryVariable("team") ? @world.teamForPlayer(0)
|
||||
team = @world.teamForPlayer(0)
|
||||
@loadOpponentTeam(team)
|
||||
@loadingScreen.destroy()
|
||||
@god.level = @level.serialize @supermodel
|
||||
|
@ -200,10 +201,9 @@ module.exports = class SpectateLevelView extends View
|
|||
insertSubviews: (subviewOptions) ->
|
||||
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, ladderGame: subviewOptions.ladderGame
|
||||
@insertSubView new PlaybackView {}
|
||||
@insertSubView new GoalsView {}
|
||||
|
||||
@insertSubView new GoldView {}
|
||||
@insertSubView new HUDView {}
|
||||
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
||||
worldName = @level.get('i18n')?[me.lang()]?.name ? @level.get('name')
|
||||
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel, playableTeams: @world.playableTeams, ladderGame: subviewOptions.ladderGame}
|
||||
#Backbone.Mediator.publish('level-set-debug', debug: true) if me.displayName() is 'Nick!'
|
||||
|
|
|
@ -161,6 +161,14 @@ module.exports = class PlayView extends View
|
|||
image: '/file/db/level/525ef8ef06e1ab0962000003/commanding_followers_icon.png'
|
||||
description: "Write a bubble sort to organize your soldiers. - by Alexandru"
|
||||
}
|
||||
{
|
||||
name: 'Sword Loop'
|
||||
difficulty: 1
|
||||
id: 'sword-loop'
|
||||
image: '/file/db/level/525dc5589a0765e496000006/drink_me_icon.png'
|
||||
description: 'Kill the ogres and save the peasants and their cattle. - by Prabh Simran Singh Baweja'
|
||||
}
|
||||
|
||||
{
|
||||
name: 'Enemy Artillery'
|
||||
difficulty: 1
|
||||
|
|
|
@ -16,7 +16,7 @@ sendwithus = require '../sendwithus'
|
|||
module.exports.setup = (app) ->
|
||||
app.all config.mail.mailchimpWebhook, handleMailchimpWebHook
|
||||
app.get '/mail/cron/ladder-update', handleLadderUpdate
|
||||
|
||||
|
||||
getAllLadderScores = (next) ->
|
||||
query = Level.find({type: 'ladder'})
|
||||
.select('levelID')
|
||||
|
@ -29,8 +29,20 @@ getAllLadderScores = (next) ->
|
|||
for team in ['humans', 'ogres']
|
||||
'I ... am not doing this.'
|
||||
|
||||
isRequestFromDesignatedCronHandler = (req, res) ->
|
||||
if req.ip isnt config.mail.cronHandlerPublicIP and req.ip isnt config.mail.cronHandlerPrivateIP
|
||||
console.log "UNAUTHORIZED ATTEMPT TO SEND TRANSACTIONAL LADDER EMAIL THROUGH CRON MAIL HANDLER"
|
||||
res.send("You aren't authorized to perform that action. Only the specified Cron handler may perform that action.")
|
||||
res.end()
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
handleLadderUpdate = (req, res) ->
|
||||
log.info("Going to see about sending ladder update emails.")
|
||||
requestIsFromDesignatedCronHandler = isRequestFromDesignatedCronHandler req, res
|
||||
unless requestIsFromDesignatedCronHandler then return
|
||||
|
||||
res.send('Great work, Captain Cron! I can take it from here.')
|
||||
res.end()
|
||||
# TODO: somehow fetch the histograms
|
||||
|
|
|
@ -26,7 +26,9 @@ config.mail =
|
|||
mailchimpAPIKey: process.env.COCO_MAILCHIMP_API_KEY or ""
|
||||
mailchimpWebhook: process.env.COCO_MAILCHIMP_WEBHOOK or "/mail/webhook"
|
||||
sendwithusAPIKey: process.env.COCO_SENDWITHUS_API_KEY or ""
|
||||
|
||||
cronHandlerPublicIP: process.env.COCO_CRON_PUBLIC_IP or ""
|
||||
cronHandlerPrivateIP: process.env.COCO_CRON_PRIVATE_IP or ""
|
||||
|
||||
config.queue =
|
||||
accessKeyId: process.env.COCO_AWS_ACCESS_KEY_ID or ""
|
||||
secretAccessKey: process.env.COCO_AWS_SECRET_ACCESS_KEY or ""
|
||||
|
|
|
@ -84,7 +84,7 @@ exports.setupMiddleware = (app) ->
|
|||
###Routing function implementations###
|
||||
|
||||
setupFallbackRouteToIndex = (app) ->
|
||||
app.get '*', (req, res) ->
|
||||
app.all '*', (req, res) ->
|
||||
res.sendfile path.join(__dirname, 'public', 'index.html')
|
||||
|
||||
setupFacebookCrossDomainCommunicationRoute = (app) ->
|
||||
|
|
Loading…
Reference in a new issue