Fixed showing hero unlock portraits on world map. Showing them now even before their levels are unlocked, and showing until you purchase, not just unlock them.

This commit is contained in:
Nick Winter 2015-01-29 19:05:30 -08:00
parent fd0e7a8c44
commit 1630b30351
3 changed files with 24 additions and 9 deletions
app

View file

@ -66,7 +66,7 @@ $gameControlMargin: 30px
.level, .level-shadow
position: absolute
border-radius: 100%
border-radius: 50%
-webkit-transform: scaleY(0.75)
transform: scaleY(0.75)
@ -130,16 +130,24 @@ $gameControlMargin: 30px
&.started .glyphicon-star
left: 0.5px
img.hero-portrait
width: 120%
position: absolute
height: auto
bottom: 75%
left: 75%
border: 1px solid black
border-radius: 100%
background: white
margin-left: 0
margin-bottom: 0
img.hero-portrait
position: absolute
border: 1px solid black
border-radius: 50%
background: white
width: $levelDotWidth * 1.5
height: $levelDotHeight * 1.5
margin-left: -0.5 * $levelDotWidth * 1.5
margin-bottom: -$levelDotHeight / 3 * 1.5
.level-shadow
z-index: 1
@ -425,6 +433,9 @@ $gameControlMargin: 30px
vertical-align: bottom
margin: -20px 0 -6px 5px
.particle-man
z-index: 2
body:not(.ipad) #campaign-view
.level-info-container

View file

@ -8,8 +8,8 @@
each level in levels
if !level.hidden
div(style="left: #{level.position.x}%; bottom: #{level.position.y}%; background-color: #{level.color}", class="level" + (level.next ? " next" : "") + (level.disabled ? " disabled" : "") + (level.locked ? " locked" : "") + " " + levelStatusMap[level.slug] || "", data-level-slug=level.slug, data-level-original=level.original, title=i18n(level, 'name') + (level.disabled ? ' (Coming Soon to Adventurers)' : ''))
if level.unlocksHero && !level.unlockedHero
img.hero-portrait(src=level.unlocksHero.img)
if level.unlocksHero && !level.purchasedHero
img.hero-portrait(src="/file/db/thang.type/#{level.unlocksHero}/portrait.png")
a(href=level.type == 'hero' ? '#' : level.disabled ? "/play" : "/play/#{level.levelPath || 'level'}/#{level.slug}", disabled=level.disabled, data-level-slug=level.slug, data-level-path=level.levelPath || 'level', data-level-name=level.name)
if level.requiresSubscription
img.star(src="/images/pages/play/star.png")
@ -40,6 +40,8 @@
if isIPadApp && !level.disabled && !level.locked
button.btn.btn-success.btn-lg.start-level(data-i18n="common.play") Play
else if level.unlocksHero && !level.purchasedHero
img.hero-portrait(src="/file/db/thang.type/#{level.unlocksHero}/portrait.png", style="left: #{level.position.x}%; bottom: #{level.position.y}%;")
for adjacentCampaign in adjacentCampaigns
a(href=(editorMode ? "/editor/campaign/" : "/play/") + adjacentCampaign.slug)

View file

@ -146,8 +146,10 @@ module.exports = class CampaignView extends RootView
level.color = 'rgb(255, 80, 60)'
if level.requiresSubscription
level.color = 'rgb(80, 130, 200)'
if unlocksHero = _.find(level.rewards, 'hero')?.hero
level.unlocksHero = unlocksHero
if level.unlocksHero
level.unlockedHero = level.unlocksHero.originalID in (me.get('earned')?.heroes or [])
level.purchasedHero = level.unlocksHero in (me.get('purchased')?.heroes or [])
level.hidden = level.locked
unless level.disabled
++context.levelsTotal