iter41-卡2:呈现层结构收敛批:67清+2豁免+2展平改善——拆私有族+六状态件+ui_kit收敛+束收拢+print删;含u14补做、并master并案与收尾产出物

This commit is contained in:
DKChan committed 2026-10-29 00:14:52 +08:00
1 parent bc75dab615
commit 7beb9bfdd5
94 files changed
+3417 -5314

No files matched your search

+35 -61
View File
@@ -8,21 +8,8 @@ extends RefCounted
const Narrator := preload("res://presentation/battle_narrator.gd")
var db
var _meta_get: Callable # () → 元进度账本现值(组合根 lambda——探针 isolate_save 换注面)
var curio_overlay: CurioPickOverlay
var end_overlay: BattleEndOverlay
var board_view: BoardView
var toast: ToastStack
var _save_get: Callable # () → 存档承载现值(同上——Attunement.slots 读数面)
var _adventure_get: Callable # () → 冒险结构现值(组合根 lambda——随局更替)
var _runner_get: Callable # () → 关卡推进器现值(组合根 lambda——reward_node 继续推进)
var _adventure_mode_get: Callable # () → 冒险模式标记现值(组合根 lambda)
var _open_modal: Callable # 模态栈单口(组合根)
var _open_modal_after_playback: Callable # 演播后排窗单口(组合根)
var _close_modal: Callable
var _refresh_presentations: Callable
var _fatal_screen: Callable
var _gp_summary: Callable # () → 战斗总结 GP 行文案(组合根 lambda——_last_gain_amount 取数面在根)
# u13 引用束注入:16 个 _init 抄写成员删除——正文读点改址 ctx 束(u20 三束键名;
# _pending_curio/_curio_context 纯内部态保持宿主)
var _pending_curio := {} # 三选一停点载荷暂存(战斗总结结算确认后开三选一面;续玩停点复用)
var _curio_context := "level_clear" # 三选一面上下文(level_clear=关卡完成停点→推进下一关 / reward_node=奖励节点→回图选路)
@@ -31,21 +18,8 @@ var _curio_context := "level_clear" # 三选一面上下文(level_clear=
func _init(ctx: CurioFlowContext) -> void:
# 构造参数收拢 context 对象(16 参长签名收一处命名面)
db = ctx.db
_meta_get = ctx.meta_get
curio_overlay = ctx.curio_overlay
end_overlay = ctx.end_overlay
board_view = ctx.board_view
toast = ctx.toast
_save_get = ctx.save_get
_adventure_get = ctx.adventure_get
_runner_get = ctx.runner_get
_adventure_mode_get = ctx.adventure_mode_get
_open_modal = ctx.open_modal
_open_modal_after_playback = ctx.open_modal_after_playback
_close_modal = ctx.close_modal
_refresh_presentations = ctx.refresh_presentations
_fatal_screen = ctx.fatal_screen
_gp_summary = ctx.gp_summary
ctx.flow.fatal_screen = ctx.fatal_screen
ctx.flow.gp_summary = ctx.gp_summary
# 停点在途判据(组合根 _on_battle_end_continue 分派面——战斗总结确认后开三选一)
@@ -66,17 +40,17 @@ func resume_if_pending() -> bool:
# 差异仅零面可收——curio_overlay 未开不 close。core 停点经 skip_empty_curio 消化后推进
#(continue_to_next_level 的「停点未兑付拒推进」守卫因此放行)。
func _skip_empty_stop() -> bool:
toast.show_toast("可用战利品为空——本次三选一跳过", "info")
ctx.views.toast.show_toast("可用战利品为空——本次三选一跳过", "info")
var adventure = _adventure_get.call()
if adventure != null:
adventure.stop().skip_empty_curio() # core 停点消化(其守卫=仅空候选放行)
if _curio_context == "reward_node":
var runner = _runner_get.call()
var runner = ctx.getters.runner_get.call()
if runner != null:
runner.continue_after_node()
elif _curio_context == "level_clear" and bool(_adventure_mode_get.call()):
elif _curio_context == "level_clear" and bool(ctx.getters.adventure_mode_get.call()):
if not adventure.continue_to_next_level():
_fatal_screen.call("关卡推进失败——见输出日志")
ctx.flow.fatal_screen.call("关卡推进失败——见输出日志")
# feat_ticket = 只消化停点回店(零推进——与 on_continue 同构)
_pending_curio = {}
return true
@@ -93,22 +67,22 @@ func on_presented(payload: Dictionary) -> void:
# 空候选防御(零卡不开死面;core _redeem_feat_ticket 守卫外的末道)
_skip_empty_stop()
return
_open_modal.call(curio_overlay)
curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(payload.get("candidates", []) as Array))
ctx.flow.open_modal.call(ctx.views.curio_overlay)
ctx.views.curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(payload.get("candidates", []) as Array))
return
if int(payload.get("aux_cleared", 0)) > 0:
toast.show_toast("上关剩余 %d 件秘宝已随关卡结束清空" % int(payload.get("aux_cleared", 0)), "info") # 清空反馈
ctx.views.toast.show_toast("上关剩余 %d 件秘宝已随关卡结束清空" % int(payload.get("aux_cleared", 0)), "info") # 清空反馈
_pending_curio = payload.duplicate(true)
_curio_context = "level_clear"
if bool(payload.get("refreshed", false)):
# 刷新重发:refreshed 标直落选择面——不再重开胜利总结面
show_pick()
return
end_overlay.open_victory(Narrator.battle_end_text("victory", false), "继续",
board_view.get_global_rect(),
"%s\n%s" % [String(_gp_summary.call()), Narrator.bonus_keystone_line(payload)])
_open_modal_after_playback.call(end_overlay)
_refresh_presentations.call()
ctx.views.end_overlay.open_victory(Narrator.battle_end_text("victory", false), "继续",
ctx.views.board_view.get_global_rect(),
"%s\n%s" % [String(ctx.flow.gp_summary.call()), Narrator.bonus_keystone_line(payload)])
ctx.flow.open_modal_after_playback.call(ctx.views.end_overlay)
ctx.flow.refresh_presentations.call()
# 奖励节点三选一(与关卡完成三选一共享同池同权重同上限;CurioPickOverlay 共用面)。
@@ -121,13 +95,13 @@ func present_node_curio() -> void:
if node_cands.is_empty():
# 空池降级——不开面、不挂节点停点(present_node_curio 未调即未挂),
# 兑付确认直落回图选路(auto-sim「node_entered 回调内立即 continue_after_node」先例)
toast.show_toast("可用战利品为空——本次三选一跳过", "info")
var runner = _runner_get.call()
ctx.views.toast.show_toast("可用战利品为空——本次三选一跳过", "info")
var runner = ctx.getters.runner_get.call()
if runner != null:
runner.continue_after_node()
return
_open_modal.call(curio_overlay)
curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(node_cands))
ctx.flow.open_modal.call(ctx.views.curio_overlay)
ctx.views.curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(node_cands))
adventure.stop().present_node_curio(node_cands)
_feed_refresh_display(adventure) # 刷新面投喂单点
@@ -135,12 +109,12 @@ func present_node_curio() -> void:
# 三选一面开出(战斗总结结算确认 / 续玩停点恢复)
func show_pick() -> void:
var payload: Dictionary[Variant, Variant] = _pending_curio
_open_modal.call(curio_overlay)
curio_overlay.open_pick(Narrator.curio_pick_header(payload), _curio_card_texts(payload.get("candidates", []) as Array))
ctx.flow.open_modal.call(ctx.views.curio_overlay)
ctx.views.curio_overlay.open_pick(Narrator.curio_pick_header(payload), _curio_card_texts(payload.get("candidates", []) as Array))
var adventure = _adventure_get.call()
if adventure != null:
_feed_refresh_display(adventure) # 刷新面投喂单点
_refresh_presentations.call()
ctx.flow.refresh_presentations.call()
# 刷新呈现投喂单点(免费余量 X/Y + GP 付费价 + 冒险钱包可付——读数与商店 set_refresh_display 同构)
@@ -148,7 +122,7 @@ func _feed_refresh_display(adventure: AdventureRunner) -> void:
var runner = _runner_get.call()
var gp := int(runner.gp) if runner != null else 0
var cost: int = adventure.refresh_bank().gp_cost()
curio_overlay.set_refresh_display(adventure.refresh_bank().free_left(), cost, gp >= cost)
ctx.views.curio_overlay.set_refresh_display(adventure.refresh_bank().free_left(), cost, gp >= cost)
func _curio_card_texts(candidates: Array) -> Array:
@@ -189,15 +163,15 @@ func on_refresh() -> void:
# 免费位(X/Y)已穷——GP 付费档(先扣钱包后重抽,余额不足拒绝零副作用)
var cost: int = adventure.refresh_bank().gp_cost()
if runner == null or not runner.spend_gp(cost):
toast.show_toast("GP不足——刷新失败", "warn")
ctx.views.toast.show_toast("GP不足——刷新失败", "warn")
return
refreshed = adventure.stop().refresh_curio_paid()
_refresh_presentations.call() # 钱包变化上屏(对齐商店购买后刷新面)
ctx.flow.refresh_presentations.call() # 钱包变化上屏(对齐商店购买后刷新面)
if not refreshed:
return
if _curio_context == "reward_node":
var st: Dictionary[Variant, Variant] = adventure.stop().node_curio_pending_state()
curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(st.get("candidates", []) as Array))
ctx.views.curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(st.get("candidates", []) as Array))
_feed_refresh_display(adventure)
@@ -218,31 +192,31 @@ func on_pick_confirmed(item_id: String) -> void:
# 后续兑付/确认仍走节点路径回图选路)
if _curio_context == "reward_node" and kind == "feat_ticket":
var st2: Dictionary[Variant, Variant] = adventure.stop().node_curio_pending_state()
curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(st2.get("candidates", []) as Array))
ctx.views.curio_overlay.open_pick(Narrator.node_curio_header(), _curio_card_texts(st2.get("candidates", []) as Array))
# 兑付反馈(curio_resolved 到达——结果行上屏,唯一出口 = 继续)
func on_resolved(result: Dictionary) -> void:
_pending_curio = {}
curio_overlay.show_result(Narrator.bonus_result_text(result))
_refresh_presentations.call()
ctx.views.curio_overlay.show_result(Narrator.bonus_result_text(result))
ctx.flow.refresh_presentations.call()
# 继续钮:收三选一面 → 上下文分派(关卡完成停点=推进下一关 / 奖励节点=兑付确认回图选路——零自动推进)
func on_continue() -> void:
_close_modal.call(curio_overlay)
curio_overlay.close_pick()
ctx.flow.close_modal.call(ctx.views.curio_overlay)
ctx.views.curio_overlay.close_pick()
var adventure = _adventure_get.call()
if _curio_context == "feat_ticket":
return # T5 店内专长凭证面——专长兑付完成后关面回店(无推进/无回图)
if _curio_context == "reward_node":
var runner = _runner_get.call()
var runner = ctx.getters.runner_get.call()
if runner != null:
runner.continue_after_node()
return
if bool(_adventure_mode_get.call()) and adventure != null:
if bool(ctx.getters.adventure_mode_get.call()) and adventure != null:
if not adventure.continue_to_next_level():
_fatal_screen.call("关卡推进失败——见输出日志")
ctx.flow.fatal_screen.call("关卡推进失败——见输出日志")
# 秘宝 item_id → 显示名投影(keystone_settle_text/替换子命名文案数据源——拼句归 Narrator);