HUD properties now flow into columns more evenly, have max styling.

This commit is contained in:
Nick Winter 2014-03-03 16:45:03 -08:00
parent 873c560a06
commit 7b25eeec47
2 changed files with 7 additions and 5 deletions

View file

@ -7,5 +7,6 @@
if hasBar
span.prop-value.bar-prop
.bar
span.prop-value.bar-prop-value
else
span.prop-value

View file

@ -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}"