mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Skip past hero selection if hero has already been selected.
This commit is contained in:
parent
40b61c32f2
commit
285264ceb4
5 changed files with 21 additions and 10 deletions
|
@ -139,7 +139,7 @@
|
||||||
account: "Account"
|
account: "Account"
|
||||||
settings: "Settings"
|
settings: "Settings"
|
||||||
next: "Next"
|
next: "Next"
|
||||||
previous: "Previous"
|
change_hero: "Change Hero"
|
||||||
choose_inventory: "Equip Items"
|
choose_inventory: "Equip Items"
|
||||||
older_campaigns: "Older Campaigns"
|
older_campaigns: "Older Campaigns"
|
||||||
anonymous: "Anonymous Player"
|
anonymous: "Anonymous Player"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
extends /templates/modal/modal_base
|
extends /templates/modal/modal_base
|
||||||
|
|
||||||
block modal-header-content
|
block modal-header-content
|
||||||
h1#choose-hero-header(data-i18n="choose_hero.choose_hero") Choose Your Hero
|
h1#choose-hero-header.choose-hero-active.secret(data-i18n="choose_hero.choose_hero") Choose Your Hero
|
||||||
h1#choose-inventory-header.secret(data-i18n="inventory.choose_inventory") Equip Items
|
h1#choose-inventory-header.choose-inventory-active.secret(data-i18n="inventory.choose_inventory") Equip Items
|
||||||
|
|
||||||
block modal-body-content
|
block modal-body-content
|
||||||
#choose-hero-view
|
#choose-hero-view
|
||||||
|
@ -10,7 +10,7 @@ block modal-body-content
|
||||||
#inventory-view
|
#inventory-view
|
||||||
|
|
||||||
block modal-footer-content
|
block modal-footer-content
|
||||||
button#choose-inventory-button.btn.btn-lg.btn-success(data-i18n="play.next") Next
|
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.secret.pull-left(data-i18n="play.previous") Previous
|
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.secret(data-i18n="common.play") Play
|
button#play-level-button.btn.btn-lg.btn-success.choose-inventory-active.secret(data-i18n="common.play") Play
|
||||||
|
|
|
@ -115,6 +115,9 @@ module.exports = class InventoryView extends CocoView
|
||||||
@$el.find('#selected-items').hide() # Hide until one is selected
|
@$el.find('#selected-items').hide() # Hide until one is selected
|
||||||
@delegateEvents()
|
@delegateEvents()
|
||||||
|
|
||||||
|
if @selectedHero and not @startedLoadingFirstHero
|
||||||
|
@loadHero()
|
||||||
|
|
||||||
afterInsert: ->
|
afterInsert: ->
|
||||||
super()
|
super()
|
||||||
@canvasWidth = @$el.find('canvas').innerWidth()
|
@canvasWidth = @$el.find('canvas').innerWidth()
|
||||||
|
@ -329,7 +332,8 @@ module.exports = class InventoryView extends CocoView
|
||||||
@loadHero()
|
@loadHero()
|
||||||
|
|
||||||
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()
|
@stage?.removeAllChildren()
|
||||||
if @selectedHero.loaded and movieClip = @movieClips?[@selectedHero.get('original')]
|
if @selectedHero.loaded and movieClip = @movieClips?[@selectedHero.get('original')]
|
||||||
@stage.addChild(movieClip)
|
@stage.addChild(movieClip)
|
||||||
|
|
|
@ -36,6 +36,7 @@ module.exports = class WorldMapView extends RootView
|
||||||
$(window).on 'resize', @onWindowResize
|
$(window).on 'resize', @onWindowResize
|
||||||
@playAmbientSound()
|
@playAmbientSound()
|
||||||
@preloadTopHeroes()
|
@preloadTopHeroes()
|
||||||
|
@hadEverChosenHero = me.get('heroConfig')?.thangType
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
$(window).off 'resize', @onWindowResize
|
$(window).off 'resize', @onWindowResize
|
||||||
|
@ -113,7 +114,7 @@ module.exports = class WorldMapView extends RootView
|
||||||
@startLevel $(e.target).parents('.level-info-container')
|
@startLevel $(e.target).parents('.level-info-container')
|
||||||
|
|
||||||
startLevel: (levelElement) ->
|
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
|
@openModalView playLevelModal
|
||||||
@$levelInfo?.hide()
|
@$levelInfo?.hide()
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,14 @@ module.exports = class PlayLevelModal extends ModalView
|
||||||
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'game-menu-open', volume: 1
|
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'game-menu-open', volume: 1
|
||||||
@insertSubView @chooseHeroView = new ChooseHeroView @options
|
@insertSubView @chooseHeroView = new ChooseHeroView @options
|
||||||
@insertSubView @inventoryView = new InventoryView @options
|
@insertSubView @inventoryView = new InventoryView @options
|
||||||
@inventoryView.$el.addClass 'secret'
|
if @options.hadEverChosenHero
|
||||||
@chooseHeroView.onShown()
|
@$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: ->
|
onHidden: ->
|
||||||
unless @navigatingToPlay
|
unless @navigatingToPlay
|
||||||
|
|
Loading…
Reference in a new issue