iter49-卡2:模态句柄分域批(句柄册三域化):UiModals 14→3纯字段容器+run/menu两新子容器+ModalFlow升格注册面直驻+全仓寻址换代+V1结构断言
This commit is contained in:
1 parent
11beb4fc59
commit
240f1a1769
28 files changed
+552
-513
No files matched your search
@@ -30,7 +30,7 @@ static func _on_adventure_level_started(root: Variant, level_index: int, display
|
||||
# 开场行只显示 atk/max_hp 两值,注记指向不存在的显示轴反成失真),白板局不带
|
||||
var ov: Dictionary[Variant, Variant] = root.meta.hero_override()
|
||||
var boosted: bool = int(ov.get("atk", 0)) > 0 or int(ov.get("max_hp", 0)) > 0 \
|
||||
or root.ui.modals.debug_overlay.atk_pct() > 0 or root.ui.modals.debug_overlay.hp_pct() > 0 \
|
||||
or root.ui.modals.menu.debug_overlay.atk_pct() > 0 or root.ui.modals.menu.debug_overlay.hp_pct() > 0 \
|
||||
or root.run_scope.runner.journal().bonus_total("atk") > 0 \
|
||||
or root.run_scope.runner.journal().bonus_total("max_hp") > 0
|
||||
root.ui.battle.log_view.append_bb(root.Narrator.level_open_line(display_name, int(root.run_scope.adventure.master_seed),
|
||||
@@ -70,21 +70,21 @@ static func _on_runner_node(root: Variant, node: Dictionary, info: Dictionary) -
|
||||
root.ui.battle.log_view.append_bb(root.Narrator.reward_line())
|
||||
elif t == "rest":
|
||||
var healed: int = int(info.get("healed", 0))
|
||||
root.ui.modals.flow.open(root.ui.modals.node_overlay)
|
||||
root.ui.modals.node_overlay.show_rest(healed, int(info.get("hp", 0)), int(info.get("max_hp", 0)))
|
||||
root.ui.flow.open(root.ui.modals.run.node_overlay)
|
||||
root.ui.modals.run.node_overlay.show_rest(healed, int(info.get("hp", 0)), int(info.get("max_hp", 0)))
|
||||
root.ui.battle.log_view.append_bb(root.Narrator.rest_line(healed, int(info.get("hp", 0)), int(info.get("max_hp", 0))))
|
||||
elif t == "shop":
|
||||
# 商店房兑付:到达即开店——商品/货架快照与余额经 runner 只读投影喂入;
|
||||
# 购买/离开归玩家意图(buy_requested/leave_pressed 接线),零自动推进。
|
||||
# pool 面 = 共享池货架三选一同构卡;legacy 面 = 固定三件(off 对照承载)
|
||||
root.ui.modals.flow.open(root.ui.modals.shop_overlay)
|
||||
root.ui.flow.open(root.ui.modals.menu.shop_overlay)
|
||||
if root.run_scope.runner.shop.is_shop_pool():
|
||||
root.ui.modals.shop_overlay.open_shelf(root.run_scope.runner.shop.shop_shelf(), int(root.run_scope.runner.gp))
|
||||
root.ui.modals.shop_overlay.set_visit_info(int(root.run_scope.runner.shop.shop_bp_visit_buys()), float(root.db.run.shop.price_a)) # 爬价规则行
|
||||
root.ui.modals.shop_overlay.set_refresh_display(root.run_scope.runner.shop.shop_refresh_free_left(), root.run_scope.runner.shop.shop_refresh_cost(), int(root.run_scope.runner.gp) >= root.run_scope.runner.shop.shop_refresh_cost()) # MC-1
|
||||
root.ui.modals.menu.shop_overlay.open_shelf(root.run_scope.runner.shop.shop_shelf(), int(root.run_scope.runner.gp))
|
||||
root.ui.modals.menu.shop_overlay.set_visit_info(int(root.run_scope.runner.shop.shop_bp_visit_buys()), float(root.db.run.shop.price_a)) # 爬价规则行
|
||||
root.ui.modals.menu.shop_overlay.set_refresh_display(root.run_scope.runner.shop.shop_refresh_free_left(), root.run_scope.runner.shop.shop_refresh_cost(), int(root.run_scope.runner.gp) >= root.run_scope.runner.shop.shop_refresh_cost()) # MC-1
|
||||
else:
|
||||
root.ui.modals.shop_overlay.open_shop(root.run_scope.runner.shop.shop_products(), int(root.run_scope.runner.gp))
|
||||
root.ui.modals.shop_overlay.set_visit_info(-1, 1.0) # legacy 面无爬价行(off 对照承载)
|
||||
root.ui.modals.menu.shop_overlay.open_shop(root.run_scope.runner.shop.shop_products(), int(root.run_scope.runner.gp))
|
||||
root.ui.modals.menu.shop_overlay.set_visit_info(-1, 1.0) # legacy 面无爬价行(off 对照承载)
|
||||
root.ui.battle.log_view.append_bb(root.Narrator.shop_line(int(root.run_scope.runner.gp)))
|
||||
root.logger.log_node(node, info, root.run_scope.runner.node_index)
|
||||
root._refresh_presentations()
|
||||
@@ -110,20 +110,20 @@ static func _on_adventure_finished(root: Variant, summary: Dictionary) -> void:
|
||||
if not detail.is_empty():
|
||||
text += "\n" + root.Narrator.keystone_settle_text(detail, root._bonus.item_name_lookup())
|
||||
if result == "completed":
|
||||
root.ui.modals.end_overlay.open_victory(text, "返回冒险", root.ui.battle.board_zone.board_view.get_global_rect(),
|
||||
root.ui.modals.run.end_overlay.open_victory(text, "返回冒险", root.ui.battle.board_zone.board_view.get_global_rect(),
|
||||
{"gp_summary": "本局 GP 入账 · 合计 %d" % int(summary.get("gp_final", 0))}) # GP 行(取数=summary gp_final 清账前快照);钥石明细已在 text(keystone_settle_text)——三行账
|
||||
else:
|
||||
root.ui.modals.end_overlay.open_defeat(text, "返回", root.ui.battle.board_zone.board_view.get_global_rect())
|
||||
root.ui.modals.run.end_overlay.open_defeat(text, "返回", root.ui.battle.board_zone.board_view.get_global_rect())
|
||||
root.logger.log_level_end(summary) # 试玩时间线:冒险终局(摘要随载荷)
|
||||
if root.run_scope.runner != null:
|
||||
root.run_scope.runner.restore_hero_base()
|
||||
root.ui.modals.flow.open_after_playback(root.ui.modals.end_overlay)
|
||||
root.ui.flow.open_after_playback(root.ui.modals.run.end_overlay)
|
||||
root._refresh_presentations()
|
||||
|
||||
static func _on_battle_end_continue(root: Variant) -> void:
|
||||
# 终局出口:返回开始界面(冒险摘要留档试玩日志;钥石在收束时入存档)
|
||||
root.ui.modals.flow.close(root.ui.modals.end_overlay)
|
||||
root.ui.modals.end_overlay.close()
|
||||
root.ui.flow.close(root.ui.modals.run.end_overlay)
|
||||
root.ui.modals.run.end_overlay.close()
|
||||
# 三选一停点挂起分支:战斗总结结算(Boss 胜利钥石增量行)确认后进三选一面
|
||||
if root._bonus.resume_if_pending(): # 三选一停点在途恢复入口(curio_interact_controller)
|
||||
return
|
||||
@@ -131,9 +131,9 @@ static func _on_battle_end_continue(root: Variant) -> void:
|
||||
if root.run_scope.settlement_stop_timer.is_armed():
|
||||
root.run_scope.settlement_stop_timer.disarm()
|
||||
_enter_level_screen(root)
|
||||
root.ui.modals.level_screen.set_feat_holdings(" · ".join(HudPresenter.feat_holdings_lines(root.db, root.run_scope.runner.feats_held())))
|
||||
root.ui.modals.level_screen.open_choices(root.run_scope.pending_candidates, root.run_scope.runner)
|
||||
root.ui.modals.level_screen.apply_status(level_map_status_payload(root.run_scope.runner))
|
||||
root.ui.modals.run.level_screen.set_feat_holdings(" · ".join(HudPresenter.feat_holdings_lines(root.db, root.run_scope.runner.feats_held())))
|
||||
root.ui.modals.run.level_screen.open_choices(root.run_scope.pending_candidates, root.run_scope.runner)
|
||||
root.ui.modals.run.level_screen.apply_status(level_map_status_payload(root.run_scope.runner))
|
||||
root.run_scope.pending_candidates = []
|
||||
root._refresh_presentations()
|
||||
return
|
||||
@@ -141,7 +141,7 @@ static func _on_battle_end_continue(root: Variant) -> void:
|
||||
# 局态封印/账本/模态挂起全复位(局态字段清单见 run_scope.gd)
|
||||
root._debug.reset()
|
||||
root._begin_session(false)
|
||||
root.ui.modals.debug_overlay.reset_sliders()
|
||||
root.ui.modals.menu.debug_overlay.reset_sliders()
|
||||
root.ui.screens.start_overlay.visible = true
|
||||
root._refresh_presentations()
|
||||
|
||||
@@ -158,7 +158,7 @@ static func _on_inter_next_pressed(root: Variant) -> void:
|
||||
|
||||
|
||||
static func _on_node_continue(root: Variant) -> void:
|
||||
root.ui.modals.flow.close(root.ui.modals.node_overlay)
|
||||
root.ui.flow.close(root.ui.modals.run.node_overlay)
|
||||
if root.run_scope.runner != null:
|
||||
# 确认 ≠ 推进——兑付确认后经 choices_presented 弹出选路口
|
||||
root.run_scope.runner.continue_after_node()
|
||||
@@ -176,24 +176,24 @@ static func _on_choices_presented(root: Variant, candidates: Array) -> void:
|
||||
and String(root.run_scope.runner.current_node().get("type", "")) == "battle" and not candidates.is_empty():
|
||||
root.run_scope.settlement_stop_timer.arm()
|
||||
root.run_scope.pending_candidates = candidates.duplicate()
|
||||
root.ui.modals.end_overlay.open_victory(root.Narrator.battle_end_text("victory", false), "下一节点",
|
||||
root.ui.modals.run.end_overlay.open_victory(root.Narrator.battle_end_text("victory", false), "下一节点",
|
||||
root.ui.battle.board_zone.board_view.get_global_rect(),
|
||||
{"gp_summary": "战利品 GP +%d · 合计 %d" % [root.run_scope.last_gain_amount, int(root.run_scope.runner.gp)]})
|
||||
root.ui.modals.flow.open_after_playback(root.ui.modals.end_overlay)
|
||||
root.ui.flow.open_after_playback(root.ui.modals.run.end_overlay)
|
||||
root._refresh_presentations()
|
||||
return
|
||||
_enter_level_screen(root)
|
||||
root.ui.modals.level_screen.set_feat_holdings(" · ".join(HudPresenter.feat_holdings_lines(root.db, root.run_scope.runner.feats_held())))
|
||||
root.ui.modals.level_screen.open_choices(candidates, root.run_scope.runner)
|
||||
root.ui.modals.level_screen.apply_status(level_map_status_payload(root.run_scope.runner))
|
||||
root.ui.modals.run.level_screen.set_feat_holdings(" · ".join(HudPresenter.feat_holdings_lines(root.db, root.run_scope.runner.feats_held())))
|
||||
root.ui.modals.run.level_screen.open_choices(candidates, root.run_scope.runner)
|
||||
root.ui.modals.run.level_screen.apply_status(level_map_status_payload(root.run_scope.runner))
|
||||
root._refresh_presentations()
|
||||
|
||||
static func _on_route_chosen(root: Variant, node_id: int) -> void:
|
||||
# 视图已按节点类型定去留——战斗/Boss 出屏(visible=false,此处收栈
|
||||
# 记录一致性+回战斗屏);奖励/恢复/商店本屏保持激活(兑付覆盖层由节点事件域内弹出,模态栈
|
||||
# 打开低层时自动隐藏本屏、关闭自动恢复)
|
||||
if not root.ui.modals.level_screen.visible:
|
||||
root.ui.modals.flow.close(root.ui.modals.level_screen)
|
||||
if not root.ui.modals.run.level_screen.visible:
|
||||
root.ui.flow.close(root.ui.modals.run.level_screen)
|
||||
_exit_level_screen(root)
|
||||
if root.run_scope.runner != null and not root.run_scope.runner.pick_next_node(node_id):
|
||||
push_error("[组合根] 选路被拒(编号 %d 不在候选)" % node_id)
|
||||
@@ -203,14 +203,14 @@ static func _on_route_chosen(root: Variant, node_id: int) -> void:
|
||||
static func _enter_level_screen(root: Variant) -> void:
|
||||
root.run_scope.level_screen_active = true
|
||||
root.ui.screens.battle_root.visible = false
|
||||
root.ui.modals.flow.open(root.ui.modals.level_screen)
|
||||
root.ui.flow.open(root.ui.modals.run.level_screen)
|
||||
root._sync_status_entry() # 屏级互斥切换同步(_open_modal 单口不识屏级状态)
|
||||
|
||||
static func _exit_level_screen(root: Variant) -> void:
|
||||
root.run_scope.level_screen_active = false
|
||||
root.ui.screens.battle_root.visible = true
|
||||
if root.ui.modals.level_screen.visible:
|
||||
root.ui.modals.flow.close(root.ui.modals.level_screen)
|
||||
if root.ui.modals.run.level_screen.visible:
|
||||
root.ui.flow.close(root.ui.modals.run.level_screen)
|
||||
root._sync_status_entry() # 同上
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user