From ee9e32af511a8e4944a70328f239d8110b03e42b Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 14 Oct 2014 11:11:56 -0700 Subject: [PATCH] Hid play/pause button for first few levels. Hid submit button until run once or won for a few more levels. --- app/schemas/models/level.coffee | 2 +- app/views/play/level/LevelPlaybackView.coffee | 1 + app/views/play/level/PlayLevelView.coffee | 2 +- .../play/level/modal/HeroVictoryModal.coffee | 19 ++++++++++--------- .../play/level/tome/CastButtonView.coffee | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/schemas/models/level.coffee b/app/schemas/models/level.coffee index 9e1577b22..ecff5395a 100644 --- a/app/schemas/models/level.coffee +++ b/app/schemas/models/level.coffee @@ -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' }}, diff --git a/app/views/play/level/LevelPlaybackView.coffee b/app/views/play/level/LevelPlaybackView.coffee index 4e1b5b55f..b01b7081c 100644 --- a/app/views/play/level/LevelPlaybackView.coffee +++ b/app/views/play/level/LevelPlaybackView.coffee @@ -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 "

#{@timeToString @newTime}

#{@formatTime(@current, @currentTime)}
#{@formatTime(@total, @totalTime)}" diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index d5c47d9bb..14e10428f 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -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 {} diff --git a/app/views/play/level/modal/HeroVictoryModal.coffee b/app/views/play/level/modal/HeroVictoryModal.coffee index 08f8164f6..5f4fe7d83 100644 --- a/app/views/play/level/modal/HeroVictoryModal.coffee +++ b/app/views/play/level/modal/HeroVictoryModal.coffee @@ -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) \ No newline at end of file + @$el.find('#continue-button').toggleClass('hide', not @readyToContinue) diff --git a/app/views/play/level/tome/CastButtonView.coffee b/app/views/play/level/tome/CastButtonView.coffee index 650fb801f..7aa1df84d 100644 --- a/app/views/play/level/tome/CastButtonView.coffee +++ b/app/views/play/level/tome/CastButtonView.coffee @@ -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')