Files
gplan-2/game/presentation/views/legend_overlay.gd
T

89 lines
3.7 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# VERTICAL SLICE - NOT FOR PRODUCTION
# 实现 GDD:design/ux/battle.md(D 区图例按钮 + 模态 overlay——格态语义图例;
# 状态槽空态说明成文载入〔增益状态 D1×①〕)。
# Date: 2026-09-12
# pattern 6 模态 overlay 层级纪律:打开时由组合根隐藏上方遮挡层 + 锁棋盘输入;
# 本类自持开关(open/close),探针断言"打开后自身 visible"——遮挡物断言归场景探针。
class_name LegendOverlay
extends Control
signal closed
const ENTRIES := [
["#C9AF83", "完整覆尘地砖", "未开格——左键挖开(1AP,须相邻)· 右键插旗(1AP)"],
["#B39A78", "碎裂裸土", "已开 0 格——可通行,左键移动(免费)"],
["#000000", "旗", "封印印记(呈现名·不能拔)——轮末自动判定标中;插错可左键直接挖开(安全格零奖励、雷格吃挖雷惩罚)"],
["#2e86de", "小人", "探险者——8 向相邻未开格常驻微光 = 可挖域"],
["#F0A828", "金徽章", "已开格奖励身份 icon(旗之下、数值之上,不进数字区)"],
["#F0A828", "九徽章解码", "攻=攻击 · 守=护甲 · 爆=爆裂 · 医=回复 · 弱=削弱 · 穿=穿刺 · 魔=魔法 · 行=行动点 · 金=金币(打磨包 2026-09-29 入列)"],
["#33261B", "状态槽空态", "无状态效果时槽位隐藏,数据框上移补位——非异常"],
]
var _panel: PanelContainer
var _rap_cost := -1 # <0 = 不渲染 RAP 行(打磨包 2026-09-29——构造参数注表值,禁字面量)
func _init(rap_cost: int = -1) -> void:
_rap_cost = rap_cost
var shell := UiKit.modal_shell(self, Color(UiKit.DIM, 0.55), Vector2(520, 0), 6, true,
UiKit.panel_skinned(Vector4(12, 10, 12, 10))) # 石板皮(T2;缺位回退 flat)
_panel = shell.panel
(shell.dim as ColorRect).gui_input.connect(_on_dim_gui_input)
var box: VBoxContainer = shell.box
var title := UiKit.label("图例 · 格态", 20, true, UiKit.INK_TITLE) # 亮底墨字(§7.2 数据素面)
box.add_child(title)
box.add_child(HSeparator.new())
for e in ENTRIES:
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 8)
var chip := ColorRect.new()
chip.custom_minimum_size = Vector2(18, 18)
chip.color = Color(e[0])
row.add_child(chip)
var lab := UiKit.label("%s —— %s" % [e[1], e[2]], 13, false, UiKit.INK_LABEL) # 亮底墨字(§7.2 数据素面)
lab.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
lab.custom_minimum_size = Vector2(440, 0)
row.add_child(lab)
box.add_child(row)
box.add_child(HSeparator.new())
# RAP 行(打磨包 2026-09-29——表值驱动,禁字面量:刷新代价读行动经济表)
if _rap_cost >= 0:
var rap_row := HBoxContainer.new()
rap_row.add_theme_constant_override("separation", 8)
var rap_chip := ColorRect.new()
rap_chip.custom_minimum_size = Vector2(18, 18)
rap_chip.color = UiKit.GOLD # 同 #F0A828——金徽章同源单点(T4 裸色收口)
rap_row.add_child(rap_chip)
var rap_lab := UiKit.label("RAP 储备行动点 —— 停手时剩余 AP 转存;弃图刷新消耗 RAP−%d(旧板旗作废,AP 保留继续挖)" % _rap_cost, 13, false, UiKit.INK_LABEL)
rap_lab.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
rap_lab.custom_minimum_size = Vector2(440, 0)
rap_row.add_child(rap_lab)
box.add_child(rap_row)
box.add_child(HSeparator.new())
var close_btn := UiKit.button("关闭")
close_btn.pressed.connect(close)
box.add_child(close_btn)
visible = false
func is_open() -> bool:
return visible
func open() -> void:
visible = true
func close() -> void:
if not visible:
return
visible = false
closed.emit()
func _on_dim_gui_input(ev: InputEvent) -> void:
if ev is InputEventMouseButton and ev.pressed:
close()