Add gd2 and wd2 to individual game

Closes #3875
This commit is contained in:
Matt Lott 2016-08-22 14:05:59 -07:00
parent 382304a256
commit c2ae4d3748
4 changed files with 20 additions and 9 deletions

View file

@ -524,7 +524,7 @@ $gameControlMargin: 30px
$campaignWidth: 317px
$campaignHeight: 634px
$campaignHoverScale: 1.2
width: 6 * $campaignWidth
width: 8 * $campaignWidth
height: $campaignHeight * $campaignHoverScale
flex-wrap: nowrap
display: flex
@ -663,6 +663,10 @@ $gameControlMargin: 30px
background-position: -151px 0px
&.campaign-game-dev-1
background-position: -454px 0px
&.campaign-web-dev-2
background-position: -291px 0px
&.campaign-game-dev-2
background-position: -628px 0px
.small-nav-logo, .picoctf-powered-by

View file

@ -100,9 +100,10 @@ if view.showAds()
else
.portal
.portals
for campaignSlug in ['dungeon', 'beta-campaigns', 'forest', 'desert', 'mountain', 'glacier', 'volcano']
if campaignSlug === 'beta-campaigns'
- var betaSlugs = _.shuffle(['campaign-game-dev-1', 'campaign-web-dev-1']);
//- TODO: you must change CampaignView portalsWidth when adding/removing campaigns here
for campaignSlug in ['dungeon', 'beta-campaigns-1', 'forest', 'beta-campaigns-2', 'desert', 'mountain', 'glacier', 'volcano']
if campaignSlug === 'beta-campaigns-1' || campaignSlug === 'beta-campaigns-2'
- var betaSlugs = campaignSlug === 'beta-campaigns-1' ? _.shuffle(['campaign-game-dev-1', 'campaign-web-dev-1']) : _.shuffle(['campaign-game-dev-2', 'campaign-web-dev-2']);
.beta-container
each campaignSlug in betaSlugs
- var campaign = campaigns[campaignSlug];
@ -129,8 +130,6 @@ if view.showAds()
span= i18n(campaign.attributes, 'description')
else
- var campaign = campaigns[campaignSlug];
if !campaign
- continue;
- var godmode = me.get('permissions', true).indexOf('godmode') != -1;
div(class="campaign #{campaignSlug}" + (campaign ? "" : " silhouette") + (campaign && campaign.locked && !godmode ? " locked" : ""), data-campaign-slug=campaignSlug)
.campaign-label

View file

@ -196,7 +196,9 @@ module.exports = class CampaignView extends RootView
context.requiresSubscription = @requiresSubscription
context.editorMode = @editorMode
context.adjacentCampaigns = _.filter _.values(_.cloneDeep(@campaign?.get('adjacentCampaigns') or {})), (ac) =>
return false if ac.showIfUnlocked and (ac.showIfUnlocked not in me.levels()) and not @editorMode
if ac.showIfUnlocked and not @editorMode
return false if _.isString(ac.showIfUnlocked) and ac.showIfUnlocked not in me.levels()
return false if _.isArray(ac.showIfUnlocked) and _.intersection(ac.showIfUnlocked, me.levels()).length < 0
ac.name = utils.i18n ac, 'name'
styles = []
styles.push "color: #{ac.color}" if ac.color
@ -226,7 +228,10 @@ module.exports = class CampaignView extends RootView
campaign.locked = true
for campaign in @campaigns.models
for acID, ac of campaign.get('adjacentCampaigns') ? {}
_.find(@campaigns.models, id: acID)?.locked = false if ac.showIfUnlocked in me.levels()
if _.isString(ac.showIfUnlocked)
_.find(@campaigns.models, id: acID)?.locked = false if ac.showIfUnlocked in me.levels()
else if _.isArray(ac.showIfUnlocked)
_.find(@campaigns.models, id: acID)?.locked = false if _.intersection(ac.showIfUnlocked, me.levels()).length
context
@ -437,7 +442,7 @@ module.exports = class CampaignView extends RootView
return if 0.2 < fraction < 0.8
direction = if fraction < 0.5 then 1 else -1
magnitude = 0.2 * bodyWidth * (if direction is -1 then fraction - 0.8 else 0.2 - fraction) / 0.2
portalsWidth = 1902 # TODO: if we add campaigns or change margins, this will get out of date...
portalsWidth = 2536 # TODO: if we add campaigns or change margins, this will get out of date...
scrollTo = $portals.offset().left + direction * magnitude
scrollTo = Math.max bodyWidth - portalsWidth, scrollTo
scrollTo = Math.min 0, scrollTo

View file

@ -421,6 +421,9 @@ module.exports = class HeroVictoryModal extends ModalView
'tabula-rasa': '',
'wanted-poster': '',
'siege-of-stonehold': '',
'go-fetch': '',
'palimpsest': '',
'quizlet': '',
'clash-of-clones': 'mountain',
'summits-gate': 'glacier'
}[@level.get('slug')] ? @level.get 'campaign'