Skip past hero selection if hero has already been selected.

This commit is contained in:
Nick Winter 2014-10-02 11:18:43 -07:00
parent 40b61c32f2
commit 285264ceb4
5 changed files with 21 additions and 10 deletions

View file

@ -139,7 +139,7 @@
account: "Account"
settings: "Settings"
next: "Next"
previous: "Previous"
change_hero: "Change Hero"
choose_inventory: "Equip Items"
older_campaigns: "Older Campaigns"
anonymous: "Anonymous Player"

View file

@ -1,8 +1,8 @@
extends /templates/modal/modal_base
block modal-header-content
h1#choose-hero-header(data-i18n="choose_hero.choose_hero") Choose Your Hero
h1#choose-inventory-header.secret(data-i18n="inventory.choose_inventory") Equip Items
h1#choose-hero-header.choose-hero-active.secret(data-i18n="choose_hero.choose_hero") Choose Your Hero
h1#choose-inventory-header.choose-inventory-active.secret(data-i18n="inventory.choose_inventory") Equip Items
block modal-body-content
#choose-hero-view
@ -10,7 +10,7 @@ block modal-body-content
#inventory-view
block modal-footer-content
button#choose-inventory-button.btn.btn-lg.btn-success(data-i18n="play.next") Next
button#choose-hero-button.btn.btn-lg.btn-primary.secret.pull-left(data-i18n="play.previous") Previous
button#play-level-button.btn.btn-lg.btn-success.secret(data-i18n="common.play") Play
button#choose-inventory-button.btn.btn-lg.btn-success.choose-hero-active.secret(data-i18n="play.next") Next
button#choose-hero-button.btn.btn-lg.btn-primary.choose-inventory-active.secret.pull-left(data-i18n="play.change_hero") Change Hero
button#play-level-button.btn.btn-lg.btn-success.choose-inventory-active.secret(data-i18n="common.play") Play

View file

@ -115,6 +115,9 @@ module.exports = class InventoryView extends CocoView
@$el.find('#selected-items').hide() # Hide until one is selected
@delegateEvents()
if @selectedHero and not @startedLoadingFirstHero
@loadHero()
afterInsert: ->
super()
@canvasWidth = @$el.find('canvas').innerWidth()
@ -329,7 +332,8 @@ module.exports = class InventoryView extends CocoView
@loadHero()
loadHero: ->
return unless @selectedHero and not @$el.hasClass 'secret'
return unless @supermodel.finished() and @selectedHero and not @$el.hasClass 'secret'
@startedLoadingFirstHero = true
@stage?.removeAllChildren()
if @selectedHero.loaded and movieClip = @movieClips?[@selectedHero.get('original')]
@stage.addChild(movieClip)

View file

@ -36,6 +36,7 @@ module.exports = class WorldMapView extends RootView
$(window).on 'resize', @onWindowResize
@playAmbientSound()
@preloadTopHeroes()
@hadEverChosenHero = me.get('heroConfig')?.thangType
destroy: ->
$(window).off 'resize', @onWindowResize
@ -113,7 +114,7 @@ module.exports = class WorldMapView extends RootView
@startLevel $(e.target).parents('.level-info-container')
startLevel: (levelElement) ->
playLevelModal = new PlayLevelModal supermodel: @supermodel, levelID: levelElement.data('level-id'), levelPath: levelElement.data('level-path'), levelName: levelElement.data('level-name')
playLevelModal = new PlayLevelModal supermodel: @supermodel, levelID: levelElement.data('level-id'), levelPath: levelElement.data('level-path'), levelName: levelElement.data('level-name'), hadEverChosenHero: @hadEverChosenHero
@openModalView playLevelModal
@$levelInfo?.hide()

View file

@ -45,8 +45,14 @@ module.exports = class PlayLevelModal extends ModalView
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'game-menu-open', volume: 1
@insertSubView @chooseHeroView = new ChooseHeroView @options
@insertSubView @inventoryView = new InventoryView @options
@inventoryView.$el.addClass 'secret'
@chooseHeroView.onShown()
if @options.hadEverChosenHero
@$el.find('.choose-hero-active').add(@chooseHeroView.$el).addClass 'secret'
@$el.find('.choose-inventory-active').removeClass 'secret'
@inventoryView.onShown()
else
@$el.find('.choose-inventory-active').add(@inventoryView.$el).addClass 'secret'
@$el.find('.choose-hero-active').removeClass 'secret'
@chooseHeroView.onShown()
onHidden: ->
unless @navigatingToPlay