fix: 管理面板关闭时恢复打开前暂停状态(不冲掉手动暂停)

This commit is contained in:
2026-08-09 17:22:26 +08:00
parent 00c4495bca
commit bfd79c6934
2 changed files with 12 additions and 4 deletions
@@ -6,6 +6,9 @@ extends Control
@onready var title_label: Label = %TitleLabel
@onready var list_container: VBoxContainer = %ListContainer
## 打开面板前的暂停状态(关闭时恢复,避免冲掉玩家手动暂停)。
var _was_paused := false
func _ready() -> void:
BuildingManager.buildings_changed.connect(_on_buildings_changed)
@@ -13,14 +16,15 @@ func _ready() -> void:
## 打开面板并刷新列表(暂停时间推进)。
func show_panel() -> void:
_was_paused = TimeSystem.paused
_refresh()
TimeSystem.set_paused(true)
visible = true
## 关闭面板(恢复时间推进)。
## 关闭面板(恢复打开前的暂停状态)。
func hide_panel() -> void:
visible = false
TimeSystem.set_paused(false)
TimeSystem.set_paused(_was_paused)
## 点击遮罩关闭面板。
func _on_backdrop_gui_input(event: InputEvent) -> void:
@@ -14,6 +14,9 @@ const APTITUDE_COLORS := {
@onready var empty_label: Label = %EmptyLabel
@onready var detail_panel: Control = %DiscipleDetailPanel
## 打开面板前的暂停状态(关闭时恢复,避免冲掉玩家手动暂停)。
var _was_paused := false
func _ready() -> void:
# 名录变化时刷新(面板打开期间也同步)
@@ -22,14 +25,15 @@ func _ready() -> void:
## 打开面板并刷新列表(暂停时间推进)。
func show_panel() -> void:
_was_paused = TimeSystem.paused
_refresh_list()
TimeSystem.set_paused(true)
visible = true
## 关闭面板(恢复时间推进;子层详情弹窗随父隐藏)。
## 关闭面板(恢复打开前的暂停状态;子层详情弹窗随父隐藏)。
func hide_panel() -> void:
visible = false
TimeSystem.set_paused(false)
TimeSystem.set_paused(_was_paused)
## 点击遮罩关闭面板。
func _on_backdrop_gui_input(event: InputEvent) -> void: