mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
HUD properties now flow into columns more evenly, have max styling.
This commit is contained in:
parent
873c560a06
commit
7b25eeec47
2 changed files with 7 additions and 5 deletions
|
@ -7,5 +7,6 @@
|
|||
if hasBar
|
||||
span.prop-value.bar-prop
|
||||
.bar
|
||||
span.prop-value.bar-prop-value
|
||||
else
|
||||
span.prop-value
|
||||
|
|
|
@ -135,17 +135,17 @@ module.exports = class HUDView extends View
|
|||
props = @$el.find('.thang-props')
|
||||
props.find(":not(.thang-name)").remove()
|
||||
props.find('.thang-name').text(if @thang.type then "#{@thang.id} - #{@thang.type}" else @thang.id)
|
||||
column = null
|
||||
for prop in @thang.hudProperties ? []
|
||||
propNames = @thang.hudProperties ? []
|
||||
nColumns = Math.ceil propNames.length / 5
|
||||
columns = ($('<div class="thang-props-column"></div>').appendTo(props) for i in [0 ... nColumns])
|
||||
for prop, i in propNames
|
||||
continue if prop is 'action'
|
||||
pel = @createPropElement prop
|
||||
continue unless pel?
|
||||
if pel.find('.bar').is('*') and props.find('.bar').is('*')
|
||||
props.find('.bar-prop').last().after pel # Keep bars together
|
||||
else
|
||||
column ?= $('<div class="thang-props-column"></div>').appendTo props
|
||||
column.append pel
|
||||
column = null if column.find('.prop').length is 5
|
||||
columns[i % nColumns].append pel
|
||||
null
|
||||
|
||||
createActions: ->
|
||||
|
@ -263,6 +263,7 @@ module.exports = class HUDView extends View
|
|||
labelText = prop + ": " + @formatValue(prop, val) + " / " + @formatValue(prop, max)
|
||||
if regen
|
||||
labelText += " (+" + @formatValue(prop, regen) + "/s)"
|
||||
pel.find('.bar-prop-value').text(Math.round(max)) if max
|
||||
else
|
||||
s = @formatValue(prop, val)
|
||||
labelText = "#{prop}: #{s}"
|
||||
|
|
Loading…
Reference in a new issue