From f17e24013bfd69a729bf3ba9cd89393fc966bf5e Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 10 Jul 2014 14:22:08 -0700 Subject: [PATCH 1/3] Fixed #1217 (scaleFactor, debug shapes). --- app/lib/surface/CocoSprite.coffee | 32 ++++++++++++++++++------------- app/lib/surface/Mark.coffee | 3 +++ app/lib/surface/SpriteBoss.coffee | 2 +- app/views/play_view.coffee | 8 ++++++++ 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index 24c5dc67b..ea0a89fea 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -45,8 +45,10 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass # Scale numbers baseScaleX: 1 # scale + flip (for current action) / resolutionFactor. baseScaleY: 1 # These numbers rarely change, so keep them around. - scaleFactor: 1 # Current scale adjustment. This can change rapidly. - targetScaleFactor: 1 # What the scaleFactor is going toward during a tween. + scaleFactorX: 1 # Current scale adjustment. This can change rapidly. + scaleFactorY: 1 + targetScaleFactorX: 1 # What the scaleFactor is going toward during a tween. + targetScaleFactorY: 1 # ACTION STATE # Actions have relations. If you say 'move', 'move_side' may play because of a direction @@ -104,7 +106,10 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass finishSetup: -> @updateBaseScale() - @scaleFactor = @thang.scaleFactor if @thang?.scaleFactor + @scaleFactorX = @thang.scaleFactorX if @thang?.scaleFactorX? + @scaleFactorX = @thang.scaleFactor if @thang?.scaleFactor? + @scaleFactorY = @thang.scaleFactorY if @thang?.scaleFactorY? + @scaleFactorY = @thang.scaleFactor if @thang?.scaleFactor? @update true # Reflect initial scale and other state setUpRasterImage: -> @@ -212,7 +217,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass # Gets the sprite to reflect what the current state of the thangs and surface are return if @stillLoading @updatePosition() - frameChanged = frameChanged or @targetScaleFactor isnt @scaleFactor + frameChanged = frameChanged or @targetScaleFactorX isnt @scaleFactorX or @targetScaleFactorY isnt @scaleFactorY if frameChanged @handledDisplayEvents = {} @updateScale() # must happen before rotation @@ -351,14 +356,16 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass scaleX = 0.5 + 0.5 * (90 - angle) / 90 # console.error 'No thang for', @ unless @thang - # TODO: support using scaleFactorX/Y from the thang object - @imageObject.scaleX = @baseScaleX * @scaleFactor * scaleX - @imageObject.scaleY = @baseScaleY * @scaleFactor * scaleY + @imageObject.scaleX = @baseScaleX * @scaleFactorX * scaleX + @imageObject.scaleY = @baseScaleY * @scaleFactorY * scaleY - if @thang and (@thang.scaleFactor or 1) isnt @targetScaleFactor + newScaleFactorX = @thang?.scaleFactorX ? @thang?.scaleFactor ? 1 + newScaleFactorY = @thang?.scaleFactorY ? @thang?.scaleFactor ? 1 + if @thang and (newScaleFactorX isnt @targetScaleFactorX or newScaleFactorY isnt @targetScaleFactorY) + @targetScaleFactorX = newScaleFactorX + @targetScaleFactorY = newScaleFactorY createjs.Tween.removeTweens(@) - createjs.Tween.get(@).to({scaleFactor: @thang.scaleFactor or 1}, 2000, createjs.Ease.elasticOut) - @targetScaleFactor = @thang.scaleFactor or 1 + createjs.Tween.get(@).to({scaleFactorX: @targetScaleFactorX, scaleFactorY: @targetScaleFactorY}, 2000, createjs.Ease.elasticOut) updateAlpha: -> @imageObject.alpha = if @hiding then 0 else 1 @@ -536,9 +543,8 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass pos.x *= scale pos.y *= scale if @thang and prop isnt 'registration' - scaleFactor = @thang.scaleFactor ? 1 - pos.x *= @thang.scaleFactorX ? scaleFactor - pos.y *= @thang.scaleFactorY ? scaleFactor + pos.x *= @thang.scaleFactorX ? @thang.scaleFactor ? 1 + pos.y *= @thang.scaleFactorY ? @thang.scaleFactor ? 1 # We might need to do this, but I don't have a good test case yet. TODO: figure out. #if prop isnt @registration # pos.x *= if @getActionProp 'flipX' then -1 else 1 diff --git a/app/lib/surface/Mark.coffee b/app/lib/surface/Mark.coffee index ff4631aec..11511634e 100644 --- a/app/lib/surface/Mark.coffee +++ b/app/lib/surface/Mark.coffee @@ -257,6 +257,9 @@ module.exports = class Mark extends CocoClass updateRotation: -> if @name is 'debug' or (@name is 'shadow' and @sprite.thang?.shape in ['rectangle', 'box']) + rot = @sprite.thang.rotation * 180 / Math.PI + unless @mark.rotation is rot + console.log @toString(), "updating rotation", @name, @sprite.thang?.shape, @sprite.thang?.rotation, "to", rot, "from", @mark.rotation @mark.rotation = @sprite.thang.rotation * 180 / Math.PI updateScale: -> diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index cab039d97..2c2664a6b 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -11,7 +11,7 @@ module.exports = class SpriteBoss extends CocoClass subscriptions: 'bus:player-joined': 'onPlayerJoined' 'bus:player-left': 'onPlayerLeft' -# 'level-set-debug': 'onSetDebug' + 'level-set-debug': 'onSetDebug' 'level-highlight-sprites': 'onHighlightSprites' 'surface:stage-mouse-down': 'onStageMouseDown' 'level-select-sprite': 'onSelectSprite' diff --git a/app/views/play_view.coffee b/app/views/play_view.coffee index 4d9d84fef..bd7a412e7 100644 --- a/app/views/play_view.coffee +++ b/app/views/play_view.coffee @@ -143,6 +143,14 @@ module.exports = class PlayView extends View ] arenas = [ + #{ + # name: 'Criss-Cross' + # difficulty: 4 + # id: 'criss-cross' + # image: '/file/db/level/528aea2d7f37fc4e0700016b/its_a_trap_icon.png' + # description: 'Participate in a bidding war with opponents to reach the other side!' + # levelPath: 'ladder' + #} { name: 'Greed' difficulty: 4 From ad2e01ee61a9c390fe4c8c9ff97962a2fb712ccd Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 10 Jul 2014 14:31:25 -0700 Subject: [PATCH 2/3] Fixed a couple tests. --- test/server/functional/level_component.spec.coffee | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/server/functional/level_component.spec.coffee b/test/server/functional/level_component.spec.coffee index d34ec82cb..697c14df7 100644 --- a/test/server/functional/level_component.spec.coffee +++ b/test/server/functional/level_component.spec.coffee @@ -21,14 +21,8 @@ describe 'LevelComponent', -> expect(err).toBeNull() done() - it 'can\'t be created by ordinary users.', (done) -> + it 'can be created by ordinary users.', (done) -> loginJoe -> - request.post {uri: url, json: component}, (err, res, body) -> - expect(res.statusCode).toBe(403) - done() - - it 'can be created by an admin.', (done) -> - loginAdmin -> request.post {uri: url, json: component}, (err, res, body) -> expect(res.statusCode).toBe(200) expect(body._id).toBeDefined() @@ -105,7 +99,8 @@ describe 'LevelComponent', -> components[0].official = true loginJoe -> request.post {uri: url, json: components[0]}, (err, res, body) -> - expect(res.statusCode).toBe(403) + expect(res.statusCode).toBe(200) + expect(body.official).toBe(false) done() it 'official property is editable by an admin.', (done) -> From 80e7b7664e37041f5b4ae75b0411a7eed2480901 Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Thu, 10 Jul 2014 15:42:44 -0700 Subject: [PATCH 3/3] Changed employer artisanal message font --- app/styles/employers.sass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/styles/employers.sass b/app/styles/employers.sass index 48ff80e10..bfb518ef8 100644 --- a/app/styles/employers.sass +++ b/app/styles/employers.sass @@ -1,10 +1,10 @@ #employers-view .artisanal-claim - font-variant: small-caps + //font-variant: small-caps text-align: center font-size: 20px font-weight: bold - font-family: Copperplate, "Copperplate Gothic Light", fantasy + font-family: Arial, Helvetica, sans-serif border-top: 1px solid #DBDBDB border-bottom: 1px solid #DBDBDB margin-bottom: 5px