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:
Nick Winter 2014-10-14 11:11:56 -07:00
parent b7fe9398d5
commit ee9e32af51
5 changed files with 16 additions and 14 deletions

View file

@ -74,7 +74,7 @@ PointSchema = c.object {title: 'Point', description: 'An {x, y} coordinate point
x: {title: 'x', description: 'The x 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
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' }},

View file

@ -124,6 +124,7 @@ module.exports = class LevelPlaybackView extends CocoView
@goto = t 'play_level.time_goto'
@current = t 'play_level.time_current'
@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: ->
@timePopup?.updateContent "<h2>#{@timeToString @newTime}</h2>#{@formatTime(@current, @currentTime)}<br/>#{@formatTime(@total, @totalTime)}"

View file

@ -268,7 +268,7 @@ module.exports = class PlayLevelView extends RootView
insertSubviews: ->
@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 LevelFlagsView world: @world if @levelID is 'sky-span' # TODO: figure out when flags are available
@insertSubView new GoldView {}

View file

@ -11,6 +11,7 @@ module.exports = class HeroVictoryModal extends ModalView
id: 'hero-victory-modal'
template: template
closeButton: false
closesOnClickOutside: false
constructor: (options) ->
super(options)
@ -24,7 +25,7 @@ module.exports = class HeroVictoryModal extends ModalView
@achievements = @supermodel.loadCollection(achievements, 'achievements').model
@listenToOnce @achievements, 'sync', @onAchievementsLoaded
@readyToContinue = false
onAchievementsLoaded: ->
thangTypeOriginals = []
achievementIDs = []
@ -34,7 +35,7 @@ module.exports = class HeroVictoryModal extends ModalView
thangTypeOriginals.push rewards.items or []
achievement.completed = LocalMongo.matchesQuery(@session.attributes, achievement.get('query'))
achievementIDs.push(achievement.id) if achievement.completed
thangTypeOriginals = _.uniq _.flatten thangTypeOriginals
for thangTypeOriginal in thangTypeOriginals
thangType = new ThangType()
@ -61,7 +62,7 @@ module.exports = class HeroVictoryModal extends ModalView
me.fetch() unless me.loading
else
@readyToContinue = true
getRenderData: ->
c = super()
c.levelName = utils.i18n @level.attributes, 'name'
@ -81,7 +82,7 @@ module.exports = class HeroVictoryModal extends ModalView
c.thangTypes = @thangTypes
return c
afterRender: ->
super()
return unless @supermodel.finished()
@ -105,8 +106,8 @@ module.exports = class HeroVictoryModal extends ModalView
)
panel.delay(500)
panel.queue(-> complete())
@animationComplete = !@animatedPanels.length
@animationComplete = not @animatedPanels.length
beginAnimateNumbers: ->
@numericalItemPanels = _.map(@animatedPanels.find('.numerical'), (panel) -> {
number: $(panel).data('number')
@ -114,7 +115,7 @@ module.exports = class HeroVictoryModal extends ModalView
rootEl: $(panel)
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
# itemPanel.rootEl.find('.reward-image-container img').addClass('pulse') for itemPanel in @numericalItemPanels
@numberAnimationStart = new Date()
@ -125,7 +126,7 @@ module.exports = class HeroVictoryModal extends ModalView
@gemEl = $('#gem-total')
@XPEl = $('#xp-total')
@numberAnimationInterval = setInterval(@tickNumberAnimation, 15 / 1000)
tickNumberAnimation: =>
pct = Math.min(1, (new Date() - @numberAnimationStart) / 1500)
panel.textEl.text('+'+parseInt(panel.number*pct)) for panel in @numericalItemPanels
@ -142,4 +143,4 @@ module.exports = class HeroVictoryModal extends ModalView
updateSavingProgressStatus: ->
return unless @animationComplete
@$el.find('#saving-progress-label').toggleClass('hide', @readyToContinue)
@$el.find('#continue-button').toggleClass('hide', !@readyToContinue)
@$el.find('#continue-button').toggleClass('hide', not @readyToContinue)

View file

@ -42,7 +42,7 @@ module.exports = class CastButtonView extends CocoView
#delay = me.get('autocastDelay') # No more autocast
delay = 90019001
@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) ->
@$el.detach().prependTo(spellView.toolbarView.$el).show()
@ -83,7 +83,7 @@ module.exports = class CastButtonView extends CocoView
onNewGoalStates: (e) ->
@winnable = e.overallStatus is 'success'
@$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.
onGoalsCalculated: (e) ->
@ -104,7 +104,7 @@ module.exports = class CastButtonView extends CocoView
else if castable
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.
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
else
s = $.i18n.t('play_level.tome_cast_button_ran')