iter52-卡3:迭代52卡③(presentation层封装修复): A1三类42字段公开化(280处改址)+A2拆件子件公开面(vitals14/motion14/board_hover七口)+B族组合根交接面(18服务+12句柄口,束参两处,on_*保私有)+C族杂项(UiKit三工厂/构造交付)——presentation私取sweep恒零(V1-V4,105checks),main.gd例外键32与ui_kit例外键23落基线(§3.2误测0/0反哺点),探针测试22处引用迁移,渲染golden与探针套件零转红; 验收档中
This commit is contained in:
1 parent
f2c3a3887d
commit
67024cb9ec
42 files changed
+1391
-679
No files matched your search
@@ -1,6 +1,7 @@
|
||||
## VERTICAL SLICE - NOT FOR PRODUCTION
|
||||
## 开发调试浮窗:全局可开(组合根启动即开+两屏角标再开),当局数据只读区块为本局种子唯一查看位。
|
||||
## 扩展调试项按区块往下追加(超高滚动);模拟报告文案装配归 HudPresenter——本类零动效零文案装配。
|
||||
## 内部数据类 _DebugState=宿主画面登记表(只被本文件填读,文件外零消费者——字段为公开数据成员)。
|
||||
class_name DebugOverlay
|
||||
extends Control
|
||||
|
||||
@@ -12,22 +13,22 @@ signal closed
|
||||
|
||||
## 内部状态件(u7 子域拆件——契约 9 职责语句「调试浮窗运行态」):单一变化原因=调试面板状态与
|
||||
## 当局数据投影。探针直读冻结成员(seed_edit/_sim_btn/_dbg_btn)住宿主;
|
||||
## st._run_data/st._run_labels 经 run_data_probe()/update_run_data() 方法出口(字段直访面零外部依赖)。
|
||||
## st.run_data/st.run_labels 经 run_data_probe()/update_run_data() 方法出口(字段直访面零外部依赖)。
|
||||
class _DebugState extends RefCounted:
|
||||
var _db
|
||||
var _base_atk := 0
|
||||
var _base_hp := 0
|
||||
var _atk: HSlider
|
||||
var _hp: HSlider
|
||||
var _atk_val: Label
|
||||
var _hp_val: Label
|
||||
var _eff: Label
|
||||
var _sim_count: SpinBox
|
||||
var _sim_out: RichTextLabel
|
||||
var _sim_running := false # 批量模拟进行中(is_running 判据——与对局中禁用态分离防互扰)
|
||||
var _ctx_locked := false # 对局中上下文锁定(组合根 _sync_debug_overlay 喂入——批量模拟/两层调试入口禁用)
|
||||
var _run_labels := {} # 当局数据六项标签(只读投影,组合根 update_run_data 喂入)
|
||||
var _run_data := {} # 最近一次投喂快照(探针值对面 run_data_probe)
|
||||
var db
|
||||
var base_atk := 0
|
||||
var base_hp := 0
|
||||
var atk: HSlider
|
||||
var hp: HSlider
|
||||
var atk_val: Label
|
||||
var hp_val: Label
|
||||
var eff: Label
|
||||
var sim_count: SpinBox
|
||||
var sim_out: RichTextLabel
|
||||
var sim_running := false # 批量模拟进行中(is_running 判据——与对局中禁用态分离防互扰)
|
||||
var ctx_locked := false # 对局中上下文锁定(组合根 _sync_debug_overlay 喂入——批量模拟/两层调试入口禁用)
|
||||
var run_labels := {} # 当局数据六项标签(只读投影,组合根 update_run_data 喂入)
|
||||
var run_data := {} # 最近一次投喂快照(探针值对面 run_data_probe)
|
||||
|
||||
|
||||
var st := _DebugState.new()
|
||||
@@ -37,9 +38,9 @@ var _dbg_btn: Button # 两层调试入口钮(对局中禁用承
|
||||
|
||||
|
||||
func _init(db_ref, base_atk: int, base_hp: int) -> void:
|
||||
st._db = db_ref
|
||||
st._base_atk = base_atk
|
||||
st._base_hp = base_hp
|
||||
st.db = db_ref
|
||||
st.base_atk = base_atk
|
||||
st.base_hp = base_hp
|
||||
_build()
|
||||
_sync_labels()
|
||||
visible = false # 显式初始化——不靠树序巧合(缺陷⑤家族纪律)
|
||||
@@ -48,78 +49,78 @@ func _init(db_ref, base_atk: int, base_hp: int) -> void:
|
||||
# ---- 对外语义面(组合根/探针)----
|
||||
|
||||
func atk_pct() -> int:
|
||||
return int(st._atk.value)
|
||||
return int(st.atk.value)
|
||||
|
||||
|
||||
func hp_pct() -> int:
|
||||
return int(st._hp.value)
|
||||
return int(st.hp.value)
|
||||
|
||||
|
||||
func set_sliders(atk: int, hp: int) -> void:
|
||||
st._atk.value = atk
|
||||
st._hp.value = hp
|
||||
st.atk.value = atk
|
||||
st.hp.value = hp
|
||||
|
||||
|
||||
func reset_sliders() -> void:
|
||||
st._atk.value = 0
|
||||
st._hp.value = 0
|
||||
st.atk.value = 0
|
||||
st.hp.value = 0
|
||||
_sync_labels()
|
||||
|
||||
|
||||
func effect_text() -> String:
|
||||
return st._eff.text
|
||||
return st.eff.text
|
||||
|
||||
|
||||
func set_sim_count(n: int) -> void:
|
||||
st._sim_count.value = n
|
||||
st.sim_count.value = n
|
||||
|
||||
|
||||
func is_running() -> bool:
|
||||
return st._sim_running # 批量模拟进行中(与对局中禁用态分离,置灰 ≠ 在跑)
|
||||
return st.sim_running # 批量模拟进行中(与对局中禁用态分离,置灰 ≠ 在跑)
|
||||
|
||||
|
||||
func set_sim_running(running: bool) -> void:
|
||||
st._sim_running = running
|
||||
st.sim_running = running
|
||||
_sync_sim_button()
|
||||
|
||||
|
||||
# 对局中上下文锁定(组合根 _sync_debug_overlay 喂入):批量模拟与两层调试入口
|
||||
# 在活跃对局并存态不开放(长程异步模拟/并发对局编排与活跃结算并存态破坏状态机)
|
||||
func set_context_locked(locked: bool) -> void:
|
||||
st._ctx_locked = locked
|
||||
st.ctx_locked = locked
|
||||
_sync_sim_button()
|
||||
|
||||
|
||||
# 当局数据只读投影喂入(六项——组合根 _debug_run_data 构造;纯标签重查零动效)
|
||||
func update_run_data(data: Dictionary) -> void:
|
||||
st._run_data = data.duplicate()
|
||||
for key in st._run_labels:
|
||||
(st._run_labels[key] as Label).text = str(data.get(key, "—"))
|
||||
st.run_data = data.duplicate()
|
||||
for key in st.run_labels:
|
||||
(st.run_labels[key] as Label).text = str(data.get(key, "—"))
|
||||
|
||||
|
||||
# 当局数据快照读面(探针值对面——ui_tune_probe 断言六项与只读访问器逐项一致)
|
||||
func run_data_probe() -> Dictionary:
|
||||
return st._run_data.duplicate()
|
||||
return st.run_data.duplicate()
|
||||
|
||||
|
||||
# 两钮同判据(模拟运行 / 对局上下文锁定对「模拟」「两层调试」两入口等价)——
|
||||
# 判据单点:两 setter 都经此同步,禁在调用点各写一份
|
||||
func _sync_sim_button() -> void:
|
||||
_sim_btn.disabled = st._sim_running or st._ctx_locked
|
||||
_sim_btn.text = "模拟中…" if st._sim_running else "运行模拟"
|
||||
_dbg_btn.disabled = st._sim_running or st._ctx_locked
|
||||
_sim_btn.disabled = st.sim_running or st.ctx_locked
|
||||
_sim_btn.text = "模拟中…" if st.sim_running else "运行模拟"
|
||||
_dbg_btn.disabled = st.sim_running or st.ctx_locked
|
||||
|
||||
|
||||
func set_sim_progress(text: String) -> void:
|
||||
st._sim_out.text = text
|
||||
st.sim_out.text = text
|
||||
|
||||
|
||||
func set_sim_report(text: String) -> void:
|
||||
st._sim_out.text = text
|
||||
st.sim_out.text = text
|
||||
|
||||
|
||||
func output_text() -> String:
|
||||
return st._sim_out.get_parsed_text()
|
||||
return st.sim_out.get_parsed_text()
|
||||
|
||||
|
||||
# ---- 探针接缝(真实翻译出口——按钮 pressed 信号路径,非直调组合根)----
|
||||
@@ -147,11 +148,11 @@ func _reset_btn_pressed() -> void:
|
||||
|
||||
|
||||
func effective_atk() -> int:
|
||||
return UiKit.scaled(st._base_atk, atk_pct())
|
||||
return UiKit.scaled(st.base_atk, atk_pct())
|
||||
|
||||
|
||||
func effective_max_hp() -> int:
|
||||
return UiKit.scaled(st._base_hp, hp_pct())
|
||||
return UiKit.scaled(st.base_hp, hp_pct())
|
||||
|
||||
|
||||
# ---- 内部构建(标题/关闭固定于浮窗骨架,可扩展列表区居中滚动)----
|
||||
@@ -185,7 +186,7 @@ func _build_intro(box: VBoxContainer) -> void:
|
||||
var title := UiKit.label("调试",UiKit.FS_TITLE, true, UiKit.WARM)
|
||||
box.add_child(title)
|
||||
var desc := UiKit.label(
|
||||
"开发调试专用(UI 最顶层「调试」浮层角标随时可开——任何界面不遮挡)。当局数据=本局只读投影,种子即本局种子唯一查看位。\n百分比叠加基础值:攻击 %d / 生命 %d。影响所有模式(手动与模拟),不落盘。" % [st._base_atk, st._base_hp],
|
||||
"开发调试专用(UI 最顶层「调试」浮层角标随时可开——任何界面不遮挡)。当局数据=本局只读投影,种子即本局种子唯一查看位。\n百分比叠加基础值:攻击 %d / 生命 %d。影响所有模式(手动与模拟),不落盘。" % [st.base_atk, st.base_hp],
|
||||
13, false, UiKit.WARM_SOFT)
|
||||
box.add_child(desc)
|
||||
box.add_child(HSeparator.new())
|
||||
@@ -207,7 +208,7 @@ func _build_run_data(list: VBoxContainer) -> void:
|
||||
cap.custom_minimum_size = Vector2(52, 0)
|
||||
run_grid.add_child(cap)
|
||||
var val := UiKit.label("—",UiKit.FS_HINT, false, UiKit.WARM)
|
||||
st._run_labels[item[0]] = val
|
||||
st.run_labels[item[0]] = val
|
||||
run_grid.add_child(val)
|
||||
list.add_child(HSeparator.new())
|
||||
|
||||
@@ -241,13 +242,13 @@ func _build_seed_row(list: VBoxContainer) -> void:
|
||||
## 区块②角色数值调整板(攻击/生命两滑轨+生效值行+应用/重置钮)
|
||||
func _build_slider_block(list: VBoxContainer) -> void:
|
||||
var atk_row := _slider_row(list, "攻击加成")
|
||||
st._atk = atk_row.slider
|
||||
st._atk_val = atk_row.value_label
|
||||
st.atk = atk_row.slider
|
||||
st.atk_val = atk_row.value_label
|
||||
var hp_row := _slider_row(list, "生命加成")
|
||||
st._hp = hp_row.slider
|
||||
st._hp_val = hp_row.value_label
|
||||
st._eff = UiKit.label("",UiKit.FS_HINT, false)
|
||||
list.add_child(st._eff)
|
||||
st.hp = hp_row.slider
|
||||
st.hp_val = hp_row.value_label
|
||||
st.eff = UiKit.label("",UiKit.FS_HINT, false)
|
||||
list.add_child(st.eff)
|
||||
var btn_row := HBoxContainer.new()
|
||||
list.add_child(btn_row)
|
||||
var apply_btn := UiKit.button("应用并关闭")
|
||||
@@ -264,21 +265,21 @@ func _build_sim_block(list: VBoxContainer) -> void:
|
||||
var sim_row := HBoxContainer.new()
|
||||
list.add_child(sim_row)
|
||||
sim_row.add_child(UiKit.label("批量模拟第一关",UiKit.FS_BODY, false))
|
||||
st._sim_count = SpinBox.new()
|
||||
st._sim_count.min_value = 10
|
||||
st._sim_count.max_value = 200
|
||||
st._sim_count.step = 10
|
||||
st._sim_count.value = 30
|
||||
st._sim_count.custom_minimum_size = Vector2(90, 0)
|
||||
sim_row.add_child(st._sim_count)
|
||||
st.sim_count = SpinBox.new()
|
||||
st.sim_count.min_value = 10
|
||||
st.sim_count.max_value = 200
|
||||
st.sim_count.step = 10
|
||||
st.sim_count.value = 30
|
||||
st.sim_count.custom_minimum_size = Vector2(90, 0)
|
||||
sim_row.add_child(st.sim_count)
|
||||
sim_row.add_child(UiKit.label("次(理性玩家策略,含面板当前加成)",UiKit.FS_HINT, false))
|
||||
_sim_btn = UiKit.button("运行模拟")
|
||||
_sim_btn.pressed.connect(_emit_simulate_requested)
|
||||
sim_row.add_child(_sim_btn)
|
||||
st._sim_out = RichTextLabel.new()
|
||||
st._sim_out.bbcode_enabled = true
|
||||
st._sim_out.custom_minimum_size = Vector2(0, 300)
|
||||
list.add_child(st._sim_out)
|
||||
st.sim_out = RichTextLabel.new()
|
||||
st.sim_out.bbcode_enabled = true
|
||||
st.sim_out.custom_minimum_size = Vector2(0, 300)
|
||||
list.add_child(st.sim_out)
|
||||
list.add_child(HSeparator.new())
|
||||
|
||||
|
||||
@@ -316,14 +317,14 @@ func _slider_row(box: VBoxContainer, title: String) -> Dictionary:
|
||||
|
||||
|
||||
func _sync_labels() -> void:
|
||||
st._atk_val.text = "+%d%%" % atk_pct()
|
||||
st._hp_val.text = "+%d%%" % hp_pct()
|
||||
st._eff.text = "生效值:攻击 %d → %d · 生命 %d → %d" % [
|
||||
st._base_atk, effective_atk(), st._base_hp, effective_max_hp()]
|
||||
st.atk_val.text = "+%d%%" % atk_pct()
|
||||
st.hp_val.text = "+%d%%" % hp_pct()
|
||||
st.eff.text = "生效值:攻击 %d → %d · 生命 %d → %d" % [
|
||||
st.base_atk, effective_atk(), st.base_hp, effective_max_hp()]
|
||||
|
||||
|
||||
func _emit_simulate_requested() -> void:
|
||||
simulate_requested.emit(int(st._sim_count.value))
|
||||
simulate_requested.emit(int(st.sim_count.value))
|
||||
|
||||
|
||||
func _emit_diagnose_requested() -> void:
|
||||
|
||||
Reference in new issue
Block a user