diff --git a/app/lib/LevelOptions.coffee b/app/lib/LevelOptions.coffee index 04c9a4267..83149bfe4 100644 --- a/app/lib/LevelOptions.coffee +++ b/app/lib/LevelOptions.coffee @@ -6,6 +6,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots'} restrictedGear: {feet: 'leather-boots'} 'gems-in-the-deep': @@ -15,6 +16,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots'} restrictedGear: {feet: 'leather-boots'} 'shadow-guard': @@ -24,6 +26,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots'} restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword'} 'kounter-kithwise': @@ -32,6 +35,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots'} restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'} 'crawlways-of-kithgard': @@ -40,6 +44,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots'} restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'} 'forgetful-gemsmith': @@ -48,6 +53,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots'} restrictedGear: {feet: 'leather-boots', 'programming-book': 'programmaticon-i'} 'true-names': @@ -56,6 +62,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', waist: 'leather-belt'} restrictedGear: {feet: 'leather-boots'} 'favorable-odds': @@ -63,6 +70,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword'} restrictedGear: {feet: 'leather-boots'} 'the-raised-sword': @@ -70,6 +78,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic'} restrictedGear: {feet: 'leather-boots'} 'the-first-kithmaze': @@ -77,6 +86,7 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots'} 'haunted-kithmaze': @@ -84,76 +94,90 @@ module.exports = LevelOptions = hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots'} 'descending-further': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots'} 'the-second-kithmaze': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots'} 'dread-door': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots'} 'known-enemy': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', torso: 'leather-tunic'} restrictedGear: {feet: 'leather-boots'} 'master-of-names': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'} restrictedGear: {feet: 'leather-boots'} 'lowly-kithmen': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'} restrictedGear: {feet: 'leather-boots'} 'closing-the-distance': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'} restrictedGear: {feet: 'leather-boots'} 'tactical-strike': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'} restrictedGear: {feet: 'leather-boots'} 'the-final-kithmaze': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} 'the-gauntlet': hidesHUD: true hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} restrictedGear: {feet: 'leather-boots'} 'kithgard-gates': hidesSay: true hidesCodeToolbar: true + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic'} restrictedGear: {'right-hand': 'simple-sword'} 'defense-of-plainswood': + hidesRealTimePlayback: true requiredGear: {feet: 'simple-boots', 'right-hand': 'builders-hammer'} restrictedGear: {'right-hand': 'simple-sword'} 'winding-trail': + hidesRealTimePlayback: true requiredGear: {feet: 'leather-boots', 'right-hand': 'builders-hammer'} restrictedGear: {feet: 'simple-boots', 'right-hand': 'simple-sword'} 'thornbush-farm': diff --git a/app/styles/play/level/tome/cast_button.sass b/app/styles/play/level/tome/cast_button.sass index b00d99ca1..4ecd74768 100644 --- a/app/styles/play/level/tome/cast_button.sass +++ b/app/styles/play/level/tome/cast_button.sass @@ -53,7 +53,7 @@ border-image: url(/images/level/code_toolbar_run_button_active_pressed.png) 14 20 20 20 fill round padding: 2px 0 0 2px - &.submit-button + &.submit-button, &.done-button margin-left: 10px border-image: url(/images/level/code_toolbar_submit_button_active.png) 14 20 20 20 fill round @@ -66,7 +66,7 @@ &:hover, &.castable @include opacity(1) - .submit-button > * + .submit-button > *, .done-button > * @include opacity(0.9) &:hover @@ -90,7 +90,7 @@ &.winnable .btn.btn-illustrated - &.submit-button + &.submit-button, &.done-button font-weight: bold @include animation(winnablePulse 3s infinite) @@ -114,7 +114,7 @@ html.no-borderimage #cast-button-view padding: 9px 8px 8px 12px border: 0 - &.submit-button + &.submit-button, &.done-button background-image: url(/images/level/code_toolbar_submit_button_active_pressed.png) border: 0 @@ -133,7 +133,7 @@ html.no-borderimage #cast-button-view &.winnable .btn.btn-illustrated - &.submit-button + &.submit-button, &.done-button border: 0 background-image: url(/images/level/code_toolbar_submit_button_zazz.png) diff --git a/app/styles/play/level/tome/spell_toolbar.sass b/app/styles/play/level/tome/spell_toolbar.sass index cb6894852..a29c2a137 100644 --- a/app/styles/play/level/tome/spell_toolbar.sass +++ b/app/styles/play/level/tome/spell_toolbar.sass @@ -18,7 +18,9 @@ position: absolute height: 100% top: -50px - width: 85% + width: 65% + width: -webkit-calc(85% - 60px) + width: calc(85% - 60px) left: 10% display: inline-block cursor: pointer @@ -63,6 +65,7 @@ position: absolute z-index: 2 width: 60px + top: -50px right: 2% box-sizing: border-box opacity: 0.25 diff --git a/app/templates/play/level/tome/cast_button.jade b/app/templates/play/level/tome/cast_button.jade index a3a153656..b63e0db13 100644 --- a/app/templates/play/level/tome/cast_button.jade +++ b/app/templates/play/level/tome/cast_button.jade @@ -6,3 +6,6 @@ button.btn.btn-lg.btn-illustrated.submit-button(title=castRealTimeVerbose) span= testSubmitText else span(data-i18n="play_level.tome_submit_button") Submit + +button.btn.btn-lg.btn-illustrated.done-button.secret + span(data-i18n="play_level.done") Done diff --git a/app/views/play/level/modal/HeroVictoryModal.coffee b/app/views/play/level/modal/HeroVictoryModal.coffee index 4d0d417c5..5103a1f04 100644 --- a/app/views/play/level/modal/HeroVictoryModal.coffee +++ b/app/views/play/level/modal/HeroVictoryModal.coffee @@ -160,6 +160,7 @@ module.exports = class HeroVictoryModal extends ModalView @insertSubView @ladderSubmissionView, @$el.find('.ladder-submission-view') beginSequentialAnimations: -> + return if @destroyed @sequentialAnimatedPanels = _.map(@animatedPanels.find('.reward-panel'), (panel) -> { number: $(panel).data('number') textEl: $(panel).find('.reward-text') diff --git a/app/views/play/level/tome/CastButtonView.coffee b/app/views/play/level/tome/CastButtonView.coffee index 0a689b7e4..48f339201 100644 --- a/app/views/play/level/tome/CastButtonView.coffee +++ b/app/views/play/level/tome/CastButtonView.coffee @@ -10,6 +10,7 @@ module.exports = class CastButtonView extends CocoView events: 'click .cast-button': 'onCastButtonClick' 'click .submit-button': 'onCastRealTimeButtonClick' + 'click .done-button': 'onDoneButtonClick' subscriptions: 'tome:spell-changed': 'onSpellChanged' @@ -26,7 +27,8 @@ module.exports = class CastButtonView extends CocoView @spells = options.spells @levelID = options.levelID @castShortcut = '⇧↵' - @initButtonTextABTest() + @levelOptions = LevelOptions[@options.levelID] ? {} + @initButtonTextABTest() unless @levelOptions.hidesRealTimePlayback getRenderData: (context={}) -> context = super context @@ -47,7 +49,12 @@ module.exports = class CastButtonView extends CocoView #delay = me.get('autocastDelay') # No more autocast delay = 90019001 @setAutocastDelay delay - @$el.find('.submit-button').hide() if LevelOptions[@options.levelID]?.hidesSubmitUntilRun # Hide Submit for the first few until they run it once. + if @levelOptions.hidesSubmitUntilRun or @levelOptions.hidesRealTimePlayback + @$el.find('.submit-button').hide() # Hide Submit for the first few until they run it once. + if @options.session.get('state')?.complete and @levelOptions.hidesRealTimePlayback + @$el.find('.done-button').show() + if @options.levelID is 'thornbush-farm'# and not @options.session.get('state')?.complete + @$el.find('.submit-button').hide() # Hide submit until first win so that script can explain it. attachTo: (spellView) -> @$el.detach().prependTo(spellView.toolbarView.$el).show() @@ -67,6 +74,9 @@ module.exports = class CastButtonView extends CocoView else Backbone.Mediator.publish 'tome:manual-cast', {realTime: true} + onDoneButtonClick: (e) -> + Backbone.Mediator.publish 'level:show-victory', showModal: true + onSpellChanged: (e) -> @updateCastButton() @@ -91,11 +101,16 @@ module.exports = class CastButtonView extends CocoView @winnable = winnable @$el.toggleClass 'winnable', @winnable Backbone.Mediator.publish 'tome:winnability-updated', winnable: @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. + if @levelOptions.hidesRealTimePlayback + @$el.find('.done-button').toggle @winnable + else if @winnable and @options.levelID is 'thornbush-farm' + @$el.find('.submit-button').show() # Hide submit until first win so that script can explain it. onGoalsCalculated: (e) -> + # When preloading, with real-time playback enabled, we highlight the submit button when we think they'll win. return unless e.preload + return if @levelOptions.hidesRealTimePlayback + return if @options.levelID is 'thornbush-farm' # Don't show it until they actually win for this first one. @onNewGoalStates e updateCastButton: -> @@ -113,7 +128,7 @@ module.exports = class CastButtonView extends CocoView castText = $.i18n.t('play_level.tome_cast_button_running') else if castable or true castText = $.i18n.t('play_level.tome_cast_button_run') - unless LevelOptions[@options.levelID]?.hidesRunShortcut # Hide for first few. + unless @levelOptions.hidesRunShortcut # Hide for first few. castText += ' ' + @castShortcut else castText = $.i18n.t('play_level.tome_cast_button_ran') diff --git a/app/views/play/level/tome/TomeView.coffee b/app/views/play/level/tome/TomeView.coffee index e7c8bb278..fff2529b4 100644 --- a/app/views/play/level/tome/TomeView.coffee +++ b/app/views/play/level/tome/TomeView.coffee @@ -62,7 +62,7 @@ module.exports = class TomeView extends CocoView programmableThangs = _.filter @options.thangs, 'isProgrammable' @createSpells programmableThangs, programmableThangs[0]?.world # Do before spellList, thangList, and castButton @spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel, level: @options.level - @castButton = @insertSubView new CastButtonView spells: @spells, levelID: @options.levelID + @castButton = @insertSubView new CastButtonView spells: @spells, levelID: @options.levelID, session: @options.session @teamSpellMap = @generateTeamSpellMap(@spells) unless programmableThangs.length @cast()