mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
d79d66c175
15 changed files with 54 additions and 118 deletions
|
@ -4,7 +4,7 @@ CodeCombat
|
||||||
![](https://dl.dropboxusercontent.com/u/138899/GitHub%20Wikis/readme_00.png)
|
![](https://dl.dropboxusercontent.com/u/138899/GitHub%20Wikis/readme_00.png)
|
||||||
[![Build Status](https://travis-ci.org/codecombat/codecombat.png?branch=master)](https://travis-ci.org/codecombat/codecombat)
|
[![Build Status](https://travis-ci.org/codecombat/codecombat.png?branch=master)](https://travis-ci.org/codecombat/codecombat)
|
||||||
|
|
||||||
CodeCombat is a multiplayer programming game for learning how to code. **See the [Archmage developer wiki](https://github.com/codecombat/codecombat/wiki) for a dev setup guide, extensive documentation, and much more.**
|
CodeCombat is a multiplayer programming game for learning how to code. **See the [Archmage developer wiki](https://github.com/codecombat/codecombat/wiki/Archmage-Home) for a dev setup guide, extensive documentation, and much more.**
|
||||||
|
|
||||||
It's both a startup and a community project, completely open source under the [MIT and Creative Commons licenses](http://codecombat.com/legal). It's the largest open source [CoffeeScript](http://coffeescript.org/) project by lines of code, and since it's a game (with [really cool tech](https://github.com/codecombat/codecombat/wiki/Third-party-software-and-services)), it's really fun to hack on. Join us in teaching the world to code! Your contribution will go on to show millions of players how cool programming can be.
|
It's both a startup and a community project, completely open source under the [MIT and Creative Commons licenses](http://codecombat.com/legal). It's the largest open source [CoffeeScript](http://coffeescript.org/) project by lines of code, and since it's a game (with [really cool tech](https://github.com/codecombat/codecombat/wiki/Third-party-software-and-services)), it's really fun to hack on. Join us in teaching the world to code! Your contribution will go on to show millions of players how cool programming can be.
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,9 @@ module.exports = class SpriteBuilder
|
||||||
|
|
||||||
buildMovieClip: (animationName, movieClipArgs...) ->
|
buildMovieClip: (animationName, movieClipArgs...) ->
|
||||||
animData = @animationStore[animationName]
|
animData = @animationStore[animationName]
|
||||||
console.log "couldn't find animData from", @animationStore, "for", animationName unless animData
|
unless animData
|
||||||
|
console.error "couldn't find animData from", @animationStore, "for", animationName
|
||||||
|
return null
|
||||||
locals = {}
|
locals = {}
|
||||||
_.extend locals, @buildMovieClipShapes(animData.shapes)
|
_.extend locals, @buildMovieClipShapes(animData.shapes)
|
||||||
_.extend locals, @buildMovieClipContainers(animData.containers)
|
_.extend locals, @buildMovieClipContainers(animData.containers)
|
||||||
|
|
|
@ -91,6 +91,7 @@ module.exports = class ThangType extends CocoModel
|
||||||
for animation in @requiredRawAnimations()
|
for animation in @requiredRawAnimations()
|
||||||
name = animation.animation
|
name = animation.animation
|
||||||
mc = @vectorParser.buildMovieClip name
|
mc = @vectorParser.buildMovieClip name
|
||||||
|
continue unless mc
|
||||||
@builder.addMovieClip mc, null, animation.scale * @options.resolutionFactor
|
@builder.addMovieClip mc, null, animation.scale * @options.resolutionFactor
|
||||||
framesMap[animation.scale + "_" + name] = @builder._animations[name].frames
|
framesMap[animation.scale + "_" + name] = @builder._animations[name].frames
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ module.exports = class ThangType extends CocoModel
|
||||||
continue if name is 'portrait'
|
continue if name is 'portrait'
|
||||||
scale = action.scale ? @get('scale') ? 1
|
scale = action.scale ? @get('scale') ? 1
|
||||||
frames = framesMap[scale + "_" + action.animation]
|
frames = framesMap[scale + "_" + action.animation]
|
||||||
|
continue unless frames
|
||||||
frames = @mapFrames(action.frames, frames[0]) if action.frames?
|
frames = @mapFrames(action.frames, frames[0]) if action.frames?
|
||||||
next = true
|
next = true
|
||||||
next = action.goesTo if action.goesTo
|
next = action.goesTo if action.goesTo
|
||||||
|
@ -108,6 +110,7 @@ module.exports = class ThangType extends CocoModel
|
||||||
continue if name is 'portrait'
|
continue if name is 'portrait'
|
||||||
scale = @options.resolutionFactor * (action.scale or @get('scale') or 1)
|
scale = @options.resolutionFactor * (action.scale or @get('scale') or 1)
|
||||||
s = @vectorParser.buildContainerFromStore(action.container)
|
s = @vectorParser.buildContainerFromStore(action.container)
|
||||||
|
continue unless s
|
||||||
frame = @builder.addFrame(s, s.bounds, scale)
|
frame = @builder.addFrame(s, s.bounds, scale)
|
||||||
@builder.addAnimation name, [frame], false
|
@builder.addAnimation name, [frame], false
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,6 @@
|
||||||
top: 50px
|
top: 50px
|
||||||
border: 2px solid black
|
border: 2px solid black
|
||||||
border-top: none
|
border-top: none
|
||||||
|
|
||||||
|
.active > a, .active > a:hover, .active > a:focus
|
||||||
|
background-color: white !important
|
|
@ -16,10 +16,13 @@
|
||||||
li.navbar-btn
|
li.navbar-btn
|
||||||
margin-right: 5px
|
margin-right: 5px
|
||||||
|
|
||||||
|
#level-editor-top-nav
|
||||||
.nav-tabs
|
.nav-tabs
|
||||||
border-bottom: 0 !important
|
border-bottom: 0 !important
|
||||||
.active > a, .active > a:hover, .active > a:focus
|
.active > a, .active > a:hover, .active > a:focus
|
||||||
background-color: #eee !important
|
background-color: $BG !important
|
||||||
|
border-color: darken($BG, 50%)
|
||||||
|
border-bottom: 0
|
||||||
|
|
||||||
.outer-content
|
.outer-content
|
||||||
background-color: $BG
|
background-color: $BG
|
||||||
|
|
|
@ -10,3 +10,6 @@
|
||||||
top: 50px
|
top: 50px
|
||||||
border: 2px solid black
|
border: 2px solid black
|
||||||
border-top: none
|
border-top: none
|
||||||
|
|
||||||
|
.active > a, .active > a:hover, .active > a:focus
|
||||||
|
background-color: white !important
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
.well
|
.well
|
||||||
text-align: center
|
text-align: center
|
||||||
input
|
|
||||||
height: 14px
|
|
||||||
padding: 10px
|
padding: 10px
|
||||||
|
|
||||||
#thang-props
|
#thang-props
|
||||||
|
@ -15,51 +13,3 @@
|
||||||
#all-thangs-link
|
#all-thangs-link
|
||||||
float: left
|
float: left
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
//#editor-level-thang-edit-modal
|
|
||||||
// h3
|
|
||||||
// display: inline-block
|
|
||||||
//
|
|
||||||
// .modal-body
|
|
||||||
// height: 400px
|
|
||||||
//
|
|
||||||
// #choose-component-sidebar
|
|
||||||
// width: 40%
|
|
||||||
// box-sizing: border-box
|
|
||||||
// padding: 10px
|
|
||||||
// position: absolute
|
|
||||||
// right: 0
|
|
||||||
// height: 100%
|
|
||||||
// top: 0
|
|
||||||
//
|
|
||||||
// h4
|
|
||||||
// margin-top: 0
|
|
||||||
//
|
|
||||||
// ul.available-components-list
|
|
||||||
// position: absolute
|
|
||||||
// top: 40px
|
|
||||||
// bottom: 0
|
|
||||||
// right: 0
|
|
||||||
// overflow: scroll
|
|
||||||
// width: 100%
|
|
||||||
//
|
|
||||||
// margin: 0
|
|
||||||
// list-style-type: none
|
|
||||||
//
|
|
||||||
// li
|
|
||||||
// cursor: pointer
|
|
||||||
//
|
|
||||||
// #edit-thang-treema
|
|
||||||
// box-sizing: border-box
|
|
||||||
// float: left
|
|
||||||
// width: 55%
|
|
||||||
// position: absolute
|
|
||||||
// top: 0
|
|
||||||
// bottom: 0
|
|
||||||
// overflow: scroll
|
|
||||||
//
|
|
||||||
// .treema-ace.treema-edit
|
|
||||||
// max-width: 100%
|
|
||||||
// & > div
|
|
||||||
// width: inherit
|
|
||||||
//
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ block content
|
||||||
| Use the Level Editor in these steps, give or take:
|
| Use the Level Editor in these steps, give or take:
|
||||||
ul
|
ul
|
||||||
li
|
li
|
||||||
a(href="https://docs.google.com/document/d/117tMcL95T1KY8BDisr0iGi5Frb2ZvBJTC0us5hyQkJY/edit?usp=sharing", data-i18n="contribute.artisan_join_step1") Read the documentation.
|
a(href="https://github.com/codecombat/codecombat/wiki/Artisan-Home", data-i18n="contribute.artisan_join_step1") Read the documentation.
|
||||||
li
|
li
|
||||||
a(href="/editor/level", data-i18n="contribute.artisan_join_step2") Create a new level and explore existing levels.
|
a(href="/editor/level", data-i18n="contribute.artisan_join_step2") Create a new level and explore existing levels.
|
||||||
li
|
li
|
||||||
|
|
|
@ -154,7 +154,7 @@ block content
|
||||||
| Use the Level Editor in these steps, give or take:
|
| Use the Level Editor in these steps, give or take:
|
||||||
ul
|
ul
|
||||||
li
|
li
|
||||||
a(href="https://docs.google.com/document/d/117tMcL95T1KY8BDisr0iGi5Frb2ZvBJTC0us5hyQkJY/edit?usp=sharing", data-i18n="contribute.artisan_join_step1") Read the documentation.
|
a(href="https://github.com/codecombat/codecombat/wiki/Artisan-Home", data-i18n="contribute.artisan_join_step1") Read the documentation.
|
||||||
li
|
li
|
||||||
a(href="/editor/level", data-i18n="contribute.artisan_join_step2") Create a new level and explore existing levels.
|
a(href="/editor/level", data-i18n="contribute.artisan_join_step2") Create a new level and explore existing levels.
|
||||||
li
|
li
|
||||||
|
|
|
@ -9,18 +9,18 @@ nav.navbar.navbar-default(role='navigation')
|
||||||
.collapse.navbar-collapse
|
.collapse.navbar-collapse
|
||||||
ul.nav.navbar-nav.nav-tabs
|
ul.nav.navbar-nav.nav-tabs
|
||||||
li.active
|
li.active
|
||||||
a(href="#code" data-toggle="tab") Code
|
a(href="#component-code" data-toggle="tab") Code
|
||||||
li
|
li
|
||||||
a(href="#config-schema" data-toggle="tab") Config Schema
|
a(href="#component-config-schema" data-toggle="tab") Config Schema
|
||||||
li
|
li
|
||||||
a(href="#settings" data-toggle="tab") Settings
|
a(href="#component-settings" data-toggle="tab") Settings
|
||||||
ul.nav.navbar-nav.navbar-right
|
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
|
li(data-i18n="editor.level_component_btn_new").btn.btn-primary.navbar-btn#create-new-component-button Create New Component
|
||||||
|
|
||||||
.tab-content
|
.tab-content
|
||||||
.tab-pane.active#code
|
.tab-pane.active#component-code
|
||||||
#component-code-editor
|
#component-code-editor
|
||||||
.tab-pane#config-schema
|
.tab-pane#component-config-schema
|
||||||
#config-schema-treema
|
#config-schema-treema
|
||||||
.tab-pane#settings
|
.tab-pane#component-settings
|
||||||
#edit-component-treema
|
#edit-component-treema
|
||||||
|
|
|
@ -63,46 +63,6 @@ block outer_content
|
||||||
a(data-delay="5000", href="#", data-i18n="common.delay_5_sec") 5 seconds
|
a(data-delay="5000", href="#", data-i18n="common.delay_5_sec") 5 seconds
|
||||||
a(data-delay="90019001", href="#", data-i18n="common.manual") Manual
|
a(data-delay="90019001", href="#", data-i18n="common.manual") Manual
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//.top-controls-area
|
|
||||||
// h2.level-title-header
|
|
||||||
// span(data-i18n="editor.level_title") Level Editor
|
|
||||||
// span :
|
|
||||||
// span.level-title #{level.attributes.name}
|
|
||||||
//
|
|
||||||
// .level-control-buttons
|
|
||||||
// button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="revert.revert").btn.btn-primary#revert-button Revert
|
|
||||||
// button(data-i18n="common.save").btn.btn-primary#commit-level-start-button Save
|
|
||||||
// button(data-i18n="common.fork").btn.btn-primary#fork-level-start-button Fork
|
|
||||||
// .btn-group.play-button-group
|
|
||||||
// button(title="⌃↩ or ⌘↩: Play preview of current level", data-i18n="common.play")#play-button.btn.btn-inverse.banner Play!
|
|
||||||
// button.btn.btn-inverse.banner.dropdown-toggle(data-toggle="dropdown")
|
|
||||||
// i.icon-cog.icon-white
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// ul.dropdown-menu
|
|
||||||
// li
|
|
||||||
// span(data-i18n="editor.level_some_options").dropdown-menu-header Some Options?
|
|
||||||
// li.divider
|
|
||||||
// li
|
|
||||||
// a(data-delay="1000", href="#", data-i18n="common.delay_1_sec") 1 second
|
|
||||||
// a(data-delay="3000", href="#", data-i18n="common.delay_3_sec") 3 seconds
|
|
||||||
// a(data-delay="5000", href="#", data-i18n="common.delay_5_sec") 5 seconds
|
|
||||||
// a(data-delay="90019001", href="#", data-i18n="common.manual") Manual
|
|
||||||
//
|
|
||||||
// ul.nav.nav-tabs
|
|
||||||
// li.active
|
|
||||||
// a(href="#editor-level-thangs-tab-view", data-toggle="tab", data-i18n="editor.level_tab_thangs") Thangs
|
|
||||||
// li
|
|
||||||
// a(href="#editor-level-scripts-tab-view", data-toggle="tab", data-i18n="editor.level_tab_scripts") Scripts
|
|
||||||
// li
|
|
||||||
// a(href="#editor-level-settings-tab-view", data-toggle="tab", data-i18n="editor.level_tab_settings") Settings
|
|
||||||
// li
|
|
||||||
// a(href="#editor-level-components-tab-view", data-toggle="tab", data-i18n="editor.level_tab_components") Components
|
|
||||||
// li
|
|
||||||
// a(href="#editor-level-systems-tab-view", data-toggle="tab", data-i18n="editor.level_tab_systems") Systems
|
|
||||||
|
|
||||||
div.tab-content#level-editor-tabs
|
div.tab-content#level-editor-tabs
|
||||||
div.tab-pane.active#editor-level-thangs-tab-view
|
div.tab-pane.active#editor-level-thangs-tab-view
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,18 @@ nav.navbar.navbar-default(role='navigation')
|
||||||
.collapse.navbar-collapse
|
.collapse.navbar-collapse
|
||||||
ul.nav.navbar-nav.nav-tabs
|
ul.nav.navbar-nav.nav-tabs
|
||||||
li.active
|
li.active
|
||||||
a(href="#code" data-toggle="tab") Code
|
a(href="#system-code" data-toggle="tab") Code
|
||||||
li
|
li
|
||||||
a(href="#config-schema" data-toggle="tab") Config Schema
|
a(href="#system-config-schema" data-toggle="tab") Config Schema
|
||||||
li
|
li
|
||||||
a(href="#settings" data-toggle="tab") Settings
|
a(href="#system-settings" data-toggle="tab") Settings
|
||||||
ul.nav.navbar-nav.navbar-right
|
ul.nav.navbar-nav.navbar-right
|
||||||
li(data-i18n="editor.level_system_btn_new").btn.btn-primary.navbar-btn#create-new-system-button Create New System
|
li(data-i18n="editor.level_system_btn_new").btn.btn-primary.navbar-btn#create-new-system-button Create New System
|
||||||
|
|
||||||
.tab-content
|
.tab-content
|
||||||
.tab-pane.active#code
|
.tab-pane.active#system-code
|
||||||
#system-code-editor
|
#system-code-editor
|
||||||
.tab-pane#config-schema
|
.tab-pane#system-config-schema
|
||||||
#config-schema-treema
|
#config-schema-treema
|
||||||
.tab-pane#settings
|
.tab-pane#system-settings
|
||||||
#edit-system-treema
|
#edit-system-treema
|
||||||
|
|
|
@ -41,10 +41,12 @@ module.exports = class ThangTypeEditView extends View
|
||||||
@thangType = new ThangType(_id: @thangTypeID)
|
@thangType = new ThangType(_id: @thangTypeID)
|
||||||
@thangType.saveBackups = true
|
@thangType.saveBackups = true
|
||||||
@thangType.fetch()
|
@thangType.fetch()
|
||||||
@thangType.once('sync', @onThangTypeSync)
|
@thangType.schema().once 'sync', @onThangTypeSync, @
|
||||||
|
@thangType.once 'sync', @onThangTypeSync, @
|
||||||
@refreshAnimation = _.debounce @refreshAnimation, 500
|
@refreshAnimation = _.debounce @refreshAnimation, 500
|
||||||
|
|
||||||
onThangTypeSync: =>
|
onThangTypeSync: ->
|
||||||
|
return unless @thangType.loaded and ThangType.hasSchema()
|
||||||
@startsLoading = false
|
@startsLoading = false
|
||||||
@files = new DocumentFiles(@thangType)
|
@files = new DocumentFiles(@thangType)
|
||||||
@files.fetch()
|
@files.fetch()
|
||||||
|
@ -210,6 +212,7 @@ module.exports = class ThangTypeEditView extends View
|
||||||
showMovieClip: (animationName) ->
|
showMovieClip: (animationName) ->
|
||||||
vectorParser = new SpriteBuilder(@thangType)
|
vectorParser = new SpriteBuilder(@thangType)
|
||||||
movieClip = vectorParser.buildMovieClip(animationName)
|
movieClip = vectorParser.buildMovieClip(animationName)
|
||||||
|
return unless movieClip
|
||||||
reg = @thangType.get('positions')?.registration
|
reg = @thangType.get('positions')?.registration
|
||||||
if reg
|
if reg
|
||||||
movieClip.regX = -reg.x
|
movieClip.regX = -reg.x
|
||||||
|
@ -303,13 +306,18 @@ module.exports = class ThangTypeEditView extends View
|
||||||
|
|
||||||
clearRawData: ->
|
clearRawData: ->
|
||||||
@thangType.resetRawData()
|
@thangType.resetRawData()
|
||||||
|
@thangType.set 'actions', undefined
|
||||||
@clearDisplayObject()
|
@clearDisplayObject()
|
||||||
|
@treema.set('/', @getThangData())
|
||||||
|
|
||||||
|
getThangData: ->
|
||||||
|
data = _.cloneDeep(@thangType.attributes)
|
||||||
|
data = _.pick data, (value, key) => not (key in ['components'])
|
||||||
|
|
||||||
buildTreema: ->
|
buildTreema: ->
|
||||||
data = _.cloneDeep(@thangType.attributes)
|
data = @getThangData()
|
||||||
schema = _.cloneDeep ThangType.schema.attributes
|
schema = _.cloneDeep ThangType.schema.attributes
|
||||||
schema.properties = _.pick schema.properties, (value, key) => not (key in ['components'])
|
schema.properties = _.pick schema.properties, (value, key) => not (key in ['components'])
|
||||||
data = _.pick data, (value, key) => not (key in ['components'])
|
|
||||||
options =
|
options =
|
||||||
data: data
|
data: data
|
||||||
schema: schema
|
schema: schema
|
||||||
|
|
|
@ -13,6 +13,7 @@ module.exports = class RevertModal extends ModalView
|
||||||
id = $(e.target).val()
|
id = $(e.target).val()
|
||||||
CocoModel.backedUp[id].revert()
|
CocoModel.backedUp[id].revert()
|
||||||
$(e.target).closest('tr').remove()
|
$(e.target).closest('tr').remove()
|
||||||
|
@reloadOnClose = true
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
|
@ -21,3 +22,6 @@ module.exports = class RevertModal extends ModalView
|
||||||
c.models = models
|
c.models = models
|
||||||
c
|
c
|
||||||
|
|
||||||
|
onHidden: ->
|
||||||
|
console.log 'reload?', @reloadOnClose
|
||||||
|
location.reload() if @reloadOnClose
|
||||||
|
|
|
@ -499,4 +499,4 @@ module.exports = class SpellView extends View
|
||||||
super()
|
super()
|
||||||
@firepad?.dispose()
|
@firepad?.dispose()
|
||||||
@ace.destroy()
|
@ace.destroy()
|
||||||
@debugView.destroy()
|
@debugView?.destroy()
|
||||||
|
|
Loading…
Reference in a new issue