mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Fixed #2390. Fixed #2391. Added hero-ladder and replayable particles to campaign level banners, plus replayable difficulty indicators.
This commit is contained in:
parent
a7bb97e5f2
commit
75b3361efe
5 changed files with 47 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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' }
|
||||
|
|
|
@ -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%
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue