From 10944870728091d0945240ea55a8dddb5b23be2b Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Wed, 3 Sep 2014 17:47:29 -0700 Subject: [PATCH 1/5] Fixed #1511 --- app/lib/errors.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/errors.coffee b/app/lib/errors.coffee index 04a0c8fd5..50f7de71e 100644 --- a/app/lib/errors.coffee +++ b/app/lib/errors.coffee @@ -10,7 +10,7 @@ module.exports.parseServerError = (text) -> error module.exports.genericFailure = (jqxhr) -> - Backbone.Mediator.publish('server-error', {response: jqxhr}) + Backbone.Mediator.publish('errors:server-error', {response: jqxhr}) return connectionFailure() if not jqxhr.status error = module.exports.parseServerError(jqxhr.responseText) From 35f22e0f8c9179035e2e3e37336bc90f3e0ae4e0 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 3 Sep 2014 18:35:14 -0700 Subject: [PATCH 2/5] Fixed a few tome / canvas resizing bugs. --- app/lib/surface/Surface.coffee | 4 ++-- app/styles/play/level.sass | 8 +++++--- app/views/play/level/tome/Spell.coffee | 2 +- app/views/play/level/tome/SpellView.coffee | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index b7ca42669..7047709ac 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -87,7 +87,7 @@ module.exports = Surface = class Surface extends CocoClass @options = _.extend(@options, givenOptions) if givenOptions @initEasel() @initAudio() - @onResize = _.debounce @onResize, 250 + @onResize = _.debounce @onResize, 500 # At least as much as $level-resize-transition-time. $(window).on 'resize', @onResize if @world.ended _.defer => @setWorld @world @@ -489,7 +489,7 @@ module.exports = Surface = class Surface extends CocoClass newPos = @camera.screenToCanvas({x: e.stageX, y: e.stageY}) # getObject(s)UnderPoint is broken, so we have to use the private method to get what we want onBackground = not @stage._getObjectsUnderPoint(newPos.x, newPos.y, null, true) - + worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos Backbone.Mediator.publish 'surface:stage-mouse-down', event diff --git a/app/styles/play/level.sass b/app/styles/play/level.sass index 4a87c0099..cf4edfba7 100644 --- a/app/styles/play/level.sass +++ b/app/styles/play/level.sass @@ -6,6 +6,8 @@ body.is-playing .footer background-color: black +$level-resize-transition-time: 0.5s + #level-view margin: 0 auto @include user-select(none) @@ -49,13 +51,13 @@ body.is-playing width: 55% position: relative overflow: hidden - @include transition(0.5s ease-out) + @include transition($level-resize-transition-time ease-out) canvas#surface background-color: #333 display: block z-index: 1 - @include transition(0.5s ease-out) + @include transition($level-resize-transition-time ease-out) &.flag-color-selected cursor: crosshair @@ -73,7 +75,7 @@ body.is-playing right: 0 top: 0px bottom: 0 - @include transition(width 0.5s ease-in-out, right 0.5s ease-in-out) + @include transition(width $level-resize-transition-time ease-in-out, right $level-resize-transition-time ease-in-out) #pointer position: absolute diff --git a/app/views/play/level/tome/Spell.coffee b/app/views/play/level/tome/Spell.coffee index dde14abf8..940715f45 100644 --- a/app/views/play/level/tome/Spell.coffee +++ b/app/views/play/level/tome/Spell.coffee @@ -171,4 +171,4 @@ module.exports = class Spell @source = e.code[spellkeyComponents[0]][spellkeyComponents[1]] @updateLanguageAether e.codeLanguage else - console.error 'Spell onNewOpponentCode did not recieve code', e + console.error 'Spell onNewOpponentCode did not receive code', e diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index b0b7b55a5..b1b7cadae 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -668,7 +668,7 @@ module.exports = class SpellView extends CocoView @ace.setValue pretty onMaximizeToggled: (e) -> - @ace.resize true + _.delay (=> @ace?.resize true), 500 # Wait $level-resize-transition-time. onChangeEditorConfig: (e) -> aceConfig = me.get('aceConfig') ? {} From b1de5e0045ef578b27f5043783169ce43685e9d4 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 3 Sep 2014 19:19:04 -0700 Subject: [PATCH 3/5] Fixed bug with hero levels not loading inventory. (Might not be in line with the performance that 975c6a was going for.) --- app/models/Level.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/Level.coffee b/app/models/Level.coffee index 5f6ff797c..ddad95999 100644 --- a/app/models/Level.coffee +++ b/app/models/Level.coffee @@ -24,14 +24,14 @@ module.exports = class Level extends CocoModel # Figure out ThangTypes' Components tmap = {} tmap[t.thangType] = true for t in o.thangs ? [] - o.thangTypes = (original: tt.get('original'), name: tt.get('name'), components: $.extend(true, [], tt.get('components')) for tt in supermodel.getModels ThangType when tmap[tt.get('original')] or tt.isFullyLoaded()) + o.thangTypes = (original: tt.get('original'), name: tt.get('name'), components: $.extend(true, [], tt.get('components')) for tt in supermodel.getModels ThangType when tmap[tt.get('original')] or tt.get('components')) @sortThangComponents o.thangTypes, o.levelComponents, 'ThangType' @fillInDefaultComponentConfiguration o.thangTypes, o.levelComponents - + o - + cachedLevelComponents: null - + getCachedLevelComponents: (supermodel) -> @cachedLevelComponents ?= {} levelComponents = supermodel.getModels LevelComponent @@ -43,7 +43,7 @@ module.exports = class Level extends CocoModel @cachedLevelComponents[levelComponent.id] ?= @cachedLevelComponents[levelComponent.id] = $.extend(true, {}, levelComponent.attributes) newLevelComponents.push(@cachedLevelComponents[levelComponent.id]) newLevelComponents - + denormalize: (supermodel, session) -> o = $.extend true, {}, @attributes if o.thangs and @get('type', true) is 'hero' From bfae70ef13966a0b5f6aebabb2cc7fbeca112da8 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 4 Sep 2014 10:03:34 -0700 Subject: [PATCH 4/5] Added a close button to the game menu modal. --- app/styles/game-menu/game-menu-modal.sass | 6 ++++++ app/templates/game-menu/game-menu-modal.jade | 1 + 2 files changed, 7 insertions(+) diff --git a/app/styles/game-menu/game-menu-modal.sass b/app/styles/game-menu/game-menu-modal.sass index 428dc8e72..71b9728e7 100644 --- a/app/styles/game-menu/game-menu-modal.sass +++ b/app/styles/game-menu/game-menu-modal.sass @@ -1,4 +1,10 @@ #game-menu-modal + + .close + position: absolute + top: 10px + right: 20px + .modal-dialog margin-top: 0 diff --git a/app/templates/game-menu/game-menu-modal.jade b/app/templates/game-menu/game-menu-modal.jade index 0876d23d5..0ebc65f97 100644 --- a/app/templates/game-menu/game-menu-modal.jade +++ b/app/templates/game-menu/game-menu-modal.jade @@ -3,6 +3,7 @@ extends /templates/modal/modal_base block modal-header block modal-body-content + .button.close(type="button", data-dismiss="modal", aria-hidden="true") × .tabbable.tabs-left - var submenus = ["inventory", "choose-hero", "save-load", "options", "guide", "multiplayer"] - if (!showDevBits) { // Not done yet. From 8c45e22741b197c732ef237580fced30fb76f84d Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 4 Sep 2014 11:04:16 -0700 Subject: [PATCH 5/5] Protection and logging for #1463. Fixed an issue with spectate camera script bounds. --- app/models/LevelSession.coffee | 11 +++++++++++ app/views/play/SpectateView.coffee | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/LevelSession.coffee b/app/models/LevelSession.coffee index ba87aef23..5d59d1bc2 100644 --- a/app/models/LevelSession.coffee +++ b/app/models/LevelSession.coffee @@ -42,3 +42,14 @@ module.exports = class LevelSession extends CocoModel completed: -> @get('state')?.complete || false + + shouldAvoidCorruptData: (attrs) -> + return false unless me.team is 'humans' + if _.string.startsWith (attrs?.code ? @get('code'))?.anya?.makeBid ? '', 'var __interceptThis' + noty text: "Not saving session--it's trying to overwrite Anya's code with transpiled output. Please let us know and help us reproduce this bug!", layout: 'topCenter', type: 'error', killer: false, timeout: 120000 + return true + false + + save: (attrs, options) -> + return if @shouldAvoidCorruptData attrs + super attrs, options diff --git a/app/views/play/SpectateView.coffee b/app/views/play/SpectateView.coffee index 8cd6a79cb..f4d7514ba 100644 --- a/app/views/play/SpectateView.coffee +++ b/app/views/play/SpectateView.coffee @@ -217,7 +217,7 @@ module.exports = class SpectateLevelView extends RootView initScriptManager: -> if @world.scripts nonVictoryPlaybackScripts = _.reject @world.scripts, (script) -> - script.id.indexOf('Set Camera Boundaries and Goals') == -1 + script.id.indexOf('Set Camera Boundaries') is -1 else console.log 'World scripts don\'t exist!' nonVictoryPlaybackScripts = []