feat: 实现时间流动完整逻辑并同步 HUD 显示

- TimeSystem 支持月/年进位,仅游戏场景推进
- HUD 时间标签订阅 day_passed 实时更新
- 新游戏时重置年月日
This commit is contained in:
2026-08-03 22:20:43 +08:00
parent 2a39bc6473
commit 0320d98a73
4 changed files with 31 additions and 7 deletions
+2
View File
@@ -5,6 +5,7 @@
[sub_resource type="LabelSettings" id="LabelSettings_bn2o5"]
font = ExtResource("1_pa2rn")
font_size = 32
[node name="TopBarHud" type="Control" unique_id=1115394694]
layout_mode = 3
@@ -46,6 +47,7 @@ label_settings = SubResource("LabelSettings_bn2o5")
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 8
size_flags_stretch_ratio = 2.0
label_settings = SubResource("LabelSettings_bn2o5")
[node name="Label_Reputation" type="Label" parent="HBoxContainer" unique_id=985110673]
+5
View File
@@ -10,7 +10,12 @@ func _ready() -> void:
for i in SPEED_BUTTONS.size():
var btn: Button = $HBoxContainer/SpeedGroup.get_node(SPEED_BUTTONS[i])
btn.button_up.connect(_on_speed_button_up.bind(i))
TimeSystem.day_passed.connect(_on_day_passed)
_update_speed_ui()
$HBoxContainer/Value_Time.text = TimeSystem.get_date_text()
func _on_day_passed(_year: int, _month: int, _day: int) -> void:
$HBoxContainer/Value_Time.text = TimeSystem.get_date_text()
func _on_button_return_button_up() -> void:
sign_return_mainmenu.emit()
+1 -1
View File
@@ -1,8 +1,8 @@
extends Control
func MainMenu_NewGame_ButtonUp() -> void:
GameState.request_new_game()
get_tree().change_scene_to_file("res://src/Core/MainGame.tscn")
pass # Replace with function body.
func MainMenu_LoadGame_ButtonUp() -> void: