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)
73 lines
2.1 KiB
GDScript
73 lines
2.1 KiB
GDScript
extends HBoxContainer
|
|
|
|
@export var config: PrestigeConfig
|
|
|
|
@onready var _label_start = $LabelStart
|
|
@onready var _label_end = $LabelEnd
|
|
@onready var _progress_bar = $ProgressBar
|
|
|
|
var _basis_value: BigNumber
|
|
var _next_threshold: BigNumber
|
|
var _connected: bool = false
|
|
var _game_state: LevelGameState
|
|
var _manager: PrestigeManager
|
|
|
|
func _ready() -> void:
|
|
_game_state = find_parent("LevelGameState")
|
|
_game_state.ready.connect(_on_game_state_ready)
|
|
|
|
func _on_game_state_ready() -> void:
|
|
_manager = _game_state.prestige_manager
|
|
|
|
if _manager == null:
|
|
push_warning("PrestigeProgressBar '%s' cannot find PrestigeManager; progress bar disabled." % String(name))
|
|
visible = false
|
|
return
|
|
|
|
if not _manager.has_signal("prestige_state_changed"):
|
|
push_warning("PrestigeManager does not have 'prestige_state_changed' signal; progress bar will not update.")
|
|
visible = false
|
|
return
|
|
|
|
if config == null:
|
|
config = _manager.get_config()
|
|
|
|
if config == null:
|
|
push_warning("PrestigeProgressBar '%s' has no config; progress bar disabled." % String(name))
|
|
visible = false
|
|
return
|
|
|
|
if _manager.has_signal("prestige_threshold_changed"):
|
|
_manager.prestige_threshold_changed.connect(_on_prestige_threshold_changed)
|
|
_manager.prestige_state_changed.connect(_on_prestige_state_changed)
|
|
_connected = true
|
|
_update_progress()
|
|
|
|
func _on_prestige_state_changed(_total: BigNumber, _pending: BigNumber) -> void:
|
|
_update_progress()
|
|
|
|
func _on_prestige_threshold_changed(_threshold: BigNumber) -> void:
|
|
_update_progress()
|
|
|
|
func _update_progress() -> void:
|
|
if not _connected:
|
|
return
|
|
|
|
if _manager == null or config == null:
|
|
return
|
|
|
|
_basis_value = _manager.get_basis_value_for_display()
|
|
_next_threshold = _manager.get_next_prestige_threshold()
|
|
|
|
var basis_float: float = _basis_value.to_float()
|
|
var threshold_float: float = _next_threshold.to_float()
|
|
|
|
if threshold_float > 0.0 and basis_float >= 0.0:
|
|
var ratio: float = minf(basis_float / threshold_float, 1.0)
|
|
_progress_bar.value = ratio * 100.0
|
|
else:
|
|
_progress_bar.value = 0.0
|
|
|
|
_label_start.text = _basis_value.to_string_suffix(2)
|
|
_label_end.text = _next_threshold.to_string_suffix(2)
|