docs: 按 Godot 规范优化全部 GDScript 注释
- 类/信号/方法添加 ## 文档注释与 @param 标签 - 清理 pass 占位残留
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
## 顶部信息栏 HUD(挂载于 TopBarHUD.tscn)。
|
||||
## 显示灵石/时间/声望,提供时间流速控制与返回主菜单入口。
|
||||
extends Control
|
||||
|
||||
## 请求返回主菜单。
|
||||
signal sign_return_mainmenu
|
||||
|
||||
## 三个流速按钮的节点名(与 tscn 中的 SpeedGroup 子节点对应)。
|
||||
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:
|
||||
@@ -14,20 +20,26 @@ func _ready() -> void:
|
||||
_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()
|
||||
|
||||
## 点击暂停/继续按钮,切换后刷新按钮状态。
|
||||
func _on_button_pause_button_up() -> void:
|
||||
TimeSystem.toggle_pause()
|
||||
_update_speed_ui()
|
||||
|
||||
## 点击流速档位按钮。
|
||||
## @param index: 目标档位索引(由 _ready 中 bind 传入)
|
||||
func _on_speed_button_up(index: int) -> void:
|
||||
TimeSystem.set_speed_index(index)
|
||||
_update_speed_ui()
|
||||
|
||||
## 刷新速度组 UI:暂停按钮文字与各档位高亮状态。
|
||||
func _update_speed_ui() -> void:
|
||||
var pause_btn: Button = $HBoxContainer/SpeedGroup/Button_Pause
|
||||
pause_btn.text = "继续" if TimeSystem.paused else "暂停"
|
||||
|
||||
Reference in New Issue
Block a user