iter41-卡2:呈现层结构收敛批:67清+2豁免+2展平改善——拆私有族+六状态件+ui_kit收敛+束收拢+print删;含u14补做、并master并案与收尾产出物
This commit is contained in:
1 parent
bc75dab615
commit
7beb9bfdd5
94 files changed
+3417
-5314
No files matched your search
@@ -330,23 +330,9 @@ static func vignette_rect() -> TextureRect:
|
||||
# 程序纹理循环带,确定性生成零随机。光柱采用连续 alpha:
|
||||
# 带内 alpha 0→0.05→0 横向过渡+纵向衰减上亮下暗;
|
||||
# 纹理 filter=显式 LINEAR 白名单(与暗角/地图渐变同血统)
|
||||
static func beams_rect() -> TextureRect:
|
||||
static func _beams_rect() -> TextureRect:
|
||||
var img := Image.create(560, 560, false, Image.FORMAT_RGBA8)
|
||||
var ca := cos(0.2094) # 12°(102deg 带轴的垂直倾角)
|
||||
var sa := sin(0.2094)
|
||||
var beam_col := Color(1.0, 236.0 / 255.0, 200.0 / 255.0)
|
||||
var band_lo := 240.0
|
||||
var band_hi := 340.0
|
||||
var band_mid := (band_lo + band_hi) * 0.5
|
||||
var band_peak := 0.05
|
||||
var band_half := (band_hi - band_lo) * 0.5
|
||||
for y in 560:
|
||||
var v_fall := 1.0 - float(y) / 560.0 # 纵向衰减:上亮下暗(连续 alpha)
|
||||
for x in 560:
|
||||
var d := fposmod(x * ca + y * sa, 560.0)
|
||||
if d >= band_lo and d < band_hi:
|
||||
var a: float = band_peak * (1.0 - absf(d - band_mid) / band_half) * v_fall
|
||||
img.set_pixel(x, y, Color(beam_col.r, beam_col.g, beam_col.b, a))
|
||||
_paint_beams(img)
|
||||
var tr := TextureRect.new()
|
||||
tr.texture = ImageTexture.create_from_image(img)
|
||||
tr.stretch_mode = TextureRect.STRETCH_TILE
|
||||
@@ -356,8 +342,32 @@ static func beams_rect() -> TextureRect:
|
||||
return tr
|
||||
|
||||
|
||||
# 光带几何常量(12° 斜向光带——带轴倾角/带域/峰值强度;_paint_beams 单消费)
|
||||
const BEAMS_TILT_CA := 0.9135 # cos(0.2094)——12°(102deg 带轴的垂直倾角)
|
||||
const BEAMS_TILT_SA := 0.4067 # sin(0.2094)
|
||||
const BEAMS_BAND_LO := 240.0
|
||||
const BEAMS_BAND_HI := 340.0
|
||||
const BEAMS_PEAK := 0.05
|
||||
|
||||
|
||||
## 光带像素域(循环体提函数——12° 斜向光带双三角衰减:带内峰值×纵向衰减逐像素着色)
|
||||
func _paint_beams(img: Image) -> void:
|
||||
var ca := BEAMS_TILT_CA
|
||||
var sa := BEAMS_TILT_SA
|
||||
var beam_col := Color(1.0, 236.0 / 255.0, 200.0 / 255.0)
|
||||
var band_mid := (BEAMS_BAND_LO + BEAMS_BAND_HI) * 0.5
|
||||
var band_half := (BEAMS_BAND_HI - BEAMS_BAND_LO) * 0.5
|
||||
for y in 560:
|
||||
var v_fall := 1.0 - float(y) / 560.0 # 纵向衰减:上亮下暗(连续 alpha)
|
||||
for x in 560:
|
||||
var d := fposmod(x * ca + y * sa, 560.0)
|
||||
if d >= BEAMS_BAND_LO and d < BEAMS_BAND_HI:
|
||||
var a: float = BEAMS_PEAK * (1.0 - absf(d - band_mid) / band_half) * v_fall
|
||||
img.set_pixel(x, y, Color(beam_col.r, beam_col.g, beam_col.b, a))
|
||||
|
||||
|
||||
# 竖向渐变底(demo #v-map linear-gradient(180deg, top 0%, low 40%)——stop 后恒 low)
|
||||
static func gradient_base(top: Color, low: Color, stop := 0.4) -> TextureRect:
|
||||
static func _gradient_base(top: Color, low: Color, stop := 0.4) -> TextureRect:
|
||||
var g := Gradient.new()
|
||||
g.offsets = PackedFloat32Array([0.0, stop])
|
||||
g.colors = PackedColorArray([top, low])
|
||||
@@ -442,7 +452,7 @@ static func label(text: String, size: int, bold: bool, color: Color = Color(-1,
|
||||
# PanelContainer(panel_sb 缺省 = 主题默认板——settlement_review 同款);box = 内容列
|
||||
#(min_size/separation 参数化,min_size ZERO = 不设)。返回 Dictionary{dim, center, panel, box}
|
||||
#——探针直读的私有件由调用方按名摘引,结构同名同层级不变。
|
||||
static func modal_dim(parent: Control, dim_color: Color) -> ColorRect:
|
||||
static func _modal_dim(parent: Control, dim_color: Color) -> ColorRect:
|
||||
var dim := ColorRect.new()
|
||||
dim.color = dim_color
|
||||
dim.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
@@ -450,18 +460,29 @@ static func modal_dim(parent: Control, dim_color: Color) -> ColorRect:
|
||||
return dim
|
||||
|
||||
|
||||
const PANEL_DEFAULT := true # modal_shell 面板哨兵(非 StyleBox 实例——null=无面板/本哨兵=默认样式盒面板/StyleBox=自定义)
|
||||
|
||||
|
||||
# 面板哨兵解析(六参收拢五参——三态:null=无面板〔原 with_panel=false〕/PANEL_DEFAULT=默认样式盒面板
|
||||
# 〔原 with_panel=true+panel_sb=null〕/StyleBox 实例=自定义样式盒面板〔原双参形态〕)
|
||||
static func _resolve_shell_panel(panel_sb) -> PanelContainer:
|
||||
if panel_sb == null:
|
||||
return null
|
||||
var panel := PanelContainer.new()
|
||||
if panel_sb != PANEL_DEFAULT:
|
||||
panel.add_theme_stylebox_override("panel", panel_sb)
|
||||
return panel
|
||||
|
||||
|
||||
static func modal_shell(parent: Control, dim_color: Color, min_size := Vector2.ZERO, separation := 12,
|
||||
with_panel := false, panel_sb: StyleBox = null) -> Dictionary:
|
||||
var dim := modal_dim(parent, dim_color)
|
||||
panel_sb = null) -> Dictionary:
|
||||
var dim := _modal_dim(parent, dim_color)
|
||||
var center := CenterContainer.new()
|
||||
center.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
dim.add_child(center)
|
||||
var panel: PanelContainer = null
|
||||
var panel := _resolve_shell_panel(panel_sb)
|
||||
var host: Control = center
|
||||
if with_panel:
|
||||
panel = PanelContainer.new()
|
||||
if panel_sb != null:
|
||||
panel.add_theme_stylebox_override("panel", panel_sb)
|
||||
if panel != null:
|
||||
center.add_child(panel)
|
||||
host = panel
|
||||
var box := VBoxContainer.new()
|
||||
@@ -563,19 +584,6 @@ static func panel_skinned(margin: Vector4 = Vector4.ZERO, tint := Color.WHITE) -
|
||||
|
||||
|
||||
# 仪式石框(空心角括框——营地容器框;缺位回退暗面板)
|
||||
static func frame_skinned(margin: Vector4 = Vector4.ZERO) -> StyleBox:
|
||||
var tex := load_tex(TEX_BORDER_STONE)
|
||||
if tex == null:
|
||||
return panel_flat(BG_OVERLAY, PANEL_BORDER,RADIUS_OBJECT, 1, margin)
|
||||
var sb := _tex_sb(tex, 12.0)
|
||||
sb.content_margin_left = margin.x
|
||||
sb.content_margin_top = margin.y
|
||||
sb.content_margin_right = margin.z
|
||||
sb.content_margin_bottom = margin.w
|
||||
return sb
|
||||
|
||||
|
||||
# 图标槽(营地钥石/柜台件——缺位返回 null,消费点不挂 TextureRect 即回退纯文本)
|
||||
static func icon_rect(tex_path: String, px: float) -> TextureRect:
|
||||
var t := load_tex(tex_path)
|
||||
if t == null:
|
||||
@@ -659,19 +667,6 @@ static func _apply_button_skin(b: Button) -> void:
|
||||
# 消费方 = 标题/营地/设置/商店/三选一屏。单点纪律同 §7.1:新件只加不改旧件)──
|
||||
|
||||
# 动词按钮(图标+动词+悬停说明三件套——标题屏按钮组/通用;icon 缺位=纯文字不炸)
|
||||
static func verb_button(text: String, icon_path: String, tip := "") -> Button:
|
||||
var b := button(text)
|
||||
var tex := load_tex(icon_path)
|
||||
if tex != null:
|
||||
b.icon = tex
|
||||
b.add_theme_constant_override("icon_max_width", 20)
|
||||
b.expand_icon = false
|
||||
if tip != "":
|
||||
b.tooltip_text = tip
|
||||
return b
|
||||
|
||||
|
||||
# 主操作钮(烛光黄平涂+木描边——非奖励金;配色总纲「主按钮禁亮金」;缺 panel_stone 依赖=纯色可靠)
|
||||
static func primary_button(text: String, tip := "") -> Button:
|
||||
var b := button(text)
|
||||
var sb := panel_flat(CANDLE, Color8(110, 69, 52),RADIUS_OBJECT, 2, Vector4(10, 2, 10, 2))
|
||||
@@ -749,7 +744,9 @@ class BCard:
|
||||
var _sb_normal: StyleBox
|
||||
var _sb_sel: StyleBox
|
||||
|
||||
func _init(title: String, desc: String, band: Color, icon_path: String, price := "", footnote := "") -> void:
|
||||
func _init(title: String, desc: String, band: Color, icon_path: String, opts := {}) -> void:
|
||||
var price: String = opts.get("price", "")
|
||||
var footnote: String = opts.get("footnote", "")
|
||||
var tex := UiKit.load_tex(UiKit.TEX_PANEL_STONE)
|
||||
_sb_normal = UiKit.panel_skinned(Vector4(12, 10, 12, 10)) if tex != null else UiKit.panel_flat(PANEL_DATA, PANEL_BORDER,RADIUS_OBJECT, 1, Vector4(12, 10, 12, 10)) # 回退=数据板单点
|
||||
_sb_sel = UiKit.panel_flat(PANEL_DATA, Color8(138, 90, 52), RADIUS_OBJECT, 2, Vector4(12, 10, 12, 10)) # 选中底=数据板单点
|
||||
@@ -766,21 +763,7 @@ class BCard:
|
||||
mark.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
mark.visible = false
|
||||
box.add_child(mark)
|
||||
# 图标槽(demo .ic 76×76 槽底+图标 60=20px 源 3 整数倍)
|
||||
var slot := PanelContainer.new()
|
||||
slot.add_theme_stylebox_override("panel", UiKit.panel_flat(SLOT_BACKDROP_SOFT, PANEL_BORDER, 0, 1)) # 明度差降档(柔和档;白图标 ≥3:1 硬约束在役)
|
||||
slot.custom_minimum_size = Vector2(76, 76)
|
||||
slot.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
||||
box.add_child(slot)
|
||||
icon_tr = TextureRect.new()
|
||||
var itex := UiKit.load_tex(icon_path)
|
||||
if itex != null:
|
||||
icon_tr.texture = itex
|
||||
icon_tr.custom_minimum_size = Vector2(60, 60)
|
||||
icon_tr.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
icon_tr.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
icon_tr.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
slot.add_child(icon_tr)
|
||||
box.add_child(_build_icon_slot(icon_path))
|
||||
name_l = UiKit.label(title,FS_SUB, true, INK_TITLE)
|
||||
name_l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
box.add_child(name_l)
|
||||
@@ -800,6 +783,23 @@ class BCard:
|
||||
foot_l.visible = footnote != ""
|
||||
box.add_child(foot_l)
|
||||
|
||||
# 图标槽(demo .ic 76×76 槽底+图标 60=20px 源 3 整数倍;明度差降档——柔和档;白图标 ≥3:1 硬约束在役)
|
||||
func _build_icon_slot(icon_path: String) -> PanelContainer:
|
||||
var slot := PanelContainer.new()
|
||||
slot.add_theme_stylebox_override("panel", UiKit.panel_flat(SLOT_BACKDROP_SOFT, PANEL_BORDER, 0, 1))
|
||||
slot.custom_minimum_size = Vector2(76, 76)
|
||||
slot.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
||||
icon_tr = TextureRect.new()
|
||||
var itex := UiKit.load_tex(icon_path)
|
||||
if itex != null:
|
||||
icon_tr.texture = itex
|
||||
icon_tr.custom_minimum_size = Vector2(60, 60)
|
||||
icon_tr.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
icon_tr.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
icon_tr.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
slot.add_child(icon_tr)
|
||||
return slot
|
||||
|
||||
func set_selected(v: bool) -> void:
|
||||
add_theme_stylebox_override("panel", _sb_sel if v else _sb_normal)
|
||||
mark.visible = v
|
||||
@@ -809,8 +809,9 @@ class BCard:
|
||||
body.move_child(c, foot_l.get_index())
|
||||
|
||||
|
||||
static func bcard(title: String, desc: String, band: Color, icon_path: String, price := "", footnote := "") -> BCard:
|
||||
return BCard.new(title, desc, band, icon_path, price, footnote)
|
||||
## 竖卡工厂(BCard._init 同形收拢 6→5 参——opts 键 {price, footnote} 缺省逐字同值)
|
||||
static func bcard(title: String, desc: String, band: Color, icon_path: String, opts := {}) -> BCard:
|
||||
return BCard.new(title, desc, band, icon_path, opts)
|
||||
|
||||
|
||||
# 拨杆开关(设置屏——46×22 滑柄形;状态字随行由消费方摆;会话级/持久由消费方接 SettingsStore)
|
||||
@@ -838,7 +839,7 @@ class SwitchToggle:
|
||||
_knob.size = Vector2(18, 16)
|
||||
|
||||
|
||||
static func switch_toggle(initial: bool) -> SwitchToggle:
|
||||
static func _switch_toggle(initial: bool) -> SwitchToggle:
|
||||
return SwitchToggle.new(initial)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user