Merge branch 'master' of github.com:codecombat/codecombat

This commit is contained in:
iAladdin 2014-11-20 08:22:23 +08:00
commit dff443bc07
7 changed files with 36 additions and 31 deletions

View file

@ -91,7 +91,9 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass
@saveIfAllDone() @saveIfAllDone()
saveIfAllDone: => saveIfAllDone: =>
console.debug 'Save if all done. Person loaded:', @personLoaded, 'and email loaded:', @emailLoaded
return unless @personLoaded and @emailLoaded return unless @personLoaded and @emailLoaded
console.debug 'Email, gplusID:', me.get('email'), me.get('gplusID')
return unless me.get('email') and me.get('gplusID') return unless me.get('email') and me.get('gplusID')
Backbone.Mediator.publish 'auth:logging-in-with-gplus', {} Backbone.Mediator.publish 'auth:logging-in-with-gplus', {}
@ -104,12 +106,16 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass
patch.email = me.get('email') patch.email = me.get('email')
wasAnonymous = me.get('anonymous') wasAnonymous = me.get('anonymous')
@trigger 'logging-into-codecombat' @trigger 'logging-into-codecombat'
console.debug('Logging into GPlus.')
me.save(patch, { me.save(patch, {
patch: true patch: true
type: 'PUT' type: 'PUT'
error: backboneFailure, error: ->
console.debug('Logging into GPlus fail.', arguments)
backboneFailure(arguments...)
url: "/db/user?gplusID=#{gplusID}&gplusAccessToken=#{@accessToken.access_token}" url: "/db/user?gplusID=#{gplusID}&gplusAccessToken=#{@accessToken.access_token}"
success: (model) -> success: (model) ->
console.debug('GPLus login success!')
window.location.reload() if wasAnonymous and not model.get('anonymous') window.location.reload() if wasAnonymous and not model.get('anonymous')
}) })

View file

@ -491,6 +491,7 @@ module.exports = Lank = class Lank extends CocoClass
bar = createProgressBar(healthColor) bar = createProgressBar(healthColor)
@options.floatingLayer.addCustomGraphic(key, bar, bar.bounds) @options.floatingLayer.addCustomGraphic(key, bar, bar.bounds)
hadHealthBar = @healthBar
@healthBar = new createjs.Sprite(@options.floatingLayer.spriteSheet) @healthBar = new createjs.Sprite(@options.floatingLayer.spriteSheet)
@healthBar.gotoAndStop(key) @healthBar.gotoAndStop(key)
offset = @getOffset 'aboveHead' offset = @getOffset 'aboveHead'
@ -499,6 +500,8 @@ module.exports = Lank = class Lank extends CocoClass
@options.floatingLayer.addChild @healthBar @options.floatingLayer.addChild @healthBar
@updateHealthBar() @updateHealthBar()
@lastHealth = null @lastHealth = null
if not hadHealthBar
@listenTo @options.floatingLayer, 'new-spritesheet', @addHealthBar
getActionProp: (prop, subProp, def=null) -> getActionProp: (prop, subProp, def=null) ->
# Get a property or sub-property from an action, falling back to ThangType # Get a property or sub-property from an action, falling back to ThangType

View file

@ -258,7 +258,9 @@ module.exports = Surface = class Surface extends CocoClass
createjs.Tween.removeTweens(@) createjs.Tween.removeTweens(@)
@currentFrame = @scrubbingTo @currentFrame = @scrubbingTo
@scrubbingTo = Math.min(Math.round(progress * (@world.frames.length - 1)), @world.frames.length - 1) @scrubbingTo = Math.round(progress * (@world.frames.length - 1))
@scrubbingTo = Math.max @scrubbingTo, 1
@scrubbingTo = Math.min @scrubbingTo, @world.frames.length - 1
@scrubbingPlaybackSpeed = Math.sqrt(Math.abs(@scrubbingTo - @currentFrame) * @world.dt / (scrubDuration or 0.5)) @scrubbingPlaybackSpeed = Math.sqrt(Math.abs(@scrubbingTo - @currentFrame) * @world.dt / (scrubDuration or 0.5))
if scrubDuration if scrubDuration
t = createjs.Tween t = createjs.Tween
@ -402,7 +404,7 @@ module.exports = Surface = class Surface extends CocoClass
@playing = (e ? {}).playing ? true @playing = (e ? {}).playing ? true
@setPlayingCalled = true @setPlayingCalled = true
if @playing and @currentFrame >= (@world.totalFrames - 5) if @playing and @currentFrame >= (@world.totalFrames - 5)
@currentFrame = 0 @currentFrame = 1 # Go back to the beginning (but not frame 0, that frame is weird)
if @fastForwardingToFrame and not @playing if @fastForwardingToFrame and not @playing
@fastForwardingToFrame = null @fastForwardingToFrame = null

View file

@ -55,7 +55,7 @@
line-height: 20px line-height: 20px
strong strong
color: #09B057 color: #FFCCAA
.hud-hint .hud-hint
font-weight: normal font-weight: normal

View file

@ -99,7 +99,7 @@
@include gradient-striped() @include gradient-striped()
outline: 2px outset #0099ff outline: 2px outset #0099ff
@include box-shadow(1px 1px 4px black) @include box-shadow(1px 1px 4px black)
&.playback-ended .executing &.playback-ended .executing, &.user-code-problem .executing
background-color: rgba(50, 255, 80, 0.65) background-color: rgba(50, 255, 80, 0.65)
outline: 0 outline: 0
@include box-shadow(0 0 0px black) @include box-shadow(0 0 0px black)
@ -125,34 +125,29 @@
// TODO: Pulses too quickly during playback // TODO: Pulses too quickly during playback
@include animation(pulseRedBackground 1s infinite) @include animation(pulseRedBackground 1s infinite)
&:not(.playback-ended) &:not(.playback-ended):not(.user-code-problem)
.executing:not(.ace_gutter-cell) .executing:not(.ace_gutter-cell)
background-size: 40px 40px background-size: 40px 40px
@include animation(progress-bar-stripes 0.5s linear infinite) @include animation(progress-bar-stripes 0.5s linear infinite)
.ace_gutter-cell.executing:not(.ace_error):not(.ace_warning):not(.ace_info):after &:not(.user-code-problem)
.ace_gutter-cell.executing:not(.ace_error):not(.ace_warning):not(.ace_info):after
// Experimenting with a larger executing-line-pointer
content: "\e072" // Experimenting with a larger executing-line-pointer
position: relative content: "\e072"
top: -31px position: relative
left: -39px top: -31px
display: inline-block left: -39px
font-family: 'Glyphicons Halflings' display: inline-block
font-style: normal font-family: 'Glyphicons Halflings'
font-weight: normal font-style: normal
line-height: 1 font-weight: normal
color: white line-height: 1
text-shadow: 0 0 5px black, 0 0 5px black, 0 0 5px black color: white
font-size: 39px text-shadow: 0 0 5px black, 0 0 5px black, 0 0 5px black
-webkit-font-smoothing: antialiased font-size: 39px
-moz-osx-font-smoothing: grayscale -webkit-font-smoothing: antialiased
-moz-osx-font-smoothing: grayscale
//display: block
//margin-left: 1px
//background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOm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RFOENDNTEzNTJCMUYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7SazaGAAAAiElEQVR42mL8//8/AzUBEwOVweA3kAWboI2jCyhgDwBx4ZH9ey5Qy4UOQHweaHg/EAtQ08sFUIMDqBmGCkC8HmgoCCtQM1ICoK5toGYsg8KzHmjo+UGbDj8AcSMwORkSnQ7xgA3QtPmApISNBTyAGrSBGl6eAMSGxBhGyIVkZT3G0fKQYgAQYACL+C2ZM6PC7AAAAABJRU5ErkJggg==)
//background-position: 0px center
.ace_gutter-cell.executed:not(.ace_error):not(.ace_warning):not(.ace_info) .ace_gutter-cell.executed:not(.ace_error):not(.ace_warning):not(.ace_info)
margin-left: 1px margin-left: 1px

View file

@ -126,8 +126,6 @@ module.exports = class AuthModal extends ModalView
step.done = false for step in @gplusAuthSteps step.done = false for step in @gplusAuthSteps
handler = application.gplusHandler handler = application.gplusHandler
@renderGPlusAuthChecklist()
@listenToOnce handler, 'logged-in', -> @listenToOnce handler, 'logged-in', ->
@gplusAuthSteps[0].done = true @gplusAuthSteps[0].done = true
@renderGPlusAuthChecklist() @renderGPlusAuthChecklist()

View file

@ -210,6 +210,7 @@ module.exports = class LevelPlaybackView extends CocoView
onProgressHover: (e, offsetX) -> onProgressHover: (e, offsetX) ->
timeRatio = @$progressScrubber.width() / @totalTime timeRatio = @$progressScrubber.width() / @totalTime
offsetX ?= e.clientX - $(e.target).closest('#timeProgress').offset().left offsetX ?= e.clientX - $(e.target).closest('#timeProgress').offset().left
offsetX = Math.max 0, offsetX
@newTime = offsetX / timeRatio @newTime = offsetX / timeRatio
@updatePopupContent() @updatePopupContent()
@timePopup?.onHover e @timePopup?.onHover e