From 75b3361efed03bb8787c434258cc59d543069fd4 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 13 Apr 2015 17:07:13 -0700 Subject: [PATCH] Fixed #2390. Fixed #2391. Added hero-ladder and replayable particles to campaign level banners, plus replayable difficulty indicators. --- app/core/ParticleMan.coffee | 25 +++++++++++++++++++++++ app/schemas/models/campaign.schema.coffee | 1 + app/styles/play/campaign-view.sass | 12 +++++++++++ app/templates/play/campaign-view.jade | 2 ++ app/views/play/CampaignView.coffee | 9 ++++++-- 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/app/core/ParticleMan.coffee b/app/core/ParticleMan.coffee index f742e0677..f4ec2c4e0 100644 --- a/app/core/ParticleMan.coffee +++ b/app/core/ParticleMan.coffee @@ -85,6 +85,7 @@ module.exports = ParticleMan = class ParticleMan extends CocoClass addEmitter: (x, y, kind="level-dungeon-premium") -> return if @unsupported options = $.extend true, {}, particleKinds[kind] + return console.error "Couldn't find particle configuration for", kind unless options.group options.group.texture = THREE.ImageUtils.loadTexture "/images/common/particles/#{options.group.texture}.png" scale = 100 aspectRatio = @$el @@ -221,6 +222,12 @@ particleKinds['level-dungeon-hero-ladder'] = ext particleKinds['level-dungeon-pr colorMiddle: hsl 0, 0.75, 0.5 colorEnd: hsl 0, 0.75, 0.3 +particleKinds['level-dungeon-replayable'] = particleKinds['level-dungeon-replayable-premium'] = ext particleKinds['level-dungeon-hero-ladder'], + emitter: + colorStart: hsl 0.17, 0.75, 0.7 + colorMiddle: hsl 0.17, 0.75, 0.5 + colorEnd: hsl 0.17, 0.75, 0.3 + particleKinds['level-forest-premium-hero'] = ext particleKinds['level-forest-premium'], emitter: particleCount: 200 @@ -249,6 +256,12 @@ particleKinds['level-forest-hero-ladder'] = ext particleKinds['level-forest-prem colorMiddle: hsl 0, 1, 0.5 colorEnd: hsl 0, 0.75, 0.1 +particleKinds['level-forest-replayable'] = particleKinds['level-forest-replayable-premium'] = ext particleKinds['level-forest-hero-ladder'], + emitter: + colorStart: hsl 0.17, 0.75, 0.7 + colorMiddle: hsl 0.17, 0.75, 0.5 + colorEnd: hsl 0.17, 0.75, 0.3 + particleKinds['level-forest-premium-item'] = ext particleKinds['level-forest-gate'], emitter: particleCount: 2000 @@ -292,6 +305,12 @@ particleKinds['level-desert-hero-ladder'] = ext particleKinds['level-desert-prem colorMiddle: hsl 0, 1, 0.5 colorEnd: hsl 0, 0.75, 0.1 +particleKinds['level-desert-replayable'] = particleKinds['level-desert-replayable-premium'] = ext particleKinds['level-desert-hero-ladder'], + emitter: + colorStart: hsl 0.17, 0.75, 0.7 + colorMiddle: hsl 0.17, 0.75, 0.5 + colorEnd: hsl 0.17, 0.75, 0.3 + particleKinds['level-mountain-premium-hero'] = ext particleKinds['level-mountain-premium'], emitter: particleCount: 200 @@ -319,3 +338,9 @@ particleKinds['level-mountain-hero-ladder'] = ext particleKinds['level-mountain- colorStart: hsl 0, 0.95, 0.3 colorMiddle: hsl 0, 1, 0.5 colorEnd: hsl 0, 0.75, 0.1 + +particleKinds['level-mountain-replayable'] = particleKinds['level-mountain-replayable-premium'] = ext particleKinds['level-mountain-hero-ladder'], + emitter: + colorStart: hsl 0.17, 0.75, 0.7 + colorMiddle: hsl 0.17, 0.75, 0.5 + colorEnd: hsl 0.17, 0.75, 0.3 diff --git a/app/schemas/models/campaign.schema.coffee b/app/schemas/models/campaign.schema.coffee index 03d28ae79..eae2985dc 100644 --- a/app/schemas/models/campaign.schema.coffee +++ b/app/schemas/models/campaign.schema.coffee @@ -56,6 +56,7 @@ _.extend CampaignSchema.properties, { description: { type: 'string', format: 'hidden' } i18n: { type: 'object', format: 'hidden' } requiresSubscription: { type: 'boolean' } + replayable: { type: 'boolean' } type: {'enum': ['campaign', 'ladder', 'ladder-tutorial', 'hero', 'hero-ladder', 'hero-coop']} slug: { type: 'string', format: 'hidden' } original: { type: 'string', format: 'hidden' } diff --git a/app/styles/play/campaign-view.sass b/app/styles/play/campaign-view.sass index f56d5e12e..3882f5e98 100644 --- a/app/styles/play/campaign-view.sass +++ b/app/styles/play/campaign-view.sass @@ -109,6 +109,18 @@ $gameControlMargin: 30px border: 3px solid gold @include box-shadow(0px 0px 35px skyblue) + .level-difficulty-banner-text + position: absolute + position: absolute + bottom: 170% + pointer-events: none + color: rgb(246, 208, 2) + text-shadow: 0px 1px 0px black + font-size: 1.8vw + z-index: 1 + width: 100% + text-align: center + img.banner position: absolute bottom: 38% diff --git a/app/templates/play/campaign-view.jade b/app/templates/play/campaign-view.jade index b74e80e90..098f6f14a 100644 --- a/app/templates/play/campaign-view.jade +++ b/app/templates/play/campaign-view.jade @@ -23,6 +23,8 @@ if campaign img.banner(src="/images/pages/play/level-banner-complete.png") if levelStatusMap[level.slug] === 'started' img.banner(src="/images/pages/play/level-banner-started.png") + if levelDifficultyMap[level.slug] + .level-difficulty-banner-text= levelDifficultyMap[level.slug] div(style="left: #{level.position.x}%; bottom: #{level.position.y}%", class="level-shadow" + (level.next ? " next" : "") + " " + (levelStatusMap[level.slug] || "")) .level-info-container(data-level-slug=level.slug, data-level-path=level.levelPath || 'level', data-level-name=level.name) - var playCount = levelPlayCountMap[level.slug] diff --git a/app/views/play/CampaignView.coffee b/app/views/play/CampaignView.coffee index e9f30b45c..d81973175 100644 --- a/app/views/play/CampaignView.coffee +++ b/app/views/play/CampaignView.coffee @@ -30,7 +30,7 @@ class LevelSessionsCollection extends CocoCollection constructor: (model) -> super() - @url = "/db/user/#{me.id}/level.sessions?project=state.complete,levelID" + @url = "/db/user/#{me.id}/level.sessions?project=state.complete,levelID,state.difficulty" class CampaignsCollection extends CocoCollection url: '/db/campaign' @@ -66,6 +66,7 @@ module.exports = class CampaignView extends RootView @terrain ?= 'dungeon' @levelStatusMap = {} @levelPlayCountMap = {} + @levelDifficultyMap = {} @sessions = @supermodel.loadCollection(new LevelSessionsCollection(), 'your_sessions', {cache: false}, 0).model @listenToOnce @sessions, 'sync', @onSessionsLoaded unless @terrain @@ -179,6 +180,7 @@ module.exports = class CampaignView extends RootView @campaign.renderedLevels = context.levels if @campaign context.levelStatusMap = @levelStatusMap + context.levelDifficultyMap = @levelDifficultyMap context.levelPlayCountMap = @levelPlayCountMap context.isIPadApp = application.isIPadApp context.mapType = _.string.slugify @terrain @@ -344,14 +346,16 @@ module.exports = class CampaignView extends RootView @particleMan ?= new ParticleMan() @particleMan.removeEmitters() @particleMan.attach @$el.find('.map') - for level in @campaign.renderedLevels ? {} when level.hidden or (level.slug is 'apocalypse' and @levelStatusMap[level.slug] isnt 'complete') + for level in @campaign.renderedLevels ? {} particleKey = ['level', @terrain] particleKey.push level.type if level.type and level.type isnt 'hero' + particleKey.push 'replayable' if level.replayable particleKey.push 'premium' if level.requiresSubscription particleKey.push 'gate' if level.slug in ['kithgard-gates', 'siege-of-stonehold', 'clash-of-clones'] particleKey.push 'hero' if level.unlocksHero and not level.unlockedHero particleKey.push 'item' if level.slug is 'apocalypse' # TODO: generalize continue if particleKey.length is 2 # Don't show basic levels + continue unless level.hidden or _.intersection(particleKey, ['item', 'hero-ladder', 'replayable']).length @particleMan.addEmitter level.position.x / 100, level.position.y / 100, particleKey.join('-') onMouseEnterPortals: (e) -> @@ -385,6 +389,7 @@ module.exports = class CampaignView extends RootView return if @editorMode for session in @sessions.models @levelStatusMap[session.get('levelID')] = if session.get('state')?.complete then 'complete' else 'started' + @levelDifficultyMap[session.get('levelID')] = session.get('state').difficulty if session.get('state')?.difficulty @render() @loadUserPollsRecord() unless me.get 'anonymous'