refactor(迭代27 T3): 波三 账本收口——RunLedger 单类持四账+刷新双账删副本+gp_final 键删影子账——逐位一致对拍全同
P1-4 共享账本 Ledger 类化(裁点②甲 单类持四账): - game/core/run_ledger.gd: attune_charges/vision_counter/adventure_counters/bonus 四账 单类承载;战斗侧只拿 read/append 原语(attune_charge_has/set/consume、vision_count_add、 counters_seed_snapshot/merge_export、bonus_add_axis)——战末 export/开局 seed 时点语义不变 - AdventureRunner 持账(run_ledger)→ LevelRunner set_run_ledger+sync_attune_inventory (原四散 setter 收口)→ enc 单键 ledger 下传;编排器三裸引用成员退役为 _ledger 原语调用 - 调试/单场缺省新账=零扰动面(vision_counter 缺省空=不计,原 enc 缺键守卫语义保留) P1-2 刷新双账收口: - main 刷新计数副本(run_scope.refresh_used_round)删除;单一事实源=编排器受理计数 - presentation_snapshot 成文面升键 refresh_used(can_refresh 邻位)——HUD 余量/遥测 round_refresh_index 单源读快照;V5 快照一致性断言×3(smoke+ui_click HUD 文本比对) P1-3 GP 影子账收口: - adventure_runner summary 增 gp_final 键(close_wallet 清账前快照) - gp_shadow_ledger.gd 全件退役删除;main 委托缝/会话账本成员删除;终局面板 GP 行 取数=summary 键;ui_probe 影子账断言换代为 summary 键断言 验收: 逐位一致对拍三变体全同;冒烟 1079/0+run_all 26 套+probe click+render golden 0.00%
This commit is contained in:
1 parent
26301baa9c
commit
6fd7d782cc
16 files changed
+174
-183
No files matched your search
@@ -1,31 +0,0 @@
|
||||
# VERTICAL SLICE - NOT FOR PRODUCTION
|
||||
# GP 冒险钱包呈现侧影子账本(迭代 6 T7 卡⑩;T3 拆件批 2026-10-02 自 main.gd 迁出——规范 1.1):
|
||||
# 冒险进行中余额影子 + 收束清零拍转存的最终合计,供冒险终局面板 GP 行取数。
|
||||
# 手工镜像边界:wallet_changed gain/buy 载荷 = 入账后总额(level_runner.gd:482/539),"clear" 到达即
|
||||
# 影子转存 final 并归零——纯呈现侧账本,零核心触碰(C1 呈现层方案);写入口唯一 = apply_event
|
||||
#(组合根 _on_wallet_changed 投喂;探针合成注入经 set_view_total——组合根委托面转发)。
|
||||
extends RefCounted
|
||||
|
||||
var _view := 0 # 冒险进行中余额影子(gain/buy 载荷直录)
|
||||
var _final := 0 # 收束清零拍转存的最终合计("clear" 到达时自影子转存)
|
||||
|
||||
|
||||
func apply_event(event: String, gp: int) -> void:
|
||||
match event:
|
||||
"gain", "buy":
|
||||
_view = gp
|
||||
"clear":
|
||||
_final = _view
|
||||
_view = 0
|
||||
|
||||
|
||||
func set_view_total(v: int) -> void:
|
||||
_view = v # 探针合成注入面(ui_probe 影子账清零转存断言)
|
||||
|
||||
|
||||
func view_total() -> int:
|
||||
return _view
|
||||
|
||||
|
||||
func final_total() -> int:
|
||||
return _final
|
||||
@@ -1 +0,0 @@
|
||||
uid://uk77ei6hjhca
|
||||
@@ -23,7 +23,7 @@ static func refresh(stage: BattleStageView, info: HeroInfoPanelView, ap_bar: ApB
|
||||
# 共账本〔level_runner bonus{atk,max_hp,armor_class}〕;空加算=整节隐藏〔视图内空态纪律〕。
|
||||
# 呈现只读投影零核心触碰;行文格式=代拍板白名单项)
|
||||
if runner != null and level_active:
|
||||
var b: Dictionary = runner.bonus
|
||||
var b: Dictionary = runner.run_ledger.bonus # 迭代 27 T3——加算区住 RunLedger(P1-4 收口)
|
||||
var lines: Array[String] = []
|
||||
if int(b.get("atk", 0)) != 0:
|
||||
lines.append("攻击 %+d" % int(b.get("atk", 0)))
|
||||
|
||||
+13
-22
@@ -49,7 +49,6 @@ const TuneSimController := preload("res://presentation/tune_sim_controller.gd")
|
||||
const DebugSessionScript := preload("res://presentation/debug_session.gd")
|
||||
const RowPacer := preload("res://presentation/row_pacer.gd") # 结算行排播泵(T3 拆件批)
|
||||
const TreasureInteractController := preload("res://presentation/treasure_interact_controller.gd") # 秘宝两步交互(T3 拆件批)
|
||||
const GpShadowLedgerScript := preload("res://presentation/gp_shadow_ledger.gd") # GP 影子账本(T3 拆件批;T3 收口波将退役)
|
||||
const CurioInteractController := preload("res://presentation/curio_interact_controller.gd") # 三选一与替换子交互(T4/D4 拆件批)
|
||||
const CampShopPresenter := preload("res://presentation/camp_shop_presenter.gd") # 营地/商店投影(T4/D4 拆件批)
|
||||
const MenuScreenScene := preload("res://presentation/scenes/menu_screen.tscn") # 三屏壳场景(迭代 27 T1)
|
||||
@@ -104,18 +103,6 @@ var _treasure_ui = null # 秘宝两步交互(treasur
|
||||
var _bonus = null # 三选一与替换子交互(curio_interact_controller.gd——本类只接线与回调注入)
|
||||
var _camp_pres = null # 营地/商店投影(camp_shop_presenter.gd——本类只接线、探针缝保缝转发)
|
||||
|
||||
# GP 影子账委托面(探针/终局面板取数保留——ui_probe 合成注入经 set 转发账本,读面即账本实况;
|
||||
# 账本实例随会话住 run_scope.gp_ledger——迭代 27 T1)
|
||||
var _adventure_gp_view: int:
|
||||
get:
|
||||
return run_scope.gp_ledger.view_total() if run_scope != null and run_scope.gp_ledger != null else 0
|
||||
set(value):
|
||||
if run_scope != null and run_scope.gp_ledger != null:
|
||||
run_scope.gp_ledger.set_view_total(value)
|
||||
var _adventure_gp_final: int:
|
||||
get:
|
||||
return run_scope.gp_ledger.final_total() if run_scope != null and run_scope.gp_ledger != null else 0
|
||||
|
||||
# 排播队列只读委托面(探针/测试读 main._row_queue——RowPacer 迁移后保留的同名可读面,共享同一 Array 引用)
|
||||
var _row_queue: Array:
|
||||
get:
|
||||
@@ -192,7 +179,6 @@ func _begin_session(adventure_session: bool) -> void:
|
||||
run_scope.queue_free()
|
||||
run_scope = RunScope.new()
|
||||
run_scope.is_adventure = adventure_session
|
||||
run_scope.gp_ledger = GpShadowLedgerScript.new()
|
||||
add_child(run_scope)
|
||||
|
||||
|
||||
@@ -637,7 +623,7 @@ func _on_adventure_finished(summary: Dictionary) -> void:
|
||||
text += "\n" + Narrator.keystone_settle_text(detail, _bonus.item_name_lookup())
|
||||
if result == "completed":
|
||||
_end_overlay.open_victory(text, "返回冒险", board_view.get_global_rect(),
|
||||
"本局 GP 入账 · 合计 %d" % _adventure_gp_final) # 卡⑩ GP 行;钥石明细已在 text(keystone_settle_text)——M9 三行账
|
||||
"本局 GP 入账 · 合计 %d" % int(summary.get("gp_final", 0))) # 卡⑩ GP 行(迭代 27 T3——取数=summary gp_final 清账前快照,影子账已退役);钥石明细已在 text(keystone_settle_text)——M9 三行账
|
||||
else:
|
||||
_end_overlay.open_defeat(text, "返回", board_view.get_global_rect())
|
||||
logger.log_level_end(summary) # 试玩时间线:冒险终局(摘要随载荷)
|
||||
@@ -817,7 +803,7 @@ func _gp_summary_text(payload: Dictionary) -> String:
|
||||
func _bonus_summary_text() -> String:
|
||||
if run_scope.runner == null:
|
||||
return ""
|
||||
var b: Dictionary = run_scope.runner.bonus
|
||||
var b: Dictionary = run_scope.runner.run_ledger.bonus # 迭代 27 T3——加算区住 RunLedger
|
||||
var parts: Array[String] = []
|
||||
if int(b.get("atk", 0)) != 0:
|
||||
parts.append("攻 %+d" % int(b.get("atk", 0)))
|
||||
@@ -887,7 +873,6 @@ func _on_round_started(ri: int) -> void:
|
||||
var vlines: Array[String] = HudPresenter.board_variant_lines(db, bvs)
|
||||
if not vlines.is_empty():
|
||||
settlement_fx.play_board_variant_banner("地形变异 · " + " · ".join(vlines))
|
||||
run_scope.refresh_used_round = 0
|
||||
_refresh_presentations()
|
||||
|
||||
|
||||
@@ -1140,7 +1125,6 @@ func _camp_data() -> Dictionary:
|
||||
func _on_wallet_changed(event: String, gp: int, extra: Dictionary) -> void:
|
||||
# wallet 行族转发(到账/购买/清零——试玩日志验收取数面)+ 常驻余额与在开商店覆盖层重刷
|
||||
logger.log_wallet(event, gp, extra)
|
||||
run_scope.gp_ledger.apply_event(event, gp) # GP 影子账(迭代 6 T7——收束清零前取值,纯呈现零核心触碰=C1;账本住 run_scope——迭代 27 T1)
|
||||
if String(event) == "gain":
|
||||
run_scope.last_gain_amount = int(extra.get("amount", 0)) # 卡⑥ GP 增量取数(每战恰一笔 gain)
|
||||
if shop_overlay.visible and run_scope.runner != null:
|
||||
@@ -1220,15 +1204,14 @@ func _on_refresh_confirmed() -> void:
|
||||
ok = run_scope.settlement.player_request_refresh()
|
||||
logger.log_action("refresh", Vector2i(-1, -1), ok)
|
||||
if ok:
|
||||
run_scope.refresh_used_round += 1
|
||||
logger.log_ux("ux_refresh_attempt", {"result": "accepted", "round_refresh_index": run_scope.refresh_used_round})
|
||||
logger.log_ux("ux_refresh_attempt", {"result": "accepted", "round_refresh_index": _refresh_used_snapshot()})
|
||||
board_zone.toast.show_toast("RAP−%d · 旧板旗作废——新图已就位,AP 保留继续挖" % int(db.action_economy.rap_refresh_cost), "gold")
|
||||
else:
|
||||
# 资源面/上限拒绝(EC13 合法拒绝可见;行动经济 无载荷——客户端按上下文推断)
|
||||
var rap: int = int(run_scope.settlement.presentation_snapshot().get("rap", 0)) if run_scope.settlement != null else 0
|
||||
var cost: int = int(db.action_economy.rap_refresh_cost)
|
||||
var result := "rejected_rap" if rap < cost else "rejected_cap"
|
||||
logger.log_ux("ux_refresh_attempt", {"result": result, "round_refresh_index": run_scope.refresh_used_round + 1})
|
||||
logger.log_ux("ux_refresh_attempt", {"result": result, "round_refresh_index": _refresh_used_snapshot() + 1})
|
||||
if result == "rejected_rap":
|
||||
board_zone.toast.show_toast("RAP 不足 · 还差 %d 点(弃图刷新需 8)" % (cost - rap), "warn")
|
||||
ap_bar.pulse_rap()
|
||||
@@ -1251,9 +1234,17 @@ func _handle_outcome_feedback(outcome: Dictionary) -> void:
|
||||
|
||||
# ==================== 全屏 States 状态机(挖掘/结算/窗口/终局)====================
|
||||
|
||||
# 本轮已受理刷新次数只读面(迭代 27 T3——P1-2 刷新双账收口:main 副本已删,
|
||||
# 单一事实源=战斗编排器 _refresh_used_this_round,经 presentation_snapshot 成文面读取)
|
||||
func _refresh_used_snapshot() -> int:
|
||||
if run_scope == null or run_scope.settlement == null:
|
||||
return 0
|
||||
return int(run_scope.settlement.presentation_snapshot().get("refresh_used", 0))
|
||||
|
||||
|
||||
func _refresh_presentations() -> void:
|
||||
# 每个核心信号/写调用返回后的全量重查装配(更新触发注记——无推送信号,命令式重查)
|
||||
var refresh_remaining: int = maxi(0, int(db.action_economy.refresh_cap_per_round) - run_scope.refresh_used_round)
|
||||
var refresh_remaining: int = maxi(0, int(db.action_economy.refresh_cap_per_round) - _refresh_used_snapshot())
|
||||
HudPresenter.refresh(stage, info_panel, ap_bar, run_scope.settlement, run_scope.runner, run_scope.level_active, db, refresh_remaining)
|
||||
_treasure_ui.refresh_slots() # C 区秘宝槽重查(反哺批⑤——试炼镐积点进度随挖格刷新悬停浮窗)
|
||||
_sync_settlement_visuals()
|
||||
|
||||
@@ -13,7 +13,6 @@ var settlement = null # 当前战斗编排器(冒险与调试两
|
||||
var is_adventure := false # 冒险会话标记(inter 层确认分派与终局分派)
|
||||
var level_active := false # 对局激活(状态面板入口点亮/刷新受理分派)
|
||||
var level_screen_active := false # 关卡独立屏激活状态(屏级互斥——形态升格批语义)
|
||||
var refresh_used_round := 0 # 本轮已受理刷新次数(遥测 round_refresh_index——每轮 round_started 归零)
|
||||
var boss_active := false # Boss 遭遇变体(阶段指示附 Boss 名)
|
||||
var was_settling := false # 结算相位上升沿检测(结算轮光带触发——演出链批)
|
||||
var hints_shown := {} # 一次性非模态提示去重(每 run 一次:chord/no_adjacent)
|
||||
@@ -21,4 +20,3 @@ var settlement_stop_timer := ArmedTimer.new() # 卡⑥ 结算框挂起计时
|
||||
var pending_candidates: Array = [] # 结算框挂起期的选路候选暂存(choices_presented 载荷)
|
||||
var locked_click := {} # 锁期点击缓存(T17 v3.1——最后一次;演播完边沿重放)
|
||||
var last_gain_amount := 0 # 最近一笔钱包入账(卡⑥ GP 增量取数面——wallet_changed gain 载荷)
|
||||
var gp_ledger = null # GP 冒险钱包影子账(gp_shadow_ledger.gd 实例——wallet 事件投喂;T3 账本收口波将退役)
|
||||
@@ -357,8 +357,8 @@ func _refresh_status() -> void:
|
||||
var max_hp: int = _runner.effective_max_hp()
|
||||
_hp_value.text = "HP %d/%d" % [int(_runner.hero_hp), int(max_hp)]
|
||||
_hp_bar.queue_redraw()
|
||||
var atk_bonus := int(_runner.bonus.get("atk", 0))
|
||||
var ac_bonus := int(_runner.bonus.get("armor_class", 0))
|
||||
var atk_bonus := int(_runner.run_ledger.bonus.get("atk", 0)) # 迭代 27 T3——加算区住 RunLedger
|
||||
var ac_bonus := int(_runner.run_ledger.bonus.get("armor_class", 0))
|
||||
var atk_txt := "%d" % _runner.effective_atk()
|
||||
if atk_bonus > 0:
|
||||
atk_txt += " +%d" % atk_bonus # 加成角标(ASCII 加号——防像素字体缺 ⁺ 字形出豆腐块)
|
||||
@@ -366,7 +366,7 @@ func _refresh_status() -> void:
|
||||
if ac_bonus > 0:
|
||||
ac_txt += " +%d" % ac_bonus
|
||||
_attr_value.text = "攻击 %s · 护甲 AC %s" % [atk_txt, ac_txt]
|
||||
var hp_bonus := int(_runner.bonus.get("max_hp", 0))
|
||||
var hp_bonus := int(_runner.run_ledger.bonus.get("max_hp", 0))
|
||||
var parts: Array[String] = []
|
||||
if atk_bonus > 0:
|
||||
parts.append("攻 +%d" % atk_bonus)
|
||||
|
||||
Reference in new issue
Block a user