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: