feat(t4): 魔法道具 HUD 面——C 区四槽接线+两步使用交互+叠加层呈现+清空反馈

①hero_info_panel:四槽 gui_input 可点+aux_slot_clicked 信号+set_aux_inventory 投影渲染(空槽虚位/used 暗态/不可用置灰/选中金框/tooltip 全名+语义)
②main:选中态 _aux_use_selection+槽点击(AP 类 target=none 即用/空间类 toggle 选中)+_on_board_action dig 劫持(选中期点格=目标拾取不落挖格;move/flag 不冲突)+_attempt_aux_use(拒绝零消耗 toast 可辨认)+_aux_inventory_projection(字形=名首字;usable 回调接排雷玩法只读面)+use 成功后槽位/叠加层双刷+_on_board_action 行尾槽位重查(授予同步走完)
③叠加层呈现:CellUnit.aux_mark(真视=危险红内缩框)+board_view.set_aux_overlays 投影注入(refresh 消费;预读格=badge_glyph 注入 REWARD_BADGE 字形走 identity_resolver 既有只读面零数据复制;旗格让位不注)
④清空反馈:LevelRunner aux_cleared 快照(payload 已有 T3)→AdventureRunner additive 扩签(big_reward_paid.aux_cleared/summary.aux_cleared_last,_last_aux_cleared 捕获)→main 大奖励屏 toast「上关剩余 N 件魔法道具已随关卡结束清空」
闸:冒烟 577/0+三探针 PASS;T() 拼接病累计八处全自愈(board_view 混行尾归一 LF/adventure_runner _first_script 重复声明去重/两 var 拼接)
This commit is contained in:
DKChan committed 2026-09-29 07:21:58 +08:00
1 parent 63a08d1e01
commit 2f3a87e98f
5 files changed
+184 -3

No files matched your search

+96
View File
@@ -67,6 +67,7 @@ var shop_overlay: ShopOverlay # 商店覆盖层(GP+商店房实施
var _adventure_gp_view := 0 # GP 冒险钱包呈现侧影子(迭代 6 T7——终局面板 GP 行取数面,
# wallet_changed gain/buy 载荷=入账后总额 level_runner.gd:482/539)
var _adventure_gp_final := 0 # 收束清零拍暂存的最终合计("clear" 到达时自影子转存)
var _aux_use_selection := 0 # 魔法道具选中句柄(迭代 7 T4——0=未选中;选中期棋盘点击=使用目标拾取)
var camp_overlay: CampOverlay # 营地覆盖层(元进度实现批——主菜单营地入口兑付呈现)
var tune_panel: TunePanel
@@ -115,6 +116,7 @@ func _build_ui() -> void:
settlement_fx = battle_ui.settlement_fx
log_view.review_requested.connect(_open_review_from_band)
board_zone.action_requested.connect(_on_board_action)
info_panel.aux_slot_clicked.connect(_on_aux_slot_clicked) # 迭代 7 T4——两步交互第一步
board_zone.stop_pressed.connect(_on_stop_pressed)
board_zone.refresh_confirmed.connect(_on_refresh_confirmed)
board_zone.legend_toggled.connect(_on_legend_toggled)
@@ -304,6 +306,8 @@ func _on_runner_node(node: Dictionary, info: Dictionary) -> void:
# 大奖励兑付(非末关通关恰一次):复用 _inter_overlay(label + 确认按钮,零新增交互范式);
# 文案装配归 Narrator
func _on_big_reward(reward: Dictionary) -> void:
if int(reward.get("aux_cleared", 0)) > 0:
board_zone.toast.show_toast("上关剩余 %d 件魔法道具已随关卡结束清空" % int(reward.get("aux_cleared", 0)), "info") # 迭代 7 T4 清空反馈
_inter_label.text = Narrator.big_reward_text(reward)
_inter_overlay.visible = true
_refresh_presentations()
@@ -722,6 +726,91 @@ func _on_shop_leave() -> void:
runner.continue_after_node()
# ---- 魔法道具 HUD 接线(迭代 7 T4——库存条+两步交互+叠加层呈现;数据源=runner 级库存只读面)----
# 槽点击(第一步):AP 类(target=none)点击即用(无目标);空间类进/出选中态(toggle 取消)。
func _on_aux_slot_clicked(slot_handle: int) -> void:
if settlement == null or runner == null or runner.aux_inventory == null:
return
if slot_handle == 0:
_aux_use_selection = 0
_refresh_aux_slots()
return
var rec: Dictionary = {}
for r in _aux_inventory_projection():
if int(r.get("handle", 0)) == slot_handle:
rec = r
break
if rec.is_empty() or bool(rec.get("used", false)):
return
var arow: Dictionary = db.aux_item_row(String(rec.get("item_id", "")))
if String(arow.get("target", "none")) == "none":
_attempt_aux_use(slot_handle, Vector2i(-9, -9)) # AP 类:无目标即用
return
if not bool(rec.get("usable", true)):
board_zone.toast.show_toast("当前无可预读的未开格", "warn")
return
_aux_use_selection = 0 if _aux_use_selection == slot_handle else slot_handle # toggle 取消
_refresh_aux_slots()
if _aux_use_selection != 0:
board_zone.toast.show_toast("%s:点击目标格使用(9 宫窗口),再点道具取消" % String(rec.get("name", "")), "info")
# 使用受理(第二步;core 侧 use_aux 四步编排——拒绝零消耗 toast 可辨认)
func _attempt_aux_use(handle: int, cell: Vector2i) -> void:
if settlement == null:
return
var v: Dictionary = settlement.use_aux(handle, cell)
if not bool(v.ok):
board_zone.toast.show_toast(String(v.get("reason", "无法使用")), "warn")
return
_aux_use_selection = 0
_refresh_aux_slots()
_refresh_aux_overlays()
var arow: Dictionary = db.aux_item_row(String(v.get("item_id", "")))
board_zone.toast.show_toast("已使用 %s" % String(arow.get("display_name", "")), "info")
# 库存投影(C 区四槽取数面——字形=名首字;usable=板级零信息预判回调接排雷玩法只读面)
func _aux_inventory_projection() -> Array:
if runner == null or runner.aux_inventory == null:
return []
var ms = settlement.minesweeper if settlement != null else null
var cb := Callable()
if ms != null:
cb = func(_c: Vector2i) -> bool:
for y in ms.current_board().height:
for x in ms.current_board().width:
if not ms.is_revealed(Vector2i(x, y)):
return true
return false
var out: Array = []
for rec in runner.aux_inventory.query_inventory(cb):
var arow: Dictionary = db.aux_item_row(String(rec.get("item_id", "")))
var dn := String(arow.get("display_name", ""))
out.append({
"handle": int(rec.get("handle", 0)),
"item_id": String(rec.get("item_id", "")),
"glyph": dn.left(1) if dn != "" else "?",
"name": dn,
"used": bool(rec.get("used", false)),
"usable": bool(rec.get("usable", true)),
})
return out
func _refresh_aux_slots() -> void:
info_panel.set_aux_inventory(_aux_inventory_projection(), _aux_use_selection)
# 叠加层投影注入(use 成功/三清后——棋盘标记与预读徽章重算)
func _refresh_aux_overlays() -> void:
if runner == null or runner.aux_inventory == null or board_view == null:
return
var ov: Dictionary = runner.aux_inventory.query_overlays()
board_view.set_aux_overlays(ov.get("mine_reveal", []), ov.get("reward_preview", []))
func _on_wallet_changed(event: String, gp: int, extra: Dictionary) -> void:
# wallet 行族转发(到账/购买/清零——试玩日志验收取数面)+ 常驻余额与在开商店覆盖层重刷
logger.log_wallet(event, gp, extra)
@@ -742,9 +831,16 @@ func _on_board_action(cell: Vector2i, kind: String) -> void:
# 玩家动作 → 核心写调用的唯一通道(模态/无战斗拒绝在此收口)
if _input_locked():
return
# 魔法道具选中态劫持(迭代 7 T4——两步交互第二步):点格=使用目标拾取,不落挖格;
# 只劫持挖掘点击(move/flag 语义不冲突——选中期玩家仍可移动/插旗)
if _aux_use_selection != 0 and kind == "dig":
_attempt_aux_use(_aux_use_selection, cell)
return
var outcomes: Array = settlement.minesweeper.settle_batch([{"action": kind, "cell": cell}])
var accepted: bool = not outcomes.is_empty() and bool(outcomes[0].accepted)
logger.log_action(kind, cell, accepted)
if runner != null and runner.aux_inventory != null:
_refresh_aux_slots() # 迭代 7 T4——授予发生在 settle_batch 结算段内(同步走完,行尾重查)
_handle_outcome_feedback(outcomes[0] if not outcomes.is_empty() else {})
# settle_batch 内部同步走完 结算→战斗结束→关卡推进(事件同步发射)——关卡终局时 settlement 已被
# runner 置空,清图演出判定须先判 settlement(基线既有重入隐患,2026-09-13 加固)