mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -04:00
Added loadingTip property to levels, set them up on the LevelLoadingView, and got them prepped for i18n-ing.
This commit is contained in:
parent
6e433e1b77
commit
025780a575
5 changed files with 12 additions and 5 deletions
app
schemas/models
views
editor/level/settings
i18n
play/level
server/levels
|
@ -224,6 +224,7 @@ LevelSchema = c.object {
|
|||
c.extendNamedProperties LevelSchema # let's have the name be the first property
|
||||
_.extend LevelSchema.properties,
|
||||
description: {title: 'Description', description: 'A short explanation of what this level is about.', type: 'string', maxLength: 65536, format: 'markdown'}
|
||||
loadingTip: { type: 'string', title: 'Loading Tip', description: 'What to show for this level while it\'s loading.' }
|
||||
documentation: c.object {title: 'Documentation', description: 'Documentation articles relating to this level.', required: ['specificArticles', 'generalArticles'], 'default': {specificArticles: [], generalArticles: []}},
|
||||
specificArticles: c.array {title: 'Specific Articles', description: 'Specific documentation articles that live only in this level.', uniqueItems: true }, SpecificArticleSchema
|
||||
generalArticles: c.array {title: 'General Articles', description: 'General documentation articles that can be linked from multiple levels.', uniqueItems: true}, GeneralArticleSchema
|
||||
|
@ -243,7 +244,7 @@ _.extend LevelSchema.properties,
|
|||
body: {type: 'string', format: 'markdown', title: 'Body Text', description: 'Inserted into the Victory Modal once this level is complete. Tell the player they did a good job and what they accomplished!'},
|
||||
i18n: {type: 'object', format: 'i18n', props: ['body'], description: 'Help translate this victory message'}
|
||||
}
|
||||
i18n: {type: 'object', format: 'i18n', props: ['name', 'description'], description: 'Help translate this level'}
|
||||
i18n: {type: 'object', format: 'i18n', props: ['name', 'description', 'loadingTip'], description: 'Help translate this level'}
|
||||
icon: {type: 'string', format: 'image-file', title: 'Icon'}
|
||||
banner: {type: 'string', format: 'image-file', title: 'Banner'}
|
||||
goals: c.array {title: 'Goals', description: 'An array of goals which are visible to the player and can trigger scripts.'}, GoalSchema
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = class SettingsTabView extends CocoView
|
|||
# not thangs or scripts or the backend stuff
|
||||
editableSettings: [
|
||||
'name', 'description', 'documentation', 'nextLevel', 'background', 'victory', 'i18n', 'icon', 'goals',
|
||||
'type', 'terrain', 'showsGuide', 'banner', 'employerDescription'
|
||||
'type', 'terrain', 'showsGuide', 'banner', 'employerDescription', 'loadingTip'
|
||||
]
|
||||
|
||||
subscriptions:
|
||||
|
|
|
@ -15,6 +15,8 @@ module.exports = class I18NEditLevelView extends I18NEditModelView
|
|||
@wrapRow "Level name", ['name'], name, i18n[lang]?.name, []
|
||||
if description = @model.get('description')
|
||||
@wrapRow "Level description", ['description'], description, i18n[lang]?.description, []
|
||||
if loadingTip = @model.get('loadingTip')
|
||||
@wrapRow "Loading tip", ['loadingTip'], loadingTip, i18n[lang]?.loadingTip, []
|
||||
|
||||
# goals
|
||||
for goal, index in @model.get('goals') ? []
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = class LevelLoadingView extends CocoView
|
|||
@$el.find('.tip.rare').remove() if _.random(1, 10) < 9
|
||||
tips = @$el.find('.tip').addClass('to-remove')
|
||||
tip = _.sample(tips)
|
||||
$(tip).removeClass('to-remove')
|
||||
$(tip).removeClass('to-remove').addClass('secret')
|
||||
@$el.find('.to-remove').remove()
|
||||
@onLevelLoaded level: @options.level if @options.level?.get('goals') # If Level was already loaded.
|
||||
|
||||
|
@ -47,6 +47,11 @@ module.exports = class LevelLoadingView extends CocoView
|
|||
goalContainer.removeClass('secret')
|
||||
if goalCount is 1
|
||||
goalContainer.find('.panel-heading').text $.i18n.t 'play_level.goal' # Not plural
|
||||
tip = @$el.find('.tip')
|
||||
if @level.get('loadingTip')
|
||||
loadingTip = utils.i18n @level.attributes, 'loadingTip'
|
||||
tip.text(loadingTip)
|
||||
tip.removeClass('secret')
|
||||
|
||||
showReady: ->
|
||||
return if @shownReady
|
||||
|
@ -59,8 +64,6 @@ module.exports = class LevelLoadingView extends CocoView
|
|||
@startUnveiling()
|
||||
@unveil()
|
||||
else
|
||||
ready = $.i18n.t('play_level.loading_ready', defaultValue: 'Ready!')
|
||||
@$el.find('#tip-wrapper .tip').addClass('ready').text ready
|
||||
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'level_loaded', volume: 0.75 # old: loading_ready
|
||||
@$el.find('.progress').addClass 'active progress-striped'
|
||||
@$el.find('.start-level-button').removeClass 'secret'
|
||||
|
|
|
@ -29,6 +29,7 @@ LevelHandler = class LevelHandler extends Handler
|
|||
'employerDescription'
|
||||
'terrain'
|
||||
'i18nCoverage'
|
||||
'loadingTip'
|
||||
]
|
||||
|
||||
postEditableProperties: ['name']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue