Fixed a bug with hero placeholder loading. Improved game menu modal close button usability.

This commit is contained in:
Nick Winter 2014-09-21 13:26:56 -07:00
parent 389f6fb9c1
commit 2872de71ce
7 changed files with 34 additions and 8 deletions

View file

@ -69,13 +69,13 @@ module.exports = class Level extends CocoModel
heroThangType = session?.get('heroConfig')?.thangType
levelThang.thangType = heroThangType if heroThangType
thangType = supermodel.getModelByOriginal(ThangType, levelThang.thangType)
thangType = supermodel.getModelByOriginal(ThangType, levelThang.thangType, (m) -> m.get('components')?)
configs = {}
for thangComponent in levelThang.components
configs[thangComponent.original] = thangComponent
for defaultThangComponent in thangType.get('components') or []
for defaultThangComponent in thangType?.get('components') or []
if levelThangComponent = configs[defaultThangComponent.original]
# Take the ThangType default Components and merge level-specific Component config into it
copy = $.extend true, {}, defaultThangComponent.config

View file

@ -84,9 +84,9 @@ module.exports = class SuperModel extends Backbone.Model
modelURL = modelURL() if _.isFunction(modelURL)
return @models[modelURL] or null
getModelByOriginal: (ModelClass, original) ->
getModelByOriginal: (ModelClass, original, filter=null) ->
_.find @models, (m) ->
m.get('original') is original and m.constructor.className is ModelClass.className
m.get('original') is original and m.constructor.className is ModelClass.className and (not filter or filter(m))
getModelByOriginalAndMajorVersion: (ModelClass, original, majorVersion=0) ->
_.find @models, (m) ->

View file

@ -132,6 +132,9 @@ a
.close
font-size: 28px
padding: 15px
margin-right: -15px
margin-top: -15px
@include opacity(0.60)
&:hover
@include opacity(1)

View file

@ -1,10 +1,31 @@
@import "app/styles/mixins"
#game-menu-modal
.close
// We have to style this indendently because it's not in the header (we don't have a header).
position: absolute
top: 10px
right: 20px
top: -5px
right: 0
padding: 15px
font-size: 28px
background-color: transparent
z-index: 1
@include opacity(0.60)
&:hover
@include opacity(1)
// Make room for an overlaid close button in the lower right (we don't have a footer).
.overlaid-close-button
position: absolute
right: 35px
bottom: 20px
#inventory-view #available-equipment
bottom: 60px
.modal-dialog
margin-top: 0
@ -58,3 +79,4 @@
&, &:hover, &:focus
border-color: #ddd transparent #ddd #ddd
*border-right-color: #fff

View file

@ -147,7 +147,6 @@ $stashWidth: $totalWidth - $equippedWidth - $stashMargin
right: 0
top: 0
bottom: 0
//bottom: $selectedAreaHeight + 10
overflow: scroll
border: 2px solid #ccc
padding: 4px

View file

@ -23,4 +23,5 @@ block modal-body-content
.tab-pane(id=submenu + '-view')
.clearfix
block modal-footer
block modal-footer
button.btn.btn-primary.btn-lg.overlaid-close-button(type="button", data-dismiss="modal", aria-hidden="true", data-i18n="modal.close") Close

View file

@ -23,6 +23,7 @@ module.exports = class GameMenuModal extends ModalView
super options
@options.showDevBits = me.isAdmin() or /https?:\/\/localhost/.test(window.location.href)
@options.showInventory = @options.level.get('type', true) is 'hero'
@options.levelID = @options.level.get('slug')
getRenderData: (context={}) ->
context = super(context)