按 code-conventions §1.4.1 第三轮定稿执行:core 22+schemas 18+presentation 根 14+views 28,全部头注 #→##、删日期/变更叙事/GDD 与架构反向链接/字段与域清单/机制描述,保留职责摘要+真实使用约束(防事故禁令/单一入口/信号契约每信号一行)。main.gd 31→5 行、save_manager 45→5 行、adventure_runner 37→5 行为最大单件。子代理分模块执行(波一 core+schemas、波二 presentation+views,并发≤2)。验收=tools/verify_comment_only_change.py 逐字节校验(82 文件头注区外逐行一致=零行为变更)+audit_file_headers 全绿;纯注释批免冒烟(先例 5843270)
61 lines
1.9 KiB
GDScript
61 lines
1.9 KiB
GDScript
## VERTICAL SLICE - NOT FOR PRODUCTION
|
|
## 通用确认弹窗:open(text, confirm_label, cancel_label) 双钮外发 confirmed/cancelled。
|
|
## 文案与按钮语义装配归调用方——本类零业务触碰。
|
|
class_name ConfirmDialog
|
|
extends Control
|
|
|
|
signal confirmed
|
|
signal cancelled
|
|
|
|
var _text: Label
|
|
var _confirm_btn: Button
|
|
var _cancel_btn: Button
|
|
|
|
|
|
func _init() -> void:
|
|
var box: VBoxContainer = UiKit.modal_shell(self, Color(UiKit.DIM, 0.55), Vector2(460, 0), 12,
|
|
true, UiKit.panel_skinned(Vector4(14, 12, 14, 12))).box
|
|
_text = UiKit.label("",UiKit.FS_BODY, false, UiKit.INK_TITLE)
|
|
_text.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
_text.custom_minimum_size = Vector2(430, 0)
|
|
box.add_child(_text)
|
|
box.add_child(HSeparator.new())
|
|
var btn_row := HBoxContainer.new()
|
|
btn_row.add_theme_constant_override("separation", 12)
|
|
btn_row.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
box.add_child(btn_row)
|
|
_cancel_btn = UiKit.button("取消")
|
|
_cancel_btn.pressed.connect(_emit_cancelled)
|
|
btn_row.add_child(_cancel_btn)
|
|
_confirm_btn = UiKit.button("确认")
|
|
_confirm_btn.pressed.connect(_emit_confirmed)
|
|
btn_row.add_child(_confirm_btn)
|
|
visible = false
|
|
|
|
|
|
func open(text: String, confirm_label: String, cancel_label: String = "取消") -> void:
|
|
_text.text = text
|
|
_confirm_btn.text = confirm_label
|
|
_cancel_btn.text = cancel_label
|
|
# z 序纪律(T3 收口批 2026-10-02):树序由组合根构建序保证——本弹窗在 main._build_ui 尾部
|
|
# add_child(开始层/过场层之后 = 子级最末,登记序 = 树序 = 绘制序恒最上;原诊断转储角落钮随
|
|
# 迭代 26 T5b 退役迁调试浮窗,此处不再经其之后),
|
|
# 「每次打开 move_child 运行时自提」创可贴随之删除。
|
|
visible = true
|
|
|
|
|
|
func close() -> void:
|
|
visible = false
|
|
|
|
|
|
func is_open() -> bool:
|
|
return visible
|
|
|
|
|
|
func _emit_confirmed() -> void:
|
|
confirmed.emit()
|
|
|
|
|
|
func _emit_cancelled() -> void:
|
|
cancelled.emit()
|