feat: HUD 增加时间流速控制,新增 Settings 持久化

- 顶栏改为暂停/1x/5x/20x 按钮组,当前档位高亮
- TimeSystem 支持暂停与档位切换
- 新增 Settings 单例,存档默认流速并开机应用
- GameState 补充年月日,支持 12x30 历法推进
This commit is contained in:
2026-08-03 22:01:35 +08:00
parent 404480ef00
commit 2a39bc6473
8 changed files with 103 additions and 1 deletions
+25 -1
View File
@@ -2,7 +2,31 @@ extends Control
signal sign_return_mainmenu
const SPEED_BUTTONS := ["Button_Speed1", "Button_Speed5", "Button_Speed20"]
const ACTIVE_COLOR := Color(1.0, 1.0, 1.0)
const INACTIVE_COLOR := Color(0.55, 0.55, 0.55)
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))
_update_speed_ui()
func _on_button_return_button_up() -> void:
sign_return_mainmenu.emit()
pass # Replace with function body.
func _on_button_pause_button_up() -> void:
TimeSystem.toggle_pause()
_update_speed_ui()
func _on_speed_button_up(index: int) -> void:
TimeSystem.set_speed_index(index)
_update_speed_ui()
func _update_speed_ui() -> void:
var pause_btn: Button = $HBoxContainer/SpeedGroup/Button_Pause
pause_btn.text = "继续" if TimeSystem.paused else "暂停"
for i in SPEED_BUTTONS.size():
var btn: Button = $HBoxContainer/SpeedGroup.get_node(SPEED_BUTTONS[i])
var active := (i == TimeSystem.speed_index) and not TimeSystem.paused
btn.modulate = ACTIVE_COLOR if active else INACTIVE_COLOR