From 1f00720f44823bb108d57637c4add990e60c2bf1 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Wed, 22 Jul 2026 11:01:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(designer):=20=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E6=92=91=E6=BB=A1=E9=9D=A2=E6=9D=BF=20+=20=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E8=AF=8D=E8=A1=A8=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/game_designer/designer_ui.gd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/game_designer/designer_ui.gd b/addons/game_designer/designer_ui.gd index c2be71f..f4d1998 100644 --- a/addons/game_designer/designer_ui.gd +++ b/addons/game_designer/designer_ui.gd @@ -1,12 +1,17 @@ -## 游戏设计器通用 UI 辅助(静态方法,各标签页复用) +## 游戏设计器通用 UI 辅助(静态方法 + 共享常量,各标签页复用) @tool extends RefCounted +## 元素词表(spell_tab 复选框 / resonance_tab 元素下拉共用);label 双语显示,tag 存储,index 对齐 +const ELEM_LABELS := ["火 Fire", "冰 Ice", "雷 Lightning", "水 Water", "毒 Poison"] +const ELEM_TAGS := ["tag:fire", "tag:ice", "tag:lightning", "tag:water", "tag:poison"] + static func spin(min_v: float, max_v: float, step: float, val: float) -> SpinBox: var s := SpinBox.new() s.min_value = min_v; s.max_value = max_v; s.step = step s.value = val s.custom_minimum_size = Vector2(80, 0) + s.size_flags_horizontal = Control.SIZE_EXPAND_FILL return s static func line(text: String, placeholder: String = "") -> LineEdit: @@ -14,6 +19,7 @@ static func line(text: String, placeholder: String = "") -> LineEdit: le.text = text le.placeholder_text = placeholder le.custom_minimum_size = Vector2(120, 0) + le.size_flags_horizontal = Control.SIZE_EXPAND_FILL return le static func opt(items: Array, selected: int) -> OptionButton: @@ -21,6 +27,7 @@ static func opt(items: Array, selected: int) -> OptionButton: for it in items: o.add_item(str(it)) o.selected = clampi(selected, 0, items.size() - 1) + o.size_flags_horizontal = Control.SIZE_EXPAND_FILL return o static func header(text: String) -> Label: