From def4d01c8ecf2e90feb8e9ccc0c0e426624d27d5 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 19 Aug 2014 19:21:36 -0700 Subject: [PATCH 1/2] Starting to let us control the size of the achievements popup, although much more Sass math is needed. --- app/lib/simulator/Simulator.coffee | 1 + app/lib/surface/SpriteBoss.coffee | 9 +-- app/styles/achievements.sass | 88 ++++++++++++++++++------------ 3 files changed, 58 insertions(+), 40 deletions(-) diff --git a/app/lib/simulator/Simulator.coffee b/app/lib/simulator/Simulator.coffee index f8e485d31..0cfbf6ce0 100644 --- a/app/lib/simulator/Simulator.coffee +++ b/app/lib/simulator/Simulator.coffee @@ -86,6 +86,7 @@ module.exports = class Simulator extends CocoClass @cleanupAndSimulateAnotherTask() processSingleGameResults: (simulationResults) -> + return console.error "Weird, we destroyed the Simulator before it processed results?" if @destroyed taskResults = @formTaskResultsObject simulationResults console.log 'Processing results:', taskResults humanSessionRank = taskResults.sessions[0].metrics.rank diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index 37ec06c6e..86360df1a 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -63,13 +63,14 @@ module.exports = class SpriteBoss extends CocoClass layerForChild: (child, sprite) -> unless child.layerPriority? - # TODO: make better system - child.layerPriority = 0 if sprite?.thang?.isSelectable - child.layerPriority = -40 if sprite?.thang?.isLand + if thang = sprite?.thang + child.layerPriority = thang.layerPriority + child.layerPriority ?= 0 if thang.isSelectable + child.layerPriority ?= -40 if thang.isLand return @spriteLayers['Default'] unless child.layerPriority layer = _.findLast @spriteLayers, (layer, name) -> layer.layerPriority <= child.layerPriority - #console.log 'layer for', child, 'is', (layer ? @spriteLayers['Default']) + layer ?= @spriteLayers['Land'] if child.layerPriority < -40 layer ? @spriteLayers['Default'] addSprite: (sprite, id=null, layer=null) -> diff --git a/app/styles/achievements.sass b/app/styles/achievements.sass index 39a277aa4..cf1425670 100644 --- a/app/styles/achievements.sass +++ b/app/styles/achievements.sass @@ -1,5 +1,20 @@ @import 'bootstrap/variables' +// absolutes +$icon-margin-scale: 0.7 + +// control relative size +$overall-scale: 0.7 +$bar-width: 340px +$bar-height: 30px +$icon-size: 200px +$icon-image-size: 130px +$content-width: 450px +$content-height: 160px + +// just on user achievement list page +$user-achievements-scale: 0.8 + .achievement-body position: relative @@ -10,12 +25,14 @@ width: 100% height: 100% img + border-radius: 25% position: absolute margin: auto top: 0 left: 0 right: 0 bottom: 0 + width: $overall-scale * $icon-image-size &.locked .achievement-content @@ -36,7 +53,7 @@ max-height: 2em overflow: hidden text-overflow: ellipsis - + font-size: 18px > .achievement-description white-space: initial @@ -57,15 +74,13 @@ margin: 10px 0px .achievement-icon - width: 120px - height: 120px - top: -10px + width: $overall-scale * $icon-size * $user-achievements-scale + height: $overall-scale * $icon-size * $user-achievements-scale + top: -5px .achievement-image img - -moz-transform: scale(0.6) - -webkit-transform: scale(0.6) - transform: scale(0.6) + width: $overall-scale * $user-achievements-scale * $icon-image-size .achievement-content margin-left: 60px @@ -83,16 +98,16 @@ max-height: 2.6em .achievement-popup - padding: 20px 0px + padding: $overall-scale * 20px 0px position: relative .achievement-body .achievement-icon z-index: 1000 - width: 200px - height: 200px - left: -140px - top: -20px + width: $overall-scale * $icon-size + height: $overall-scale * $icon-size + left: $overall-scale * (-$icon-margin-scale * $icon-size) + top: $overall-scale * -20px .achievement-image img @@ -106,53 +121,53 @@ .achievement-content background-image: url("/images/achievements/achievement_background.png") position: relative - width: 450px - height: 160px - padding: 24px 30px 20px 60px + width: $overall-scale * $content-width + height: $overall-scale * $content-height + padding: $overall-scale * 24px $overall-scale * 30px $overall-scale * 20px $overall-scale * 60px .achievement-title font-family: Bangers - font-size: 28px - padding-left: -50px + font-size: $overall-scale * 28px + padding-left: $overall-scale * -50px .achievement-description - font-size: 15px + font-size: $overall-scale * 16px line-height: 1.3em max-height: 2.6em margin-top: auto margin-bottom: 0px !important .progress-wrapper - margin-left: 20px + margin-left: $overall-scale * 20px position: absolute - bottom: 48px + bottom: $overall-scale * 48px .user-level - font-size: 20px + font-size: $overall-scale * 20px color: white position: absolute - left: -15px - margin-top: -8px + left: $overall-scale * -15px + margin-top: $overall-scale * -8px vertical-align: middle z-index: 1000 > .progress-bar-wrapper position: absolute - margin-left: 17px - width: 314px - height: 20px + margin-left: $overall-scale * 17px + width: $overall-scale * ($bar-width - (2 * 5px) - 17px) + height: $overall-scale * ($bar-height - (2 * 5px)) z-index: 2 > .progress - margin-top: 5px - border-radius: 50px - height: 14px + margin-top: $overall-scale * 5px + border-radius: $overall-scale * 50px + height: $overall-scale * 14px > .progress-bar-border position: absolute - width: 340px - height: 30px - margin-top: -2px + width: $overall-scale * $bar-width + height: $overall-scale * $bar-height + margin-top: $overall-scale * -2px background: url("/images/achievements/bar_border.png") no-repeat background-size: 100% 100% z-index: 1 @@ -236,8 +251,9 @@ .user-level background-image: url("/images/achievements/level-bg.png") - width: 38px - height: 38px - line-height: 38px - font-size: 20px + background-size: 100% 100% + width: $overall-scale * 38px + height: $overall-scale * 38px + line-height: $overall-scale * 38px + font-size: $overall-scale * 20px font-family: $font-family-base From df7f1b2b9b6d4b9b58301e7a1e7ce6abfbd553e6 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 19 Aug 2014 22:33:33 -0700 Subject: [PATCH 2/2] Now have 'free' rotationType, equivalent to previous default of undefined. --- app/lib/surface/CocoSprite.coffee | 2 +- app/schemas/models/thang_type.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index 92d2a5f9b..c7b9f7396 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -403,7 +403,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass zFactor = vz / Math.sqrt(vz * vz + vx * vx) rotation -= xFactor * zFactor * 45 imageObject ?= @imageObject - return imageObject.rotation = rotation if not rotationType + return imageObject.rotation = rotation if rotationType is 'free' or not rotationType @updateIsometricRotation(rotation, imageObject) getRotation: -> diff --git a/app/schemas/models/thang_type.coffee b/app/schemas/models/thang_type.coffee index 177c81f22..5b7e4851e 100644 --- a/app/schemas/models/thang_type.coffee +++ b/app/schemas/models/thang_type.coffee @@ -112,7 +112,7 @@ _.extend ThangTypeSchema.properties, say: c.object {format: 'slug-props', additionalProperties: {$ref: '#/definitions/sound'}}, defaultSimlish: c.array({}, {$ref: '#/definitions/sound'}) swearingSimlish: c.array({}, {$ref: '#/definitions/sound'}) - rotationType: {title: 'Rotation', type: 'string', enum: ['isometric', 'fixed']} + rotationType: {title: 'Rotation', type: 'string', enum: ['isometric', 'fixed', 'free']} matchWorldDimensions: {title: 'Match World Dimensions', type: 'boolean'} shadow: {title: 'Shadow Diameter', type: 'number', format: 'meters', description: 'Shadow diameter in meters'} layerPriority: