Files
gplan-2/game/presentation/views/camp_sub_view_base.gd
T
DKChan 88d1344def v2.3定稿吸收(迭代47): 五功能窗口化——半透明遮罩0.6场景根留底+Esc先关最上层窗(Q1甲被后裁覆盖记档)+互斥单开——camp.md v2.3 用户裁三处对齐
- 四子界面壳+生涯页基底换装: UiKit.BG_BRIGHT实底→Color(DIM,0.6)半透明压暗遮罩(场景根留底可见;camp.md v2.3 定稿);石纹/暗角随亮底页退役;观感随样张目检校准(v2.3 明文普通设计决策)
- MainEscFlow: ①分支改写=有功能窗开着→close最上层窗(v2.3 后裁覆盖卡⑤契约9①的Q1甲无反馈;生涯页入窗集);_other_modal_open退役被_topmost_camp_window取代;设置开在浮窗之上仍无反馈(契约3保留)
- 五窗互斥单开: 遮罩STOP挡场景点击自然成立(模态栈深恒1),零代码
- 断言换代: screen_flow Esc子界面态改断言先关窗+两拍分离
- 验证: 冒烟15/0+screen_flow/ui_struct/click全绿;S9/S10/S13归基线
2026-11-01 23:31:55 +08:00

89 lines
3.8 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.
## 营地子界面模态壳基类(锻造工坊/秘宝匣/天赋树/奖励格图鉴四子界面公共形态):
## 实底全屏暖亮档+石纹暗角+顶栏(铭牌+钥石徽)+内容列+底栏返回钮。
## 开合可见性归模态栈(登记层开合一律走栈);返回钮只发 closed——关层编排归 presenter(组合根单口)。
## 余额徽随子类 refresh_camp 刷新(钥石读数=投影单口,禁第二账本)。
class_name CampSubViewBase
extends Control
signal closed
var _balance_label: Label # 钥石徽数值行(探针直读面——ui_probe 余额文案断言改指新界面)
## 壳构建(子类 _init 调用一次):content 由子类先建好传入(列容器/滚动容器皆可)
func _build_shell(title: String, icon_path: String, content: Control) -> void:
# 半透明压暗遮罩 0.6(camp.md v2.3 定稿——场景根留底可见,窗口之下垫遮罩;交互聚焦由遮罩 STOP 兜底)
var dim := UiKit._modal_dim(self, Color(UiKit.DIM, 0.6))
var margin := MarginContainer.new()
margin.set_anchors_preset(Control.PRESET_FULL_RECT)
margin.add_theme_constant_override("margin_left", 16)
margin.add_theme_constant_override("margin_right", 16)
margin.add_theme_constant_override("margin_top", 12)
margin.add_theme_constant_override("margin_bottom", 12)
dim.add_child(margin)
var col := VBoxContainer.new()
col.add_theme_constant_override("separation", 8)
margin.add_child(col)
_build_top_bar(col, title, icon_path)
content.size_flags_vertical = Control.SIZE_EXPAND_FILL
# 内容米板身(柜台行板对比底=PanelData——旧柜台面板形态延续,行板墨色对比表不脱锚)
var body := PanelContainer.new()
body.add_theme_stylebox_override("panel",
UiKit.panel_flat(UiKit.PANEL_DATA, UiKit.PANEL_BORDER, UiKit.RADIUS_OBJECT, 1, Vector4(10, 10, 10, 10)))
body.size_flags_vertical = Control.SIZE_EXPAND_FILL
body.add_child(content)
col.add_child(body)
_build_bottom_bar(col)
visible = false # 登记模态初始隐(开合走栈)
## 顶栏域:铭牌(标题)+钥石徽(余额徽单点——子类 refresh_camp 刷新数值行)
func _build_top_bar(col: VBoxContainer, title: String, icon_path: String) -> void:
var top := HBoxContainer.new()
top.add_theme_constant_override("separation", 10)
col.add_child(top)
var plaque := PanelContainer.new()
plaque.add_theme_stylebox_override("panel",
UiKit.panel_flat(UiKit.PANEL_DATA, UiKit.PANEL_BORDER, UiKit.RADIUS_OBJECT, 1, Vector4(14, 8, 14, 8)))
top.add_child(plaque)
var head := HBoxContainer.new()
head.add_theme_constant_override("separation", 6)
plaque.add_child(head)
if icon_path != "":
var ic := UiKit.icon_rect(icon_path, 32) # 头带图标缺位 null → 纯文本回退
if ic != null:
head.add_child(ic)
head.add_child(UiKit.label(title, UiKit.FS_TITLE, true, UiKit.INK_TITLE))
var spacer := Control.new()
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(spacer)
var badge := UiKit.keystone_badge("钥石 0") # UiKit 工厂单点(烛光黄底深墨字)
top.add_child(badge)
_balance_label = badge.value_label
## 底栏域:返回营地钮(closed 信号——关层编排归 presenter)
func _build_bottom_bar(col: VBoxContainer) -> void:
var bottom := HBoxContainer.new()
bottom.add_theme_constant_override("separation", 10)
col.add_child(bottom)
var back := UiKit.button("返回营地")
back.pressed.connect(_emit_closed)
bottom.add_child(back)
var spacer2 := Control.new()
spacer2.size_flags_horizontal = Control.SIZE_EXPAND_FILL
bottom.add_child(spacer2)
func open_camp(data: Dictionary) -> void:
refresh_camp(data)
visible = true # 开可见性由栈承载(本行为开层数据投喂的收尾拍)
func refresh_camp(data: Dictionary) -> void:
pass # 子类覆写(余额徽刷新+各自行板/门判据)
func _emit_closed() -> void:
closed.emit()