MC-1 商店独立刷新机制(UI落码第三波收官核心批)——level_runner新增shop_refresh/free_left/cost三面(GP扣费+货架整架重抽shop_draw同签+付费计数进离清零)+adventure_table三旋钮(免费0/基价20/曲线1.8 provisional)+shop_overlay刷新钮转正(set_refresh_display投喂面)+presenter on_shop_refresh+main接线+冒烟5断言(752/0)+关卡节点地图v1.6换代+冒险结构v0.15回写。机制=P-C2+Q2裁(基础免费0/天赋增益位预留/GP ceil(20×1.8^n)/池源同源)。闸=冒烟752/0+probe_gate全绿+layout 0

This commit is contained in:
DKChan committed 2026-10-05 03:51:10 +08:00
1 parent e94ba6f977
commit ac3cee7daa
8 files changed
+83 -5

No files matched your search

+23 -3
View File
@@ -18,7 +18,8 @@ const ATTR_LABELS := {"atk": "攻击", "max_hp": "生命上限", "armor_class":
const KIND_LABELS := {"attack": "攻击", "max_hp": "生命上限", "armor": "护甲", "ap": "行动点"} # 货架件值文案轴(共享池 kind 词表——迭代 11 第②批)
var _gp_label: Label
var _refresh_btn: Button # M6 刷新呈现位(禁用占位——机制由 MC-1 核心批接线)
var _refresh_btn: Button # M6 呈现位——MC-1 起由 set_refresh_display 投喂启用
signal refresh_requested # MC-1:刷新意图(pool 面;组合根接 presenter.on_shop_refresh)
var _cards_box: VBoxContainer
var _card_rows: Array[Dictionary] = [] # [{product_id, price, bought, btn}]——refresh_state 就地重刷(零重建回流)
var _shelf_rows: Array[Dictionary] = [] # [{kind_id, btn}]——pool 面卡片(买后整架重建=重抽反馈)
@@ -40,8 +41,8 @@ func _init() -> void:
_refresh_btn = UiKit.button("")
_refresh_btn.icon = UiKit.load_tex(UiKit.TEX_ICON_REFRESH)
_refresh_btn.custom_minimum_size = Vector2(44, 44)
_refresh_btn.tooltip_text = "刷新货架(机制接入中——商店刷新核心批 MC-1)"
_refresh_btn.disabled = true
_refresh_btn.disabled = true # MC-1 投喂后启用(set_refresh_display)
_refresh_btn.pressed.connect(_emit_refresh_requested)
top.add_child(_refresh_btn)
var stock_badge := UiKit.label("0", 12, true, UiKit.INK_ON_GOLD)
stock_badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
@@ -154,6 +155,21 @@ func refresh_shelf_state(gp: int) -> void:
for card in _shelf_rows:
card.btn.disabled = gp < int(card.price)
card.card.modulate = Color(1, 1, 1, 1) if gp >= int(card.price) else Color(1, 1, 1, 0.55)
if _refresh_btn != null and not _refresh_btn.disabled:
_refresh_btn.disabled = gp < _refresh_gp_cost
# MC-1 刷新呈现投喂(free_left=天赋位免费剩余[基础 0]/gp_cost=本次 GP 刷新价/can_afford=余额可付)
var _refresh_gp_cost := 0
func set_refresh_display(free_left: int, gp_cost: int, can_afford: bool) -> void:
_refresh_gp_cost = gp_cost
for lab in _refresh_btn.get_children():
if lab is Label:
(lab as Label).text = str(free_left)
_refresh_btn.tooltip_text = "刷新货架——换一批商品\n免费 %d 次(天赋增益位,基础 0)\nGP 刷新 %d 金币(provisional)\n池源=共享池,与奖励三选一同源" % [free_left, gp_cost]
_refresh_btn.disabled = not can_afford and free_left <= 0
# 货架卡(bcard 竖卡:类型色带+图标+名+件值描述+价签+购买钮——M6 同构卡;demo ⑤)
@@ -181,3 +197,7 @@ func _build_shelf_card(holder: Control, c: Dictionary) -> Dictionary:
func _emit_shelf_buy(kind: String) -> void:
buy_requested.emit(kind)
func _emit_refresh_requested() -> void:
refresh_requested.emit()