merge: M5 冒险地图(节点1.4×+候选烛光黄+类型标签+底栏合并单条+休息面板plate9;三闸全绿)
This commit is contained in:
commit
912dcb20b9
2 files changed
+78
-54
No files matched your search
@@ -26,10 +26,11 @@ const COL_ROOM_DONE := UiKit.GOLD_DONE # 已到——暗金(样
|
||||
const COL_ROOM_CURRENT := UiKit.GOLD # 当前——奖励金
|
||||
const COL_ROOM_FUTURE := UiKit.DARK_UPCOMING # 未达——暗
|
||||
const COL_PASSAGE := UiKit.STONE # 通道——石灰
|
||||
const COL_PASSAGE_LIT := UiKit.GOLD_LIT # 候选通道——亮金
|
||||
const COL_PASSAGE_LIT := UiKit.CANDLE # 候选通道/候选描边——烛光黄(M5:金色定岗只留当前位,G4;旧 GOLD_LIT 退役出本屏)
|
||||
const COL_BOSS_BORDER := UiKit.BOSS_PURPLE # Boss 边框——紫赤(色相独占本色;旗朱退役 2026-09-26)
|
||||
const COL_ABANDON := UiKit.RED_MINE # 破坏性动作红(危险红族)
|
||||
const NODE_LABELS := {"battle": "战", "reward": "赏", "rest": "疗", "boss": "王", "shop": "商"} # 商 = GP+商店房实施批 2026-09-21(贴图缺位字形回退用——贴图在位=字形退役惯例)
|
||||
const NODE_TYPE_NAMES := {"battle": "战斗", "reward": "奖励", "rest": "休息", "boss": "Boss", "shop": "商店"} # M5 节点下方类型字(demo ④——三通道可读性;当前位显示「当前位置」)
|
||||
const TEX_NODE_ICONS := {"battle": UiKit.TEX_NODE_BATTLE, "reward": UiKit.TEX_NODE_REWARD,
|
||||
"rest": UiKit.TEX_NODE_REST, "boss": UiKit.TEX_NODE_BOSS, "shop": UiKit.TEX_NODE_SHOP}
|
||||
const NODE_ICON_PX := 20.0 # 节点图标边长(样张 v1 冻结——20px 烘焙 1:1 消费零缩放)
|
||||
@@ -37,7 +38,7 @@ const ICON_TINT_ON_GOLD := Color(24.0 / 240.0, 20.0 / 226.0, 16.0 / 200.0) #
|
||||
const TITLE_ENTRY := "出发——选择首个节点" # 入口停点(布局决策 1——台账 143 遗留清偿)
|
||||
const TITLE_SINGLE := "继续前进" # 单链停点
|
||||
const TITLE_FORK := "选择下一节点" # 岔路停点
|
||||
const NODE_HALF := Vector2(26, 18) # 节点方块半宽高(52×36 占位画布参数——样张批终稿)
|
||||
const NODE_HALF := Vector2(36.5, 25) # 节点方块半宽高(73×50 = 52×36 的 1.4×——UI 落码批 M5「黑底吃掉」;层距/布局公式零改)
|
||||
const LAYER_BASE_X := 70 # 首层节点原点 x(画布拟合与布局公式共用——T4 杂并:双写退役)
|
||||
const LAYER_STEP_X := 122 # 层间横向步距(同上)
|
||||
const SLOT_BASE_Y := 52 # 槽位原点 y(同上)
|
||||
@@ -118,66 +119,76 @@ func _init() -> void:
|
||||
_canvas.draw.connect(_draw_graph.bind(_canvas))
|
||||
_canvas.gui_input.connect(_on_canvas_input)
|
||||
box.add_child(_canvas)
|
||||
# 底部状态栏(布局决策 4:生命/属性/本关加成三组 + 放弃按钮右端异位)
|
||||
var bottom := HBoxContainer.new()
|
||||
bottom.add_theme_constant_override("separation", 10)
|
||||
# 底部状态栏(M5 合并单条:亮米面板一站读齐=头像+生命+属性+本关加成/流派件——demo ④;
|
||||
# 道具槽不摆=道具读数无关卡画面成文出口(读快照私域越权),随 runner 出口批补——台账 352 注记;
|
||||
# _hp_value/_attr_value/_bonus_value/_relic_value 投喂键全部保留)
|
||||
var bottom := PanelContainer.new()
|
||||
bottom.add_theme_stylebox_override("panel",
|
||||
UiKit.panel_flat(Color8(240, 228, 200), UiKit.CAMP_HEADER_BAND, 0, 2, Vector4(12, 6, 12, 6)))
|
||||
box.add_child(bottom)
|
||||
bottom.add_child(_status_box("生命", true))
|
||||
bottom.add_child(_status_box("属性", false))
|
||||
# 本关加成框(零加成隐藏——spec 布局决策 4)
|
||||
var strip := HBoxContainer.new()
|
||||
strip.add_theme_constant_override("separation", 18)
|
||||
bottom.add_child(strip)
|
||||
var face := TextureRect.new()
|
||||
var face_tex := UiKit.load_tex(UiKit.TEX_HERO_PORTRAIT)
|
||||
if face_tex != null:
|
||||
face.texture = face_tex
|
||||
face.custom_minimum_size = Vector2(50, 52)
|
||||
face.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
face.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
face.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
strip.add_child(face)
|
||||
var life_box := VBoxContainer.new()
|
||||
strip.add_child(life_box)
|
||||
life_box.add_child(UiKit.label("生命", 11, false, Color8(110, 69, 52)))
|
||||
_hp_value = UiKit.label("", 15, true, UiKit.INK_TITLE)
|
||||
life_box.add_child(_hp_value)
|
||||
_hp_bar = Control.new()
|
||||
_hp_bar.custom_minimum_size = Vector2(130, 7)
|
||||
_hp_bar.draw.connect(_draw_hp_bar.bind(_hp_bar))
|
||||
life_box.add_child(_hp_bar)
|
||||
strip.add_child(_vdiv())
|
||||
var attr_box := VBoxContainer.new()
|
||||
strip.add_child(attr_box)
|
||||
attr_box.add_child(UiKit.label("属性", 11, false, Color8(110, 69, 52)))
|
||||
_attr_value = UiKit.label("", 15, true, UiKit.INK_TITLE)
|
||||
attr_box.add_child(_attr_value)
|
||||
strip.add_child(_vdiv())
|
||||
# 本关加成框(零加成隐藏——spec 布局决策 4)+ 流派件持有行(迭代 12 呈现补齐——组合根投喂)
|
||||
_bonus_row = HBoxContainer.new()
|
||||
_bonus_row.add_theme_constant_override("separation", 10)
|
||||
var bonus_box := PanelContainer.new()
|
||||
bonus_box.add_theme_stylebox_override("panel", UiKit.panel_flat(UiKit.DARK_UPCOMING, UiKit.PANEL_BORDER, 0, 1))
|
||||
strip.add_child(_bonus_row)
|
||||
var bonus_box := VBoxContainer.new()
|
||||
_bonus_row.add_child(bonus_box)
|
||||
var bonus_inner := VBoxContainer.new()
|
||||
bonus_box.add_child(bonus_inner)
|
||||
var bonus_cap := UiKit.label("本关加成", 12, false, UiKit.WARM_SOFT)
|
||||
bonus_inner.add_child(bonus_cap)
|
||||
_bonus_value = UiKit.label("", 15, true, UiKit.WARM)
|
||||
bonus_inner.add_child(_bonus_value)
|
||||
# 流派件持有行(迭代 12 呈现补齐 2026-10-04——用户反馈关卡选择页看不到局内奖励;组合根投喂)
|
||||
_relic_value = UiKit.label("", 13, false, UiKit.WARM_SOFT)
|
||||
bonus_box.add_child(UiKit.label("本关加成", 11, false, Color8(110, 69, 52)))
|
||||
_bonus_value = UiKit.label("", 15, true, UiKit.INK_TITLE)
|
||||
bonus_box.add_child(_bonus_value)
|
||||
_relic_value = UiKit.label("", 12, false, Color8(110, 69, 52))
|
||||
_relic_value.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
bonus_inner.add_child(_relic_value)
|
||||
bottom.add_child(_bonus_row)
|
||||
bonus_box.add_child(_relic_value)
|
||||
var spacer := Control.new()
|
||||
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
bottom.add_child(spacer)
|
||||
abandon_btn = UiKit.button("放弃") # 打磨包 2026-09-29——文案收敛 level-map 4 字上限(同失败结算语义移入确认态文案)
|
||||
abandon_btn.add_theme_color_override("font_color", COL_ABANDON) # 破坏性动作红(危险红族)
|
||||
strip.add_child(spacer)
|
||||
abandon_btn = UiKit.danger_button("放弃") # 打磨包 2026-09-29 文案 + M5 危险钮皮(M10 公共件)
|
||||
abandon_btn.pressed.connect(_on_abandon_pressed)
|
||||
abandon_btn.visible = false
|
||||
bottom.add_child(abandon_btn)
|
||||
strip.add_child(abandon_btn)
|
||||
visible = false
|
||||
|
||||
|
||||
# 状态数据框工厂(直角细线数据框——pattern 5 族;with_bar = 带迷你血条(生命框),值读数随行挂回
|
||||
# _hp_value/_attr_value(T4 杂并:旧「caption == "生命"」文案做控制流退役——分组判据复用 with_bar)。
|
||||
# 墨色按样张 v1 冻结:暗底标签 WARM_SOFT/读数 WARM——§7.1 数据素面墨来自世界的墨在暗底侧的落法,L3 ≥4.5:1)
|
||||
func _status_box(caption: String, with_bar: bool) -> PanelContainer:
|
||||
var panel := PanelContainer.new()
|
||||
panel.add_theme_stylebox_override("panel", UiKit.panel_flat(UiKit.DARK_UPCOMING, UiKit.PANEL_BORDER, 0, 1))
|
||||
var inner := VBoxContainer.new()
|
||||
panel.add_child(inner)
|
||||
var cap := UiKit.label(caption, 12, false, UiKit.WARM_SOFT)
|
||||
inner.add_child(cap)
|
||||
if with_bar:
|
||||
_hp_bar = Control.new()
|
||||
_hp_bar.custom_minimum_size = Vector2(120, 6)
|
||||
_hp_bar.draw.connect(_draw_hp_bar.bind(_hp_bar))
|
||||
inner.add_child(_hp_bar)
|
||||
var value := UiKit.label("", 15, true, UiKit.WARM)
|
||||
inner.add_child(value)
|
||||
if with_bar:
|
||||
_hp_value = value
|
||||
else:
|
||||
_attr_value = value
|
||||
return panel
|
||||
# 竖分隔线(M5 底栏分组线——亮面板上低对比细线)
|
||||
static func _vdiv() -> ColorRect:
|
||||
var v := ColorRect.new()
|
||||
v.color = Color8(201, 184, 142)
|
||||
v.custom_minimum_size = Vector2(1, 44)
|
||||
return v
|
||||
|
||||
|
||||
# _status_box 已退役(M5 底栏合并单条——demo ④;本函数随旧三暗框退役删除,投喂键保留于新底栏)
|
||||
|
||||
|
||||
func _draw_hp_bar(bar: Control) -> void:
|
||||
# 迷你血条(样张 v1 冻结:深底 UiKit.HP_BAR_BACK #28221C(对暗面板可辨)+金填充——比例 = hero_hp / effective_max_hp)
|
||||
# 迷你血条(深底 UiKit.HP_BAR_BACK #28221C + 小人蓝填充——M5 改蓝:与战斗站桩血条同语言,
|
||||
# 「蓝只说己方」§4.2;旧金填充退役=金只说收益定岗 G4)。比例 = hero_hp / effective_max_hp
|
||||
if _runner == null:
|
||||
return
|
||||
var max_hp := maxi(1, _runner.effective_max_hp())
|
||||
@@ -185,7 +196,7 @@ func _draw_hp_bar(bar: Control) -> void:
|
||||
var full := Rect2(Vector2.ZERO, bar.size)
|
||||
bar.draw_rect(full, COL_HP_BAR_BACK)
|
||||
if ratio > 0.0:
|
||||
bar.draw_rect(Rect2(Vector2.ZERO, Vector2(bar.size.x * ratio, bar.size.y)), UiKit.GOLD)
|
||||
bar.draw_rect(Rect2(Vector2.ZERO, Vector2(bar.size.x * ratio, bar.size.y)), UiKit.HERO_BLUE)
|
||||
|
||||
|
||||
# 放弃入口可见性(组合根在冒险启动时开、默认关——语义对象 = 整局冒险)
|
||||
@@ -276,8 +287,8 @@ func _fit_canvas(nodes: Array) -> void:
|
||||
for k in slot.keys():
|
||||
maxslot = maxi(maxslot, int(slot[k]))
|
||||
_content_size = Vector2(LAYER_BASE_X + maxl * LAYER_STEP_X + NODE_HALF.x + 8.0,
|
||||
SLOT_BASE_Y + maxslot * SLOT_STEP_Y + NODE_HALF.y + 8.0)
|
||||
_content_size = _content_size.max(Vector2(620, 240)) # 下限 = 旧定值画布(小图观感不变)
|
||||
SLOT_BASE_Y + maxslot * SLOT_STEP_Y + NODE_HALF.y + 24.0) # +24 = 类型文字标签行(M5)
|
||||
_content_size = _content_size.max(Vector2(620, 256)) # 下限(M5 抬高容纳标签行)
|
||||
_canvas.custom_minimum_size = _content_size
|
||||
|
||||
|
||||
@@ -453,6 +464,16 @@ func _draw_graph(canvas: Control) -> void:
|
||||
var num_ink := UiKit.INK_ROUTE if col == COL_ROOM_CURRENT else UiKit.WARM
|
||||
canvas.draw_string(get_theme_default_font(), Vector2(rect.end.x - 16.0, rect.position.y + 8.0),
|
||||
str(nid), HORIZONTAL_ALIGNMENT_RIGHT, 14, 10, num_ink)
|
||||
# 类型文字标签(M5——demo ④:节点下方 11px;当前位=「当前位置」金、候选=类型名+「 · 可选」烛光黄、
|
||||
# 其余=类型名暖米弱化;文字+图标+形状三通道)
|
||||
var type_text := String(NODE_TYPE_NAMES.get(t, t))
|
||||
if nid == current_id:
|
||||
type_text = "当前位置"
|
||||
elif cand_ids.has(nid):
|
||||
type_text += " · 可选"
|
||||
var type_ink := COL_ROOM_CURRENT if nid == current_id else (UiKit.CANDLE if cand_ids.has(nid) else UiKit.WARM_FAINT)
|
||||
canvas.draw_string(get_theme_default_font(), Vector2(p.x - 44.0, rect.end.y + 15.0),
|
||||
type_text, HORIZONTAL_ALIGNMENT_CENTER, 88, 11, type_ink)
|
||||
|
||||
|
||||
func _layout(nodes: Array, canvas: Control) -> Dictionary:
|
||||
|
||||
@@ -12,11 +12,14 @@ var _btn: Button
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
var box: VBoxContainer = UiKit.modal_shell(self, Color(0, 0, 0, 0.6)).box
|
||||
_label = UiKit.label("", 20, true, UiKit.WARM)
|
||||
# M5(UI 落码批):rest 兑付面板 plate9 石板化+暖金头带字(demo ④休息弹层;暗字上亮板 §7.2)
|
||||
var shell: Dictionary = UiKit.modal_shell(self, Color(0, 0, 0, 0.6), Vector2.ZERO, 14, true,
|
||||
UiKit.panel_skinned(Vector4(26, 18, 26, 18)))
|
||||
var box: VBoxContainer = shell.box
|
||||
_label = UiKit.label("", 20, true, UiKit.INK_TITLE)
|
||||
_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
box.add_child(_label)
|
||||
_btn = UiKit.button("继续")
|
||||
_btn = UiKit.primary_button("继续")
|
||||
_btn.pressed.connect(_emit_continue_pressed)
|
||||
box.add_child(_btn)
|
||||
visible = false
|
||||
|
||||
Reference in new issue
Block a user