Files
gplan-2/game/presentation/views/toast_stack.gd
T
DKChan 32fdf957fd refactor(代码术语): 卡① flag→seal 全族换代+game/ 禁用词清扫(迭代 31 卡①)
标识符面:flag_*→seal_ 族(含 Godot 信号 flag_judged→seal_judged 与连接/回调同名、
FACTS 两键 flags_count→seals_count/dug_under_flag→dug_under_seal 全链、
.tres 键名与 schema .gd 同批同步);显式豁免零改动=size_flags_*(Godot 布局属性)+_fatal_flag。
中文面:金币→GP(金币袋→GP 袋)/插旗→封印/雷格→危险格/惩罚格→危险格/旗→封印·封印印记族,
game/ 内 *.gd/.tres/.md/.json 四类禁用词与 flag 双双零命中(V1/V4)。
守卫字面量不动(被检查的禁字不是使用):smoke_all V21 零「雷/旗」检查面、
ui_font_asset_test 字形集攻/雷/旗/封 保持原断言逻辑。
代拍板:板面单字槽 glyph「旗」→「封」(禁字纪律+单字位宽,消费面四处同名随动)。
素材换代(2026-10-18 用户裁案甲):assets/art/board/flag_seal.png→seal_mark.png(素材不入 git,
盘上改名+导入重刷),代码两处 res:// 字符串+COL_FLAG/CURSOR_FLAG 常量同步,
闸件四处随批(run_all_gates.sh/render_gate.sh/golden_baseline_refresh.sh/path_check.py)。
anchor.json 键名手改,重锚与改前改后 diff 随本卡收口(同裁案甲)。

基线读数(改前,主区 ed2dfaf6):冒烟 1151 检查 0 失败/单元 34 套全绿/探针 --click
存量红仅 screen_flow_probe(user:// 断点污染在册已知项)。
改后同批读数(本 worktree):冒烟 1151 检查 0 失败/探针 --click 同一存量红、其余全绿。
2026-10-19 02:52:38 +08:00

54 lines
1.9 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
## 非模态 toast 槽:三槽堆叠自动消退(2.5s),info/warn/gold 三调性。
## 弹什么文案归组合根决定——本类只管槽位堆叠与消退,不做提示内容决策。
class_name ToastStack
extends Control
const LIFE_SEC := 2.5
const MAX_SLOTS := 3
const COL_INFO := UiKit.INK
const COL_WARN := UiKit.RED_MINE # 危险红族——拒绝/作废(封印朱退役 2026-09-26)
const COL_GOLD := UiKit.GOLD_DEEP # 奖励金族——提示/达成(深金档)
var _slot_box: VBoxContainer
func _init() -> void:
mouse_filter = Control.MOUSE_FILTER_IGNORE
set_anchors_preset(Control.PRESET_TOP_WIDE)
custom_minimum_size = Vector2(0, 84)
_slot_box = VBoxContainer.new()
_slot_box.mouse_filter = Control.MOUSE_FILTER_IGNORE
_slot_box.alignment = BoxContainer.ALIGNMENT_BEGIN
_slot_box.add_theme_constant_override("separation", 2)
add_child(_slot_box)
func show_toast(text: String, tone: String = "info") -> void:
while _slot_box.get_child_count() >= MAX_SLOTS:
var old: Control = _slot_box.get_child(0)
_slot_box.remove_child(old)
old.queue_free()
var row := PanelContainer.new()
row.mouse_filter = Control.MOUSE_FILTER_IGNORE
row.clip_contents = true # 缺陷①约束:固定槽高裁剪,不回流布局
row.custom_minimum_size = Vector2(0, 24)
var sb := UiKit.panel_flat(UiKit.TOAST_BG, COL_INFO,UiKit.RADIUS_OBJECT, 1, Vector4(8, 2, 8, 2))
var col := COL_INFO
if tone == "warn":
col = COL_WARN
elif tone == "gold":
col = COL_GOLD
sb.border_color = col
row.add_theme_stylebox_override("panel", sb)
var lab := UiKit.label(("⚠ " if tone == "warn" else "") + text,UiKit.FS_HINT, tone != "info", col)
lab.clip_text = true
row.add_child(lab)
_slot_box.add_child(row)
var tw := row.create_tween()
tw.tween_interval(LIFE_SEC)
tw.tween_property(row, "modulate:a", 0.0, 0.35)
tw.tween_callback(func():
if is_instance_valid(row):
row.queue_free())