mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Hid play/pause button for first few levels. Hid submit button until run once or won for a few more levels.
This commit is contained in:
parent
b7fe9398d5
commit
ee9e32af51
5 changed files with 16 additions and 14 deletions
|
@ -74,7 +74,7 @@ PointSchema = c.object {title: 'Point', description: 'An {x, y} coordinate point
|
||||||
x: {title: 'x', description: 'The x coordinate.', type: 'number'}
|
x: {title: 'x', description: 'The x coordinate.', type: 'number'}
|
||||||
y: {title: 'y', description: 'The y coordinate.', type: 'number'}
|
y: {title: 'y', description: 'The y coordinate.', type: 'number'}
|
||||||
|
|
||||||
SpriteCommandSchema = c.object {title: 'Thang Command', description: 'Make a target Thang move or say something, or select/deselect it.', required: ['id'], default: {id: 'Captain Anya'}},
|
SpriteCommandSchema = c.object {title: 'Thang Command', description: 'Make a target Thang move or say something, or select/deselect it.', required: ['id'], default: {id: 'Hero Placeholder'}},
|
||||||
id: thang
|
id: thang
|
||||||
select: {title: 'Select', description: 'Select or deselect this Thang.', type: 'boolean'}
|
select: {title: 'Select', description: 'Select or deselect this Thang.', type: 'boolean'}
|
||||||
say: c.object {title: 'Say', description: 'Make this Thang say a message.', required: ['text'], default: { mood: 'explain' }},
|
say: c.object {title: 'Say', description: 'Make this Thang say a message.', required: ['text'], default: { mood: 'explain' }},
|
||||||
|
|
|
@ -124,6 +124,7 @@ module.exports = class LevelPlaybackView extends CocoView
|
||||||
@goto = t 'play_level.time_goto'
|
@goto = t 'play_level.time_goto'
|
||||||
@current = t 'play_level.time_current'
|
@current = t 'play_level.time_current'
|
||||||
@total = t 'play_level.time_total'
|
@total = t 'play_level.time_total'
|
||||||
|
@$el.find('#play-button').css('visibility', 'hidden') if @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'true-names'] # Don't show for first few levels, confuses new players.
|
||||||
|
|
||||||
updatePopupContent: ->
|
updatePopupContent: ->
|
||||||
@timePopup?.updateContent "<h2>#{@timeToString @newTime}</h2>#{@formatTime(@current, @currentTime)}<br/>#{@formatTime(@total, @totalTime)}"
|
@timePopup?.updateContent "<h2>#{@timeToString @newTime}</h2>#{@formatTime(@current, @currentTime)}<br/>#{@formatTime(@total, @totalTime)}"
|
||||||
|
|
|
@ -268,7 +268,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
|
|
||||||
insertSubviews: ->
|
insertSubviews: ->
|
||||||
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, otherSession: @otherSession, thangs: @world.thangs, supermodel: @supermodel, level: @level
|
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, otherSession: @otherSession, thangs: @world.thangs, supermodel: @supermodel, level: @level
|
||||||
@insertSubView new LevelPlaybackView session: @session
|
@insertSubView new LevelPlaybackView session: @session, levelID: @levelID
|
||||||
@insertSubView new GoalsView {}
|
@insertSubView new GoalsView {}
|
||||||
@insertSubView new LevelFlagsView world: @world if @levelID is 'sky-span' # TODO: figure out when flags are available
|
@insertSubView new LevelFlagsView world: @world if @levelID is 'sky-span' # TODO: figure out when flags are available
|
||||||
@insertSubView new GoldView {}
|
@insertSubView new GoldView {}
|
||||||
|
|
|
@ -11,6 +11,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
id: 'hero-victory-modal'
|
id: 'hero-victory-modal'
|
||||||
template: template
|
template: template
|
||||||
closeButton: false
|
closeButton: false
|
||||||
|
closesOnClickOutside: false
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super(options)
|
super(options)
|
||||||
|
@ -24,7 +25,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
@achievements = @supermodel.loadCollection(achievements, 'achievements').model
|
@achievements = @supermodel.loadCollection(achievements, 'achievements').model
|
||||||
@listenToOnce @achievements, 'sync', @onAchievementsLoaded
|
@listenToOnce @achievements, 'sync', @onAchievementsLoaded
|
||||||
@readyToContinue = false
|
@readyToContinue = false
|
||||||
|
|
||||||
onAchievementsLoaded: ->
|
onAchievementsLoaded: ->
|
||||||
thangTypeOriginals = []
|
thangTypeOriginals = []
|
||||||
achievementIDs = []
|
achievementIDs = []
|
||||||
|
@ -34,7 +35,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
thangTypeOriginals.push rewards.items or []
|
thangTypeOriginals.push rewards.items or []
|
||||||
achievement.completed = LocalMongo.matchesQuery(@session.attributes, achievement.get('query'))
|
achievement.completed = LocalMongo.matchesQuery(@session.attributes, achievement.get('query'))
|
||||||
achievementIDs.push(achievement.id) if achievement.completed
|
achievementIDs.push(achievement.id) if achievement.completed
|
||||||
|
|
||||||
thangTypeOriginals = _.uniq _.flatten thangTypeOriginals
|
thangTypeOriginals = _.uniq _.flatten thangTypeOriginals
|
||||||
for thangTypeOriginal in thangTypeOriginals
|
for thangTypeOriginal in thangTypeOriginals
|
||||||
thangType = new ThangType()
|
thangType = new ThangType()
|
||||||
|
@ -61,7 +62,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
me.fetch() unless me.loading
|
me.fetch() unless me.loading
|
||||||
else
|
else
|
||||||
@readyToContinue = true
|
@readyToContinue = true
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
c.levelName = utils.i18n @level.attributes, 'name'
|
c.levelName = utils.i18n @level.attributes, 'name'
|
||||||
|
@ -81,7 +82,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
|
|
||||||
c.thangTypes = @thangTypes
|
c.thangTypes = @thangTypes
|
||||||
return c
|
return c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
return unless @supermodel.finished()
|
return unless @supermodel.finished()
|
||||||
|
@ -105,8 +106,8 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
)
|
)
|
||||||
panel.delay(500)
|
panel.delay(500)
|
||||||
panel.queue(-> complete())
|
panel.queue(-> complete())
|
||||||
@animationComplete = !@animatedPanels.length
|
@animationComplete = not @animatedPanels.length
|
||||||
|
|
||||||
beginAnimateNumbers: ->
|
beginAnimateNumbers: ->
|
||||||
@numericalItemPanels = _.map(@animatedPanels.find('.numerical'), (panel) -> {
|
@numericalItemPanels = _.map(@animatedPanels.find('.numerical'), (panel) -> {
|
||||||
number: $(panel).data('number')
|
number: $(panel).data('number')
|
||||||
|
@ -114,7 +115,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
rootEl: $(panel)
|
rootEl: $(panel)
|
||||||
unit: $(panel).data('number-unit')
|
unit: $(panel).data('number-unit')
|
||||||
})
|
})
|
||||||
|
|
||||||
# TODO: mess with this more later. Doesn't seem to work, often times will pulse background red rather than animate
|
# TODO: mess with this more later. Doesn't seem to work, often times will pulse background red rather than animate
|
||||||
# itemPanel.rootEl.find('.reward-image-container img').addClass('pulse') for itemPanel in @numericalItemPanels
|
# itemPanel.rootEl.find('.reward-image-container img').addClass('pulse') for itemPanel in @numericalItemPanels
|
||||||
@numberAnimationStart = new Date()
|
@numberAnimationStart = new Date()
|
||||||
|
@ -125,7 +126,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
@gemEl = $('#gem-total')
|
@gemEl = $('#gem-total')
|
||||||
@XPEl = $('#xp-total')
|
@XPEl = $('#xp-total')
|
||||||
@numberAnimationInterval = setInterval(@tickNumberAnimation, 15 / 1000)
|
@numberAnimationInterval = setInterval(@tickNumberAnimation, 15 / 1000)
|
||||||
|
|
||||||
tickNumberAnimation: =>
|
tickNumberAnimation: =>
|
||||||
pct = Math.min(1, (new Date() - @numberAnimationStart) / 1500)
|
pct = Math.min(1, (new Date() - @numberAnimationStart) / 1500)
|
||||||
panel.textEl.text('+'+parseInt(panel.number*pct)) for panel in @numericalItemPanels
|
panel.textEl.text('+'+parseInt(panel.number*pct)) for panel in @numericalItemPanels
|
||||||
|
@ -142,4 +143,4 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
updateSavingProgressStatus: ->
|
updateSavingProgressStatus: ->
|
||||||
return unless @animationComplete
|
return unless @animationComplete
|
||||||
@$el.find('#saving-progress-label').toggleClass('hide', @readyToContinue)
|
@$el.find('#saving-progress-label').toggleClass('hide', @readyToContinue)
|
||||||
@$el.find('#continue-button').toggleClass('hide', !@readyToContinue)
|
@$el.find('#continue-button').toggleClass('hide', not @readyToContinue)
|
||||||
|
|
|
@ -42,7 +42,7 @@ module.exports = class CastButtonView extends CocoView
|
||||||
#delay = me.get('autocastDelay') # No more autocast
|
#delay = me.get('autocastDelay') # No more autocast
|
||||||
delay = 90019001
|
delay = 90019001
|
||||||
@setAutocastDelay delay
|
@setAutocastDelay delay
|
||||||
@$el.find('.submit-button').hide() if @options.levelID is 'dungeons-of-kithgard'
|
@$el.find('.submit-button').hide() if @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'true-names']
|
||||||
|
|
||||||
attachTo: (spellView) ->
|
attachTo: (spellView) ->
|
||||||
@$el.detach().prependTo(spellView.toolbarView.$el).show()
|
@$el.detach().prependTo(spellView.toolbarView.$el).show()
|
||||||
|
@ -83,7 +83,7 @@ module.exports = class CastButtonView extends CocoView
|
||||||
onNewGoalStates: (e) ->
|
onNewGoalStates: (e) ->
|
||||||
@winnable = e.overallStatus is 'success'
|
@winnable = e.overallStatus is 'success'
|
||||||
@$el.toggleClass 'winnable', @winnable
|
@$el.toggleClass 'winnable', @winnable
|
||||||
if @winnable
|
if @winnable or (@hasCastOnce and @options.levelID isnt 'dungeons-of-kithgard') # Show once 1) we think they will win or 2) they have hit “run” once. (Only #1 on the fist level.)
|
||||||
@$el.find('.submit-button').show() # In case we hid it, like on the first level.
|
@$el.find('.submit-button').show() # In case we hid it, like on the first level.
|
||||||
|
|
||||||
onGoalsCalculated: (e) ->
|
onGoalsCalculated: (e) ->
|
||||||
|
@ -104,7 +104,7 @@ module.exports = class CastButtonView extends CocoView
|
||||||
else if castable
|
else if castable
|
||||||
s = $.i18n.t('play_level.tome_cast_button_run')
|
s = $.i18n.t('play_level.tome_cast_button_run')
|
||||||
s = $.i18n.t('play_level.tome_cast_button_casting') if s is 'Run' and me.get('preferredLanguage').split('-')[0] isnt 'en' # Temporary, if tome_cast_button_running isn't translated.
|
s = $.i18n.t('play_level.tome_cast_button_casting') if s is 'Run' and me.get('preferredLanguage').split('-')[0] isnt 'en' # Temporary, if tome_cast_button_running isn't translated.
|
||||||
unless @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'true-names'] # Hide for first few.
|
unless @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'true-names', 'the-raised-sword', 'the-first-kithmaze'] # Hide for first few.
|
||||||
s += ' ' + @castShortcut
|
s += ' ' + @castShortcut
|
||||||
else
|
else
|
||||||
s = $.i18n.t('play_level.tome_cast_button_ran')
|
s = $.i18n.t('play_level.tome_cast_button_ran')
|
||||||
|
|
Loading…
Reference in a new issue