Who knows what

This commit is contained in:
Dan 2026-01-28 13:22:04 +00:00
parent 0fe23420ab
commit 9214d13054
422 changed files with 1412 additions and 4783 deletions

View file

@ -10,7 +10,7 @@ func _ready():
pressed.connect(_on_button_pressed)
func setup(unlock_data):
Log.pr("Setting up button for unlock:", unlock_data.unlock_name)
# Log.pr("Setting up button for unlock:", unlock_data.unlock_name)
unlock_id = unlock_data.unlock_id # Store the ID
if label:
label.visible = false
@ -23,7 +23,7 @@ func setup(unlock_data):
Log.pr("Warning: Label node not found in button.")
func _on_button_pressed():
Log.pr("Button pressed, unlocking item:", unlock_id)
# Log.pr("Button pressed, unlocking item:", unlock_id)
Unlocks.unlock_item(unlock_id)
func adjust_label_font_size():

View file

@ -5,6 +5,13 @@ extends Control
@onready var stock_label: Label = %StockLabel
@onready var modifiers_label: Label = %ModifiersLabel
@onready var timer_label : Label = %Timer
@onready var game_complete_screen : Panel = %GameCompleted
@onready var continue_button : TextureButton = %ContinueButton
var game_timer : Timer
var elapsed_time := 0.0
func _ready():
populate_modifiers_display()
@ -12,6 +19,14 @@ func _ready():
update_currency_label()
update_wood_label()
update_stock_label()
game_timer = Timer.new()
game_timer.wait_time = 1.0
game_timer.one_shot = false
game_timer.autostart = true
add_child(game_timer)
game_timer.timeout.connect(_on_timer_tick)
currency_label.add_theme_color_override("font_color", Global.money_color)
wood_label.add_theme_color_override("font_color", Global.wood_color)
@ -24,6 +39,10 @@ func _ready():
Inventory.stock_added.connect(spawn_stock_increase)
Inventory.stock_changed.connect(_on_currency_changed)
Unlocks.item_unlocked.connect(populate_unlock_buttons)
GameManager.currency_goal_met.connect(_on_currency_goal_met)
# get_tree().paused = true
func update_currency_label():
currency_label.text = Global.currency_symbol + " " + str(int(Inventory.get_currency()))
@ -99,3 +118,30 @@ func _on_currency_changed(_value):
update_currency_label()
update_wood_label()
update_stock_label()
if Inventory.get_currency() >= Global.target_currency:
game_timer.stop()
func _on_timer_tick():
elapsed_time += 1
timer_label.text = format_time(elapsed_time)
func _on_currency_goal_met():
Log.pr("Currency goal met!")
get_tree().paused = true
game_complete_screen.visible = true
func format_time(seconds: float) -> String:
var total_seconds := int(seconds)
var hours := total_seconds / 3600
var minutes := (total_seconds % 3600) / 60
var secs := total_seconds % 60
return "%02d:%02d:%02d" % [hours, minutes, secs]
func _on_continue_button_pressed() -> void:
Global.game_continue_pressed = true
game_complete_screen.visible = false
get_tree().paused = false