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)
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
class_name CurrencyTile
|
||||
extends HBoxContainer
|
||||
|
||||
@export var currency: Resource
|
||||
@export var currency: Currency
|
||||
@export var game_state: LevelGameState
|
||||
|
||||
@onready var _icon: TextureRect = $CurrencyIcon
|
||||
@onready var _label: Label = $Label
|
||||
@@ -11,26 +12,36 @@ extends HBoxContainer
|
||||
var _currency_id: StringName = &""
|
||||
|
||||
func _ready() -> void:
|
||||
if currency == null:
|
||||
currency = CurrencyDatabase.get_currency_resource(GameState.GOLD_CURRENCY_ID)
|
||||
if currency == null:
|
||||
push_warning("CurrencyTile '%s' has no currency configured." % String(name))
|
||||
return
|
||||
|
||||
_currency_id = GameState.get_currency_id(currency)
|
||||
_label.text = "%s:" % GameState.get_currency_name(_currency_id)
|
||||
_icon.texture = GameState.get_currency_icon(_currency_id)
|
||||
_debug_button.text = "+100 %s" % GameState.get_currency_name(_currency_id)
|
||||
if game_state == null:
|
||||
push_error("CurrencyTile '%s' missing game_state reference" % String(name))
|
||||
return
|
||||
|
||||
GameState.currency_changed.connect(_on_currency_changed)
|
||||
_on_currency_changed(_currency_id, GameState.get_currency_amount_by_id(_currency_id))
|
||||
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
|
||||
GameState.add_currency(currency, BigNumber.from_float(100))
|
||||
if game_state == null:
|
||||
return
|
||||
game_state.add_currency(currency, BigNumber.from_float(100))
|
||||
|
||||
Reference in New Issue
Block a user