mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Equip hint and available header now are visible only when there are items to equip.
This commit is contained in:
parent
6310dcbcac
commit
a04bc63b87
2 changed files with 7 additions and 3 deletions
|
@ -25,12 +25,12 @@
|
|||
if itemGroups.availableItems.models.length
|
||||
h4#available-description(data-i18n="inventory.available_item")
|
||||
for item in itemGroups.availableItems.models
|
||||
.item(class=item.classes, data-item-id=item.id)
|
||||
.item.available(class=item.classes, data-item-id=item.id)
|
||||
img(src=item.getPortraitURL())
|
||||
button.btn.equip-item(data-i18n="inventory.equip")
|
||||
.clearfix
|
||||
|
||||
#double-click-hint.alert.alert-info.secret(data-i18n="inventory.should_equip")
|
||||
#double-click-hint.alert.alert-info(data-i18n="inventory.should_equip")
|
||||
|
||||
if itemGroups.restrictedItems.models.length
|
||||
h4#restricted-description(data-i18n="inventory.restricted_title")
|
||||
|
|
|
@ -127,6 +127,7 @@ module.exports = class InventoryModal extends ModalView
|
|||
@insertSubView(@itemDetailsView)
|
||||
@requireLevelEquipment()
|
||||
@$el.find('.nano').nanoScroller({alwaysVisible: true})
|
||||
@onSelectionChanged()
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
|
@ -330,6 +331,10 @@ module.exports = class InventoryModal extends ModalView
|
|||
@$el.find('#unequipped .item.active')
|
||||
|
||||
onSelectionChanged: ->
|
||||
heroClass = @selectedHero?.get('heroClass')
|
||||
itemsCanBeEquipped = @$el.find('#unequipped .item.available:not(.equipped)').filter('.'+heroClass).length
|
||||
toShow = @$el.find('#double-click-hint, #available-description')
|
||||
if itemsCanBeEquipped then toShow.removeClass('secret') else toShow.addClass('secret')
|
||||
@delegateEvents()
|
||||
|
||||
|
||||
|
@ -393,7 +398,6 @@ module.exports = class InventoryModal extends ModalView
|
|||
@highlightElement availableSlotSelector, delay: 500, sides: ['right'], rotation: Math.PI / 2
|
||||
@$el.find(availableSlotSelector).addClass 'should-equip'
|
||||
@$el.find("#equipped div[data-slot='#{slot}']").addClass 'should-equip'
|
||||
@$el.find('#double-click-hint').removeClass('secret')
|
||||
@remainingRequiredEquipment.push slot: slot, item: gear[item]
|
||||
if hadRequired and not @remainingRequiredEquipment.length
|
||||
@endHighlight()
|
||||
|
|
Loading…
Reference in a new issue