Revamped real-time playback behavior to kick in on Thornbush Farm. Added a Done button until then.

This commit is contained in:
Nick Winter 2014-11-10 15:16:28 -08:00
parent 3d8f16cd7f
commit ffea887330
7 changed files with 58 additions and 12 deletions

View file

@ -6,6 +6,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'} requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'gems-in-the-deep': 'gems-in-the-deep':
@ -15,6 +16,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'} requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'shadow-guard': 'shadow-guard':
@ -24,6 +26,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'} requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword'} restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword'}
'kounter-kithwise': 'kounter-kithwise':
@ -32,6 +35,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'} requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'}
'crawlways-of-kithgard': 'crawlways-of-kithgard':
@ -40,6 +44,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'} requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'}
'forgetful-gemsmith': 'forgetful-gemsmith':
@ -48,6 +53,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'} requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots', 'programming-book': 'programmaticon-i'} restrictedGear: {feet: 'leather-boots', 'programming-book': 'programmaticon-i'}
'true-names': 'true-names':
@ -56,6 +62,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', waist: 'leather-belt'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', waist: 'leather-belt'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'favorable-odds': 'favorable-odds':
@ -63,6 +70,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'the-raised-sword': 'the-raised-sword':
@ -70,6 +78,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'the-first-kithmaze': 'the-first-kithmaze':
@ -77,6 +86,7 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'haunted-kithmaze': 'haunted-kithmaze':
@ -84,76 +94,90 @@ module.exports = LevelOptions =
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'descending-further': 'descending-further':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'the-second-kithmaze': 'the-second-kithmaze':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'} requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'dread-door': 'dread-door':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'} requiredGear: {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'known-enemy': 'known-enemy':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', torso: 'leather-tunic'} requiredGear: {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', torso: 'leather-tunic'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'master-of-names': 'master-of-names':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'lowly-kithmen': 'lowly-kithmen':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'closing-the-distance': 'closing-the-distance':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'tactical-strike': 'tactical-strike':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'the-final-kithmaze': 'the-final-kithmaze':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
'the-gauntlet': 'the-gauntlet':
hidesHUD: true hidesHUD: true
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
restrictedGear: {feet: 'leather-boots'} restrictedGear: {feet: 'leather-boots'}
'kithgard-gates': 'kithgard-gates':
hidesSay: true hidesSay: true
hidesCodeToolbar: true hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic'} requiredGear: {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic'}
restrictedGear: {'right-hand': 'simple-sword'} restrictedGear: {'right-hand': 'simple-sword'}
'defense-of-plainswood': 'defense-of-plainswood':
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'builders-hammer'} requiredGear: {feet: 'simple-boots', 'right-hand': 'builders-hammer'}
restrictedGear: {'right-hand': 'simple-sword'} restrictedGear: {'right-hand': 'simple-sword'}
'winding-trail': 'winding-trail':
hidesRealTimePlayback: true
requiredGear: {feet: 'leather-boots', 'right-hand': 'builders-hammer'} requiredGear: {feet: 'leather-boots', 'right-hand': 'builders-hammer'}
restrictedGear: {feet: 'simple-boots', 'right-hand': 'simple-sword'} restrictedGear: {feet: 'simple-boots', 'right-hand': 'simple-sword'}
'thornbush-farm': 'thornbush-farm':

View file

@ -53,7 +53,7 @@
border-image: url(/images/level/code_toolbar_run_button_active_pressed.png) 14 20 20 20 fill round border-image: url(/images/level/code_toolbar_run_button_active_pressed.png) 14 20 20 20 fill round
padding: 2px 0 0 2px padding: 2px 0 0 2px
&.submit-button &.submit-button, &.done-button
margin-left: 10px margin-left: 10px
border-image: url(/images/level/code_toolbar_submit_button_active.png) 14 20 20 20 fill round border-image: url(/images/level/code_toolbar_submit_button_active.png) 14 20 20 20 fill round
@ -66,7 +66,7 @@
&:hover, &.castable &:hover, &.castable
@include opacity(1) @include opacity(1)
.submit-button > * .submit-button > *, .done-button > *
@include opacity(0.9) @include opacity(0.9)
&:hover &:hover
@ -90,7 +90,7 @@
&.winnable &.winnable
.btn.btn-illustrated .btn.btn-illustrated
&.submit-button &.submit-button, &.done-button
font-weight: bold font-weight: bold
@include animation(winnablePulse 3s infinite) @include animation(winnablePulse 3s infinite)
@ -114,7 +114,7 @@ html.no-borderimage #cast-button-view
padding: 9px 8px 8px 12px padding: 9px 8px 8px 12px
border: 0 border: 0
&.submit-button &.submit-button, &.done-button
background-image: url(/images/level/code_toolbar_submit_button_active_pressed.png) background-image: url(/images/level/code_toolbar_submit_button_active_pressed.png)
border: 0 border: 0
@ -133,7 +133,7 @@ html.no-borderimage #cast-button-view
&.winnable &.winnable
.btn.btn-illustrated .btn.btn-illustrated
&.submit-button &.submit-button, &.done-button
border: 0 border: 0
background-image: url(/images/level/code_toolbar_submit_button_zazz.png) background-image: url(/images/level/code_toolbar_submit_button_zazz.png)

View file

@ -18,7 +18,9 @@
position: absolute position: absolute
height: 100% height: 100%
top: -50px top: -50px
width: 85% width: 65%
width: -webkit-calc(85% - 60px)
width: calc(85% - 60px)
left: 10% left: 10%
display: inline-block display: inline-block
cursor: pointer cursor: pointer
@ -63,6 +65,7 @@
position: absolute position: absolute
z-index: 2 z-index: 2
width: 60px width: 60px
top: -50px
right: 2% right: 2%
box-sizing: border-box box-sizing: border-box
opacity: 0.25 opacity: 0.25

View file

@ -6,3 +6,6 @@ button.btn.btn-lg.btn-illustrated.submit-button(title=castRealTimeVerbose)
span= testSubmitText span= testSubmitText
else else
span(data-i18n="play_level.tome_submit_button") Submit 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

View file

@ -160,6 +160,7 @@ module.exports = class HeroVictoryModal extends ModalView
@insertSubView @ladderSubmissionView, @$el.find('.ladder-submission-view') @insertSubView @ladderSubmissionView, @$el.find('.ladder-submission-view')
beginSequentialAnimations: -> beginSequentialAnimations: ->
return if @destroyed
@sequentialAnimatedPanels = _.map(@animatedPanels.find('.reward-panel'), (panel) -> { @sequentialAnimatedPanels = _.map(@animatedPanels.find('.reward-panel'), (panel) -> {
number: $(panel).data('number') number: $(panel).data('number')
textEl: $(panel).find('.reward-text') textEl: $(panel).find('.reward-text')

View file

@ -10,6 +10,7 @@ module.exports = class CastButtonView extends CocoView
events: events:
'click .cast-button': 'onCastButtonClick' 'click .cast-button': 'onCastButtonClick'
'click .submit-button': 'onCastRealTimeButtonClick' 'click .submit-button': 'onCastRealTimeButtonClick'
'click .done-button': 'onDoneButtonClick'
subscriptions: subscriptions:
'tome:spell-changed': 'onSpellChanged' 'tome:spell-changed': 'onSpellChanged'
@ -26,7 +27,8 @@ module.exports = class CastButtonView extends CocoView
@spells = options.spells @spells = options.spells
@levelID = options.levelID @levelID = options.levelID
@castShortcut = '⇧↵' @castShortcut = '⇧↵'
@initButtonTextABTest() @levelOptions = LevelOptions[@options.levelID] ? {}
@initButtonTextABTest() unless @levelOptions.hidesRealTimePlayback
getRenderData: (context={}) -> getRenderData: (context={}) ->
context = super context context = super context
@ -47,7 +49,12 @@ 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 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) -> attachTo: (spellView) ->
@$el.detach().prependTo(spellView.toolbarView.$el).show() @$el.detach().prependTo(spellView.toolbarView.$el).show()
@ -67,6 +74,9 @@ module.exports = class CastButtonView extends CocoView
else else
Backbone.Mediator.publish 'tome:manual-cast', {realTime: true} Backbone.Mediator.publish 'tome:manual-cast', {realTime: true}
onDoneButtonClick: (e) ->
Backbone.Mediator.publish 'level:show-victory', showModal: true
onSpellChanged: (e) -> onSpellChanged: (e) ->
@updateCastButton() @updateCastButton()
@ -91,11 +101,16 @@ module.exports = class CastButtonView extends CocoView
@winnable = winnable @winnable = winnable
@$el.toggleClass 'winnable', @winnable @$el.toggleClass 'winnable', @winnable
Backbone.Mediator.publish 'tome:winnability-updated', 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.) if @levelOptions.hidesRealTimePlayback
@$el.find('.submit-button').show() # In case we hid it, like on the first level. @$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) -> 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 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 @onNewGoalStates e
updateCastButton: -> updateCastButton: ->
@ -113,7 +128,7 @@ module.exports = class CastButtonView extends CocoView
castText = $.i18n.t('play_level.tome_cast_button_running') castText = $.i18n.t('play_level.tome_cast_button_running')
else if castable or true else if castable or true
castText = $.i18n.t('play_level.tome_cast_button_run') 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 castText += ' ' + @castShortcut
else else
castText = $.i18n.t('play_level.tome_cast_button_ran') castText = $.i18n.t('play_level.tome_cast_button_ran')

View file

@ -62,7 +62,7 @@ module.exports = class TomeView extends CocoView
programmableThangs = _.filter @options.thangs, 'isProgrammable' programmableThangs = _.filter @options.thangs, 'isProgrammable'
@createSpells programmableThangs, programmableThangs[0]?.world # Do before spellList, thangList, and castButton @createSpells programmableThangs, programmableThangs[0]?.world # Do before spellList, thangList, and castButton
@spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel, level: @options.level @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) @teamSpellMap = @generateTeamSpellMap(@spells)
unless programmableThangs.length unless programmableThangs.length
@cast() @cast()