Files
idle/currency_label.gd
Michele Rossi 81a4058b04 systems rework: buffs, prestige graph, research, modular architecture
Decouples core systems from centralized globals in favor of catalogue-based architecture and data-driven content.

   Key changes:
   - Prestige: node-based buff tech tree, graph panel, progress bar
   - Research: multi-worker system, per-generator research, xp generation
   - Ascension: meta-currency layer via multi-currency prestige resets
   - Buffs: refactored as generator-independent via catalogues
   - UI: currency panel, edge-scrolling camera + zoom, current-goal panel
   - Alchemy Tower: crafting building with recipe/cost system
   - Testing: 7 test suites (ascension, prestige, research, goals)
   - Content: migrated from hardcoded idles/ to gym format (tiny_sword)
2026-05-07 20:36:21 +00:00

48 lines
1.5 KiB
GDScript

class_name CurrencyTile
extends HBoxContainer
@export var currency: Currency
@export var game_state: LevelGameState
@onready var _icon: TextureRect = $CurrencyIcon
@onready var _label: Label = $Label
@onready var _currency_label: Label = $CurrencyValueLabel
@onready var _debug_button: Button = $DebugIncomeButton
var _currency_id: StringName = &""
func _ready() -> void:
if currency == null:
push_warning("CurrencyTile '%s' has no currency configured." % String(name))
return
if game_state == null:
push_error("CurrencyTile '%s' missing game_state reference" % String(name))
return
game_state.ready.connect(_on_level_game_state_ready)
func _on_level_game_state_ready() -> void:
_currency_id = game_state.get_currency_id(currency)
var label_string = game_state.get_currency_name(_currency_id)
_label.text = "%s:" % label_string
_icon.texture = game_state.get_currency_icon(_currency_id)
_debug_button.text = "+100 %s" % label_string
game_state.currency_changed.connect(_on_currency_changed)
_on_currency_changed(_currency_id, game_state.get_currency_amount_by_id(_currency_id))
func _on_currency_changed(changed_currency_id: StringName, amount: BigNumber) -> void:
if changed_currency_id != _currency_id:
return
_currency_label.text = amount.to_string_suffix(2)
visible = currency.always_visible or not amount.is_equal_to(BigNumber.from_float(0.0))
func _on_debug_income_button_pressed() -> void:
if currency == null:
return
if game_state == null:
return
game_state.add_currency(currency, BigNumber.from_float(100))