From 5f81eb670b54db6d3f1e2c6a3f6f9b9ac683fe1b Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 14:37:33 -0800 Subject: [PATCH 01/11] Some styling fixes, removed commented out stuff. --- app/styles/editor/level/edit.sass | 2 +- app/styles/editor/level/thang/edit.sass | 50 ------------------------- app/templates/editor/level/edit.jade | 40 -------------------- 3 files changed, 1 insertion(+), 91 deletions(-) diff --git a/app/styles/editor/level/edit.sass b/app/styles/editor/level/edit.sass index dcbb4c5f1..0e0362af4 100644 --- a/app/styles/editor/level/edit.sass +++ b/app/styles/editor/level/edit.sass @@ -19,7 +19,7 @@ .nav-tabs border-bottom: 0 !important .active > a, .active > a:hover, .active > a:focus - background-color: #eee !important + background-color: $BG !important .outer-content background-color: $BG diff --git a/app/styles/editor/level/thang/edit.sass b/app/styles/editor/level/thang/edit.sass index e758d4adb..7bd69e66c 100644 --- a/app/styles/editor/level/thang/edit.sass +++ b/app/styles/editor/level/thang/edit.sass @@ -3,8 +3,6 @@ .well text-align: center - input - height: 14px padding: 10px #thang-props @@ -15,51 +13,3 @@ #all-thangs-link float: left 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 -// diff --git a/app/templates/editor/level/edit.jade b/app/templates/editor/level/edit.jade index ca4960d3e..cdc97cd2a 100644 --- a/app/templates/editor/level/edit.jade +++ b/app/templates/editor/level/edit.jade @@ -62,46 +62,6 @@ block outer_content 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 - - - - //.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-pane.active#editor-level-thangs-tab-view From fe89c9fbad35fe59ae64e9fd75730b00a9603eb1 Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Thu, 30 Jan 2014 15:03:55 -0800 Subject: [PATCH 02/11] Fix for #290 --- app/views/play/level/tome/spell_view.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/play/level/tome/spell_view.coffee b/app/views/play/level/tome/spell_view.coffee index 233727b48..9920fd807 100644 --- a/app/views/play/level/tome/spell_view.coffee +++ b/app/views/play/level/tome/spell_view.coffee @@ -499,4 +499,4 @@ module.exports = class SpellView extends View super() @firepad?.dispose() @ace.destroy() - @debugView.destroy() + @debugView?.destroy() From 371bd9f41c517bc340d5bc2b9dd6ef5af35acc4d Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 15:22:01 -0800 Subject: [PATCH 03/11] Tweaked tab styling on level editor. --- app/styles/editor/level/component/edit.sass | 5 ++++- app/styles/editor/level/edit.sass | 11 +++++++---- app/styles/editor/level/system/edit.sass | 5 ++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/styles/editor/level/component/edit.sass b/app/styles/editor/level/component/edit.sass index ec43e912b..5c9deda4c 100644 --- a/app/styles/editor/level/component/edit.sass +++ b/app/styles/editor/level/component/edit.sass @@ -9,4 +9,7 @@ bottom: 0 top: 50px border: 2px solid black - border-top: none \ No newline at end of file + border-top: none + + .active > a, .active > a:hover, .active > a:focus + background-color: white !important \ No newline at end of file diff --git a/app/styles/editor/level/edit.sass b/app/styles/editor/level/edit.sass index 0e0362af4..f1cfc2303 100644 --- a/app/styles/editor/level/edit.sass +++ b/app/styles/editor/level/edit.sass @@ -16,10 +16,13 @@ li.navbar-btn margin-right: 5px - .nav-tabs - border-bottom: 0 !important - .active > a, .active > a:hover, .active > a:focus - background-color: $BG !important + #level-editor-top-nav + .nav-tabs + border-bottom: 0 !important + .active > a, .active > a:hover, .active > a:focus + background-color: $BG !important + border-color: darken($BG, 50%) + border-bottom: 0 .outer-content background-color: $BG diff --git a/app/styles/editor/level/system/edit.sass b/app/styles/editor/level/system/edit.sass index d910b605f..e86dc5a46 100644 --- a/app/styles/editor/level/system/edit.sass +++ b/app/styles/editor/level/system/edit.sass @@ -9,4 +9,7 @@ bottom: 0 top: 50px border: 2px solid black - border-top: none \ No newline at end of file + border-top: none + + .active > a, .active > a:hover, .active > a:focus + background-color: white !important \ No newline at end of file From 3ca6a5709b2297060bd7a0e172ca132196418344 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 15:27:10 -0800 Subject: [PATCH 04/11] Fixed a bug where systems tabs would change components tabs. --- app/templates/editor/level/component/edit.jade | 12 ++++++------ app/templates/editor/level/system/edit.jade | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/templates/editor/level/component/edit.jade b/app/templates/editor/level/component/edit.jade index f1a2534b1..911e07237 100644 --- a/app/templates/editor/level/component/edit.jade +++ b/app/templates/editor/level/component/edit.jade @@ -9,18 +9,18 @@ nav.navbar.navbar-default(role='navigation') .collapse.navbar-collapse ul.nav.navbar-nav.nav-tabs li.active - a(href="#code" data-toggle="tab") Code + a(href="#component-code" data-toggle="tab") Code li - a(href="#config-schema" data-toggle="tab") Config Schema + a(href="#component-config-schema" data-toggle="tab") Config Schema li - a(href="#settings" data-toggle="tab") Settings + a(href="#component-settings" data-toggle="tab") Settings 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 .tab-content - .tab-pane.active#code + .tab-pane.active#component-code #component-code-editor - .tab-pane#config-schema + .tab-pane#component-config-schema #config-schema-treema - .tab-pane#settings + .tab-pane#component-settings #edit-component-treema diff --git a/app/templates/editor/level/system/edit.jade b/app/templates/editor/level/system/edit.jade index cad413dfe..db20287b6 100644 --- a/app/templates/editor/level/system/edit.jade +++ b/app/templates/editor/level/system/edit.jade @@ -9,18 +9,18 @@ nav.navbar.navbar-default(role='navigation') .collapse.navbar-collapse ul.nav.navbar-nav.nav-tabs li.active - a(href="#code" data-toggle="tab") Code + a(href="#system-code" data-toggle="tab") Code li - a(href="#config-schema" data-toggle="tab") Config Schema + a(href="#system-config-schema" data-toggle="tab") Config Schema li - a(href="#settings" data-toggle="tab") Settings + a(href="#system-settings" data-toggle="tab") Settings 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 .tab-content - .tab-pane.active#code + .tab-pane.active#system-code #system-code-editor - .tab-pane#config-schema + .tab-pane#system-config-schema #config-schema-treema - .tab-pane#settings + .tab-pane#system-settings #edit-system-treema From 6d5e9d13c98215df3d8e7c13994ac0bc66c9dfe7 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 15:29:20 -0800 Subject: [PATCH 05/11] Changed the links for artisan documentation to the new wiki pages. --- app/templates/contribute/artisan.jade | 2 +- app/templates/contribute/contribute.jade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/contribute/artisan.jade b/app/templates/contribute/artisan.jade index 63cc6fe5d..5cccb72bc 100644 --- a/app/templates/contribute/artisan.jade +++ b/app/templates/contribute/artisan.jade @@ -47,7 +47,7 @@ block content | Use the Level Editor in these steps, give or take: ul 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 a(href="/editor/level", data-i18n="contribute.artisan_join_step2") Create a new level and explore existing levels. li diff --git a/app/templates/contribute/contribute.jade b/app/templates/contribute/contribute.jade index bcfb6b304..bef44906c 100644 --- a/app/templates/contribute/contribute.jade +++ b/app/templates/contribute/contribute.jade @@ -154,7 +154,7 @@ block content | Use the Level Editor in these steps, give or take: ul 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 a(href="/editor/level", data-i18n="contribute.artisan_join_step2") Create a new level and explore existing levels. li From 9f73687a4b05da2c92876281527f52956f8a3ff2 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 15:31:08 -0800 Subject: [PATCH 06/11] Edited the link to the wiki. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 748a90d80..9ed94553b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ CodeCombat ![](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) -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. From 591a8e9ab5e5abbf3b4cd02e6fc2aea88629799b Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 15:38:49 -0800 Subject: [PATCH 07/11] Made the revert modal reload the page if anything was reverted. --- app/views/modal/revert_modal.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/modal/revert_modal.coffee b/app/views/modal/revert_modal.coffee index 377f3e860..91358988c 100644 --- a/app/views/modal/revert_modal.coffee +++ b/app/views/modal/revert_modal.coffee @@ -13,6 +13,7 @@ module.exports = class RevertModal extends ModalView id = $(e.target).val() CocoModel.backedUp[id].revert() $(e.target).closest('tr').remove() + @reloadOnClose = true getRenderData: -> c = super() @@ -20,4 +21,7 @@ module.exports = class RevertModal extends ModalView models = (m for m in models when m.hasLocalChanges()) c.models = models c - + + onHidden: -> + console.log 'reload?', @reloadOnClose + location.reload() if @reloadOnClose From 1b75ab15db758de510f8c3a64da031b57c00cade Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 16:17:41 -0800 Subject: [PATCH 08/11] Added some error handlers for messed up thang type configs. --- app/lib/sprites/SpriteBuilder.coffee | 4 +++- app/models/ThangType.coffee | 3 +++ app/views/editor/thang/edit.coffee | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/lib/sprites/SpriteBuilder.coffee b/app/lib/sprites/SpriteBuilder.coffee index db4fe78ff..babf5178a 100644 --- a/app/lib/sprites/SpriteBuilder.coffee +++ b/app/lib/sprites/SpriteBuilder.coffee @@ -13,7 +13,9 @@ module.exports = class SpriteBuilder buildMovieClip: (animationName, movieClipArgs...) -> 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 = {} _.extend locals, @buildMovieClipShapes(animData.shapes) _.extend locals, @buildMovieClipContainers(animData.containers) diff --git a/app/models/ThangType.coffee b/app/models/ThangType.coffee index 94e54ed4a..d538ba4dd 100644 --- a/app/models/ThangType.coffee +++ b/app/models/ThangType.coffee @@ -91,6 +91,7 @@ module.exports = class ThangType extends CocoModel for animation in @requiredRawAnimations() name = animation.animation mc = @vectorParser.buildMovieClip name + continue unless mc @builder.addMovieClip mc, null, animation.scale * @options.resolutionFactor framesMap[animation.scale + "_" + name] = @builder._animations[name].frames @@ -98,6 +99,7 @@ module.exports = class ThangType extends CocoModel continue if name is 'portrait' scale = action.scale ? @get('scale') ? 1 frames = framesMap[scale + "_" + action.animation] + continue unless frames frames = @mapFrames(action.frames, frames[0]) if action.frames? next = true next = action.goesTo if action.goesTo @@ -108,6 +110,7 @@ module.exports = class ThangType extends CocoModel continue if name is 'portrait' scale = @options.resolutionFactor * (action.scale or @get('scale') or 1) s = @vectorParser.buildContainerFromStore(action.container) + continue unless s frame = @builder.addFrame(s, s.bounds, scale) @builder.addAnimation name, [frame], false diff --git a/app/views/editor/thang/edit.coffee b/app/views/editor/thang/edit.coffee index f290e76a9..9210b6c89 100644 --- a/app/views/editor/thang/edit.coffee +++ b/app/views/editor/thang/edit.coffee @@ -210,6 +210,7 @@ module.exports = class ThangTypeEditView extends View showMovieClip: (animationName) -> vectorParser = new SpriteBuilder(@thangType) movieClip = vectorParser.buildMovieClip(animationName) + return unless movieClip reg = @thangType.get('positions')?.registration if reg movieClip.regX = -reg.x From c376ba684186d45860c13171934718a062d6a3a8 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 16:19:55 -0800 Subject: [PATCH 09/11] Fixed #303 --- app/views/editor/thang/edit.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/editor/thang/edit.coffee b/app/views/editor/thang/edit.coffee index 9210b6c89..5b69ee809 100644 --- a/app/views/editor/thang/edit.coffee +++ b/app/views/editor/thang/edit.coffee @@ -41,10 +41,12 @@ module.exports = class ThangTypeEditView extends View @thangType = new ThangType(_id: @thangTypeID) @thangType.saveBackups = true @thangType.fetch() - @thangType.once('sync', @onThangTypeSync) + @thangType.schema().once 'sync', @onThangTypeSync, @ + @thangType.once 'sync', @onThangTypeSync, @ @refreshAnimation = _.debounce @refreshAnimation, 500 onThangTypeSync: => + return unless @thangType.loaded and ThangType.hasSchema() @startsLoading = false @files = new DocumentFiles(@thangType) @files.fetch() From 46d1d10abe6230df152ddcafaaa5ecdada8ee437 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 16:20:58 -0800 Subject: [PATCH 10/11] Removed an unnecessary fat arrow. --- app/views/editor/thang/edit.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/editor/thang/edit.coffee b/app/views/editor/thang/edit.coffee index 5b69ee809..45175a4ad 100644 --- a/app/views/editor/thang/edit.coffee +++ b/app/views/editor/thang/edit.coffee @@ -45,7 +45,7 @@ module.exports = class ThangTypeEditView extends View @thangType.once 'sync', @onThangTypeSync, @ @refreshAnimation = _.debounce @refreshAnimation, 500 - onThangTypeSync: => + onThangTypeSync: -> return unless @thangType.loaded and ThangType.hasSchema() @startsLoading = false @files = new DocumentFiles(@thangType) From 3093b5958802ec9c5055e0fd16183a43773b2002 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 30 Jan 2014 16:25:06 -0800 Subject: [PATCH 11/11] Fixed #296 --- app/views/editor/thang/edit.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/editor/thang/edit.coffee b/app/views/editor/thang/edit.coffee index 45175a4ad..0f3ec818c 100644 --- a/app/views/editor/thang/edit.coffee +++ b/app/views/editor/thang/edit.coffee @@ -306,13 +306,18 @@ module.exports = class ThangTypeEditView extends View clearRawData: -> @thangType.resetRawData() + @thangType.set 'actions', undefined @clearDisplayObject() + @treema.set('/', @getThangData()) + + getThangData: -> + data = _.cloneDeep(@thangType.attributes) + data = _.pick data, (value, key) => not (key in ['components']) buildTreema: -> - data = _.cloneDeep(@thangType.attributes) + data = @getThangData() schema = _.cloneDeep ThangType.schema.attributes schema.properties = _.pick schema.properties, (value, key) => not (key in ['components']) - data = _.pick data, (value, key) => not (key in ['components']) options = data: data schema: schema