feat: HUD 灵气浓度显示 + 字体大小配置化([ui] 节)

This commit is contained in:
2026-08-08 17:30:18 +08:00
parent 5ad0272d79
commit 19f8294242
4 changed files with 38 additions and 0 deletions
+14
View File
@@ -10,6 +10,7 @@ signal sign_open_disciples
@onready var time_label: Label = %Value_Time
@onready var currency_label: Label = %Value_Currency
@onready var reputation_label: Label = %Value_Reputation
@onready var qi_label: Label = %Value_Qi
@onready var pause_button: Button = %Button_Pause
@onready var speed_buttons: Array[Button] = [%Button_Speed1, %Button_Speed5, %Button_Speed20]
@@ -25,7 +26,10 @@ func _ready() -> void:
SectManager.reputation_changed.connect(_on_reputation_changed)
currency_label.text = str(SectManager.spirit_stones)
reputation_label.text = str(SectManager.reputation)
# 灵气浓度:当前为配置固定值(D6 建筑系统接入后动态刷新)
qi_label.text = "%d%%" % roundi(GameConfig.qi_concentration * 100)
time_label.text = TimeSystem.get_date_text()
_apply_hud_font()
_update_speed_ui()
## 每日推进时刷新日期显示。
@@ -61,6 +65,16 @@ func _on_speed_button_up(index: int) -> void:
TimeSystem.set_speed_index(index)
_update_speed_ui()
## 应用配置中的 HUD 字体大小(GameConfig.hud_font_size)。
## 标签共用同一 LabelSettings 资源,改一处全生效;按钮逐个覆盖。
func _apply_hud_font() -> void:
var size := GameConfig.hud_font_size
var settings: LabelSettings = $HBoxContainer/Label_Currency.label_settings
if settings != null:
settings.font_size = size
for btn in $HBoxContainer.find_children("*", "Button", true, false):
btn.add_theme_font_size_override("font_size", size)
## 刷新速度组 UI:暂停按钮文字与各档位按下状态。
## 选中档位用 toggle 的 pressed 状态表达(原生高亮),暂停时禁用档位按钮。
func _update_speed_ui() -> void: