2014-08-08 14:36:41 -04:00
|
|
|
ModalView = require 'views/kinds/ModalView'
|
|
|
|
template = require 'templates/game-menu/game-menu-modal'
|
|
|
|
submenuViews = [
|
|
|
|
require 'views/game-menu/InventoryView'
|
|
|
|
require 'views/game-menu/ChooseHeroView'
|
|
|
|
require 'views/game-menu/SaveLoadView'
|
|
|
|
require 'views/game-menu/OptionsView'
|
|
|
|
require 'views/game-menu/GuideView'
|
|
|
|
require 'views/game-menu/MultiplayerView'
|
|
|
|
]
|
|
|
|
|
|
|
|
module.exports = class GameMenuModal extends ModalView
|
|
|
|
template: template
|
2014-08-10 18:56:34 -04:00
|
|
|
modalWidthPercent: 95
|
2014-08-08 14:36:41 -04:00
|
|
|
id: 'game-menu-modal'
|
|
|
|
|
2014-08-12 12:13:23 -04:00
|
|
|
constructor: (options) ->
|
|
|
|
super options
|
|
|
|
@options.showDevBits = me.isAdmin() or /https?:\/\/localhost/.test(window.location.href)
|
|
|
|
|
2014-08-08 14:36:41 -04:00
|
|
|
events:
|
|
|
|
'change input.select': 'onSelectionChanged'
|
|
|
|
|
|
|
|
getRenderData: (context={}) ->
|
|
|
|
context = super(context)
|
2014-08-12 12:13:23 -04:00
|
|
|
context.showDevBits = @options.showDevBits
|
2014-08-08 14:36:41 -04:00
|
|
|
context
|
|
|
|
|
|
|
|
afterRender: ->
|
|
|
|
super()
|
|
|
|
@insertSubView new submenuView @options for submenuView in submenuViews
|
2014-08-12 12:13:23 -04:00
|
|
|
(if @options.showDevBits then @subviews.inventory_view else @subviews.choose_hero_view).$el.addClass 'active'
|
2014-08-10 18:56:34 -04:00
|
|
|
|
|
|
|
onHidden: ->
|
|
|
|
subview.onHidden?() for subviewKey, subview of @subviews
|
|
|
|
me.patch()
|