mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-29 10:35:51 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
c0a39151f1
10 changed files with 34 additions and 14 deletions
|
@ -10,7 +10,7 @@ module.exports.parseServerError = (text) ->
|
||||||
error
|
error
|
||||||
|
|
||||||
module.exports.genericFailure = (jqxhr) ->
|
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
|
return connectionFailure() if not jqxhr.status
|
||||||
|
|
||||||
error = module.exports.parseServerError(jqxhr.responseText)
|
error = module.exports.parseServerError(jqxhr.responseText)
|
||||||
|
|
|
@ -87,7 +87,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
@options = _.extend(@options, givenOptions) if givenOptions
|
@options = _.extend(@options, givenOptions) if givenOptions
|
||||||
@initEasel()
|
@initEasel()
|
||||||
@initAudio()
|
@initAudio()
|
||||||
@onResize = _.debounce @onResize, 250
|
@onResize = _.debounce @onResize, 500 # At least as much as $level-resize-transition-time.
|
||||||
$(window).on 'resize', @onResize
|
$(window).on 'resize', @onResize
|
||||||
if @world.ended
|
if @world.ended
|
||||||
_.defer => @setWorld @world
|
_.defer => @setWorld @world
|
||||||
|
@ -489,7 +489,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
newPos = @camera.screenToCanvas({x: e.stageX, y: e.stageY})
|
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
|
# 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)
|
onBackground = not @stage._getObjectsUnderPoint(newPos.x, newPos.y, null, true)
|
||||||
|
|
||||||
worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY
|
worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY
|
||||||
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos
|
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos
|
||||||
Backbone.Mediator.publish 'surface:stage-mouse-down', event
|
Backbone.Mediator.publish 'surface:stage-mouse-down', event
|
||||||
|
|
|
@ -24,14 +24,14 @@ module.exports = class Level extends CocoModel
|
||||||
# Figure out ThangTypes' Components
|
# Figure out ThangTypes' Components
|
||||||
tmap = {}
|
tmap = {}
|
||||||
tmap[t.thangType] = true for t in o.thangs ? []
|
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'
|
@sortThangComponents o.thangTypes, o.levelComponents, 'ThangType'
|
||||||
@fillInDefaultComponentConfiguration o.thangTypes, o.levelComponents
|
@fillInDefaultComponentConfiguration o.thangTypes, o.levelComponents
|
||||||
|
|
||||||
o
|
o
|
||||||
|
|
||||||
cachedLevelComponents: null
|
cachedLevelComponents: null
|
||||||
|
|
||||||
getCachedLevelComponents: (supermodel) ->
|
getCachedLevelComponents: (supermodel) ->
|
||||||
@cachedLevelComponents ?= {}
|
@cachedLevelComponents ?= {}
|
||||||
levelComponents = supermodel.getModels LevelComponent
|
levelComponents = supermodel.getModels LevelComponent
|
||||||
|
@ -43,7 +43,7 @@ module.exports = class Level extends CocoModel
|
||||||
@cachedLevelComponents[levelComponent.id] ?= @cachedLevelComponents[levelComponent.id] = $.extend(true, {}, levelComponent.attributes)
|
@cachedLevelComponents[levelComponent.id] ?= @cachedLevelComponents[levelComponent.id] = $.extend(true, {}, levelComponent.attributes)
|
||||||
newLevelComponents.push(@cachedLevelComponents[levelComponent.id])
|
newLevelComponents.push(@cachedLevelComponents[levelComponent.id])
|
||||||
newLevelComponents
|
newLevelComponents
|
||||||
|
|
||||||
denormalize: (supermodel, session) ->
|
denormalize: (supermodel, session) ->
|
||||||
o = $.extend true, {}, @attributes
|
o = $.extend true, {}, @attributes
|
||||||
if o.thangs and @get('type', true) is 'hero'
|
if o.thangs and @get('type', true) is 'hero'
|
||||||
|
|
|
@ -42,3 +42,14 @@ module.exports = class LevelSession extends CocoModel
|
||||||
|
|
||||||
completed: ->
|
completed: ->
|
||||||
@get('state')?.complete || false
|
@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
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
#game-menu-modal
|
#game-menu-modal
|
||||||
|
|
||||||
|
.close
|
||||||
|
position: absolute
|
||||||
|
top: 10px
|
||||||
|
right: 20px
|
||||||
|
|
||||||
.modal-dialog
|
.modal-dialog
|
||||||
margin-top: 0
|
margin-top: 0
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ body.is-playing
|
||||||
.footer
|
.footer
|
||||||
background-color: black
|
background-color: black
|
||||||
|
|
||||||
|
$level-resize-transition-time: 0.5s
|
||||||
|
|
||||||
#level-view
|
#level-view
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
@include user-select(none)
|
@include user-select(none)
|
||||||
|
@ -49,13 +51,13 @@ body.is-playing
|
||||||
width: 55%
|
width: 55%
|
||||||
position: relative
|
position: relative
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
@include transition(0.5s ease-out)
|
@include transition($level-resize-transition-time ease-out)
|
||||||
|
|
||||||
canvas#surface
|
canvas#surface
|
||||||
background-color: #333
|
background-color: #333
|
||||||
display: block
|
display: block
|
||||||
z-index: 1
|
z-index: 1
|
||||||
@include transition(0.5s ease-out)
|
@include transition($level-resize-transition-time ease-out)
|
||||||
|
|
||||||
&.flag-color-selected
|
&.flag-color-selected
|
||||||
cursor: crosshair
|
cursor: crosshair
|
||||||
|
@ -73,7 +75,7 @@ body.is-playing
|
||||||
right: 0
|
right: 0
|
||||||
top: 0px
|
top: 0px
|
||||||
bottom: 0
|
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
|
#pointer
|
||||||
position: absolute
|
position: absolute
|
||||||
|
|
|
@ -3,6 +3,7 @@ extends /templates/modal/modal_base
|
||||||
block modal-header
|
block modal-header
|
||||||
|
|
||||||
block modal-body-content
|
block modal-body-content
|
||||||
|
.button.close(type="button", data-dismiss="modal", aria-hidden="true") ×
|
||||||
.tabbable.tabs-left
|
.tabbable.tabs-left
|
||||||
- var submenus = ["inventory", "choose-hero", "save-load", "options", "guide", "multiplayer"]
|
- var submenus = ["inventory", "choose-hero", "save-load", "options", "guide", "multiplayer"]
|
||||||
- if (!showDevBits) { // Not done yet.
|
- if (!showDevBits) { // Not done yet.
|
||||||
|
|
|
@ -217,7 +217,7 @@ module.exports = class SpectateLevelView extends RootView
|
||||||
initScriptManager: ->
|
initScriptManager: ->
|
||||||
if @world.scripts
|
if @world.scripts
|
||||||
nonVictoryPlaybackScripts = _.reject @world.scripts, (script) ->
|
nonVictoryPlaybackScripts = _.reject @world.scripts, (script) ->
|
||||||
script.id.indexOf('Set Camera Boundaries and Goals') == -1
|
script.id.indexOf('Set Camera Boundaries') is -1
|
||||||
else
|
else
|
||||||
console.log 'World scripts don\'t exist!'
|
console.log 'World scripts don\'t exist!'
|
||||||
nonVictoryPlaybackScripts = []
|
nonVictoryPlaybackScripts = []
|
||||||
|
|
|
@ -171,4 +171,4 @@ module.exports = class Spell
|
||||||
@source = e.code[spellkeyComponents[0]][spellkeyComponents[1]]
|
@source = e.code[spellkeyComponents[0]][spellkeyComponents[1]]
|
||||||
@updateLanguageAether e.codeLanguage
|
@updateLanguageAether e.codeLanguage
|
||||||
else
|
else
|
||||||
console.error 'Spell onNewOpponentCode did not recieve code', e
|
console.error 'Spell onNewOpponentCode did not receive code', e
|
||||||
|
|
|
@ -668,7 +668,7 @@ module.exports = class SpellView extends CocoView
|
||||||
@ace.setValue pretty
|
@ace.setValue pretty
|
||||||
|
|
||||||
onMaximizeToggled: (e) ->
|
onMaximizeToggled: (e) ->
|
||||||
@ace.resize true
|
_.delay (=> @ace?.resize true), 500 # Wait $level-resize-transition-time.
|
||||||
|
|
||||||
onChangeEditorConfig: (e) ->
|
onChangeEditorConfig: (e) ->
|
||||||
aceConfig = me.get('aceConfig') ? {}
|
aceConfig = me.get('aceConfig') ? {}
|
||||||
|
|
Loading…
Reference in a new issue