mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 00:28:31 -05:00
ef8e7563b4
Also moving getCampaignForSlug to new CampaignOptions file.
23 lines
741 B
CoffeeScript
23 lines
741 B
CoffeeScript
CampaignList = require('views/play/WorldMapView').campaigns
|
|
|
|
# TODO: Is this file structured correctly?
|
|
|
|
# Per-campaign options, with default fallback set
|
|
options =
|
|
'default':
|
|
autocompleteFontSizePx: 16
|
|
'dungeon':
|
|
autocompleteFontSizePx: 20
|
|
|
|
module.exports = CampaignOptions =
|
|
getCampaignForSlug: (slug) ->
|
|
return unless slug
|
|
for campaign in CampaignList
|
|
for level in campaign.levels
|
|
return campaign.id if level.id is slug
|
|
|
|
getOption: (levelSlug, option) ->
|
|
return unless levelSlug and option
|
|
return unless campaign = CampaignOptions.getCampaignForSlug levelSlug
|
|
return options[campaign]?[option] if options[campaign]?[option]?
|
|
return options.default[option] if options.default[option]?
|