Files
idle/big_number_progress_bar.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

44 lines
1.3 KiB
GDScript

extends HBoxContainer
@export var currency: Currency
@export var game_state: LevelGameState
@onready var _label_start = $LabelStart
@onready var _label_end = $LabelEnd
@onready var _progress_bar = $ProgressBar
var _start: BigNumber
var _end: BigNumber
var _current: BigNumber
var _currency_id: StringName = &""
func set_limits(start: BigNumber, end: BigNumber) -> void:
_start = start
_end = end
_label_start.text = _start.to_string_suffix(2)
_label_end.text = _end.to_string_suffix(2)
_progress_bar.min_value = _start.get_ratio(_end)
_progress_bar.max_value = _end.get_ratio(_start)
func _ready() -> void:
if currency == null:
push_warning("BigNumberProgressBar '%s' has no currency configured." % String(name))
return
if game_state == null:
push_warning("BigNumberProgressBar '%s' has no game_state configured." % String(name))
return
_currency_id = game_state.get_currency_id(currency)
game_state.currency_changed.connect(_on_currency_changed)
_current = game_state.get_currency_amount_by_id(_currency_id)
set_limits(_current, _current.add(BigNumber.new(1, 1)))
func _on_currency_changed(changed_currency_id: StringName, amount: BigNumber) -> void:
if changed_currency_id != _currency_id:
return
_current = amount
_progress_bar.value = amount.get_ratio(_end)