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") ->
|
addEmitter: (x, y, kind="level-dungeon-premium") ->
|
||||||
return if @unsupported
|
return if @unsupported
|
||||||
options = $.extend true, {}, particleKinds[kind]
|
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"
|
options.group.texture = THREE.ImageUtils.loadTexture "/images/common/particles/#{options.group.texture}.png"
|
||||||
scale = 100
|
scale = 100
|
||||||
aspectRatio = @$el
|
aspectRatio = @$el
|
||||||
|
@ -221,6 +222,12 @@ particleKinds['level-dungeon-hero-ladder'] = ext particleKinds['level-dungeon-pr
|
||||||
colorMiddle: hsl 0, 0.75, 0.5
|
colorMiddle: hsl 0, 0.75, 0.5
|
||||||
colorEnd: hsl 0, 0.75, 0.3
|
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'],
|
particleKinds['level-forest-premium-hero'] = ext particleKinds['level-forest-premium'],
|
||||||
emitter:
|
emitter:
|
||||||
particleCount: 200
|
particleCount: 200
|
||||||
|
@ -249,6 +256,12 @@ particleKinds['level-forest-hero-ladder'] = ext particleKinds['level-forest-prem
|
||||||
colorMiddle: hsl 0, 1, 0.5
|
colorMiddle: hsl 0, 1, 0.5
|
||||||
colorEnd: hsl 0, 0.75, 0.1
|
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'],
|
particleKinds['level-forest-premium-item'] = ext particleKinds['level-forest-gate'],
|
||||||
emitter:
|
emitter:
|
||||||
particleCount: 2000
|
particleCount: 2000
|
||||||
|
@ -292,6 +305,12 @@ particleKinds['level-desert-hero-ladder'] = ext particleKinds['level-desert-prem
|
||||||
colorMiddle: hsl 0, 1, 0.5
|
colorMiddle: hsl 0, 1, 0.5
|
||||||
colorEnd: hsl 0, 0.75, 0.1
|
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'],
|
particleKinds['level-mountain-premium-hero'] = ext particleKinds['level-mountain-premium'],
|
||||||
emitter:
|
emitter:
|
||||||
particleCount: 200
|
particleCount: 200
|
||||||
|
@ -319,3 +338,9 @@ particleKinds['level-mountain-hero-ladder'] = ext particleKinds['level-mountain-
|
||||||
colorStart: hsl 0, 0.95, 0.3
|
colorStart: hsl 0, 0.95, 0.3
|
||||||
colorMiddle: hsl 0, 1, 0.5
|
colorMiddle: hsl 0, 1, 0.5
|
||||||
colorEnd: hsl 0, 0.75, 0.1
|
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' }
|
description: { type: 'string', format: 'hidden' }
|
||||||
i18n: { type: 'object', format: 'hidden' }
|
i18n: { type: 'object', format: 'hidden' }
|
||||||
requiresSubscription: { type: 'boolean' }
|
requiresSubscription: { type: 'boolean' }
|
||||||
|
replayable: { type: 'boolean' }
|
||||||
type: {'enum': ['campaign', 'ladder', 'ladder-tutorial', 'hero', 'hero-ladder', 'hero-coop']}
|
type: {'enum': ['campaign', 'ladder', 'ladder-tutorial', 'hero', 'hero-ladder', 'hero-coop']}
|
||||||
slug: { type: 'string', format: 'hidden' }
|
slug: { type: 'string', format: 'hidden' }
|
||||||
original: { type: 'string', format: 'hidden' }
|
original: { type: 'string', format: 'hidden' }
|
||||||
|
|
|
@ -109,6 +109,18 @@ $gameControlMargin: 30px
|
||||||
border: 3px solid gold
|
border: 3px solid gold
|
||||||
@include box-shadow(0px 0px 35px skyblue)
|
@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
|
img.banner
|
||||||
position: absolute
|
position: absolute
|
||||||
bottom: 38%
|
bottom: 38%
|
||||||
|
|
|
@ -23,6 +23,8 @@ if campaign
|
||||||
img.banner(src="/images/pages/play/level-banner-complete.png")
|
img.banner(src="/images/pages/play/level-banner-complete.png")
|
||||||
if levelStatusMap[level.slug] === 'started'
|
if levelStatusMap[level.slug] === 'started'
|
||||||
img.banner(src="/images/pages/play/level-banner-started.png")
|
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] || ""))
|
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)
|
.level-info-container(data-level-slug=level.slug, data-level-path=level.levelPath || 'level', data-level-name=level.name)
|
||||||
- var playCount = levelPlayCountMap[level.slug]
|
- var playCount = levelPlayCountMap[level.slug]
|
||||||
|
|
|
@ -30,7 +30,7 @@ class LevelSessionsCollection extends CocoCollection
|
||||||
|
|
||||||
constructor: (model) ->
|
constructor: (model) ->
|
||||||
super()
|
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
|
class CampaignsCollection extends CocoCollection
|
||||||
url: '/db/campaign'
|
url: '/db/campaign'
|
||||||
|
@ -66,6 +66,7 @@ module.exports = class CampaignView extends RootView
|
||||||
@terrain ?= 'dungeon'
|
@terrain ?= 'dungeon'
|
||||||
@levelStatusMap = {}
|
@levelStatusMap = {}
|
||||||
@levelPlayCountMap = {}
|
@levelPlayCountMap = {}
|
||||||
|
@levelDifficultyMap = {}
|
||||||
@sessions = @supermodel.loadCollection(new LevelSessionsCollection(), 'your_sessions', {cache: false}, 0).model
|
@sessions = @supermodel.loadCollection(new LevelSessionsCollection(), 'your_sessions', {cache: false}, 0).model
|
||||||
@listenToOnce @sessions, 'sync', @onSessionsLoaded
|
@listenToOnce @sessions, 'sync', @onSessionsLoaded
|
||||||
unless @terrain
|
unless @terrain
|
||||||
|
@ -179,6 +180,7 @@ module.exports = class CampaignView extends RootView
|
||||||
@campaign.renderedLevels = context.levels if @campaign
|
@campaign.renderedLevels = context.levels if @campaign
|
||||||
|
|
||||||
context.levelStatusMap = @levelStatusMap
|
context.levelStatusMap = @levelStatusMap
|
||||||
|
context.levelDifficultyMap = @levelDifficultyMap
|
||||||
context.levelPlayCountMap = @levelPlayCountMap
|
context.levelPlayCountMap = @levelPlayCountMap
|
||||||
context.isIPadApp = application.isIPadApp
|
context.isIPadApp = application.isIPadApp
|
||||||
context.mapType = _.string.slugify @terrain
|
context.mapType = _.string.slugify @terrain
|
||||||
|
@ -344,14 +346,16 @@ module.exports = class CampaignView extends RootView
|
||||||
@particleMan ?= new ParticleMan()
|
@particleMan ?= new ParticleMan()
|
||||||
@particleMan.removeEmitters()
|
@particleMan.removeEmitters()
|
||||||
@particleMan.attach @$el.find('.map')
|
@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 = ['level', @terrain]
|
||||||
particleKey.push level.type if level.type and level.type isnt 'hero'
|
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 'premium' if level.requiresSubscription
|
||||||
particleKey.push 'gate' if level.slug in ['kithgard-gates', 'siege-of-stonehold', 'clash-of-clones']
|
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 'hero' if level.unlocksHero and not level.unlockedHero
|
||||||
particleKey.push 'item' if level.slug is 'apocalypse' # TODO: generalize
|
particleKey.push 'item' if level.slug is 'apocalypse' # TODO: generalize
|
||||||
continue if particleKey.length is 2 # Don't show basic levels
|
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('-')
|
@particleMan.addEmitter level.position.x / 100, level.position.y / 100, particleKey.join('-')
|
||||||
|
|
||||||
onMouseEnterPortals: (e) ->
|
onMouseEnterPortals: (e) ->
|
||||||
|
@ -385,6 +389,7 @@ module.exports = class CampaignView extends RootView
|
||||||
return if @editorMode
|
return if @editorMode
|
||||||
for session in @sessions.models
|
for session in @sessions.models
|
||||||
@levelStatusMap[session.get('levelID')] = if session.get('state')?.complete then 'complete' else 'started'
|
@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()
|
@render()
|
||||||
@loadUserPollsRecord() unless me.get 'anonymous'
|
@loadUserPollsRecord() unless me.get 'anonymous'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue