class_name LuneResourceDisplay extends HBoxContainer ## The viewer's own gold with the coin symbol and the base income of the next settlement. ## It is only ever fed the own seat's gold; other players' gold never reaches the HUD. var amount: Label var detail: Label var _coin: LuneGlyph var _shown: int = -1 var _flash: float = 0.0 func _init() -> void: add_theme_constant_override("separation", 8) mouse_filter = Control.MOUSE_FILTER_PASS _coin = LuneGlyph.make("coin", LuneUiTheme.GOLD, 30.0, self) var column := VBoxContainer.new() column.add_theme_constant_override("separation", -2) column.mouse_filter = Control.MOUSE_FILTER_IGNORE add_child(column) amount = LuneUiTheme.label("0", "HudGold", column) detail = LuneUiTheme.label("", "HudMuted", column) func set_values(gold: int, income: int, show_income: bool = true) -> void: if gold != _shown: if _shown >= 0 and not Preferences.reduced_motion: _flash = .45 set_process(true) _shown = gold amount.text = LuneUiTheme.number(gold) var line: String = ("+%s nächste Runde" % LuneUiTheme.number(income)) if show_income else "" if detail.text != line: detail.text = line detail.visible = show_income func _process(delta: float) -> void: _flash = maxf(0.0, _flash - delta) amount.modulate = Color(1, 1, 1).lerp(Color(1.35, 1.2, .8), _flash / .45) if _flash <= 0.0: set_process(false)