diff --git a/addons/game_designer/balance_tab.gd b/addons/game_designer/balance_tab.gd index ae941aa..ef49423 100644 --- a/addons/game_designer/balance_tab.gd +++ b/addons/game_designer/balance_tab.gd @@ -12,7 +12,7 @@ var _data: Dictionary = {} var _mult_spins: Dictionary = {} # key → [SpinBox ×3] var _miniboss: SpinBox var _boss: SpinBox -var _aether: TextEdit +var _aether var _status: Label func _ready() -> void: @@ -46,10 +46,13 @@ func _ready() -> void: _boss = UI.spin(1, 999999, 10, float(bhp.get("5", 1800))) h2.add_child(_boss) add_child(HSeparator.new()) - var al := Label.new(); al.text = "碎片奖励阈值 aether_thresholds(JSON [[波次,碎片],...])"; add_child(al) - _aether = TextEdit.new(); _aether.custom_minimum_size = Vector2(0, 50) - _aether.text = JSON.stringify(_data.get("aether_thresholds", [[1, 0], [5, 3], [10, 8], [15, 14], [20, 20]])) + var al := Label.new(); al.text = "碎片奖励阈值 aether_thresholds(波次 → 碎片)"; add_child(al) + _aether = preload("res://addons/game_designer/tuple_list_editor.gd").new() + _aether.setup([ + {"label": "波次", "min": 1, "max": 9999, "step": 1, "int": true}, + {"label": "碎片", "min": 0, "max": 9999, "step": 1, "int": true}], "➕ 加行") add_child(_aether) + _aether.set_values(_data.get("aether_thresholds", [[1, 0], [5, 3], [10, 8], [15, 14], [20, 20]])) add_child(UI.btn("💾 保存 balance.json", _save)) _status = UI.status_label(); add_child(_status) @@ -62,9 +65,7 @@ func _save() -> void: for key in MULT_KEYS: var spins: Array = _mult_spins[key] mults[key] = [spins[0].value, spins[1].value, spins[2].value] - var thresholds = JSON.parse_string(_aether.text) if _aether.text.strip_edges() != "" else [] - if not (thresholds is Array): - thresholds = [] + var thresholds = _aether.get_values() var out := { "difficulty_mults": mults, "boss_hp": {"4": _miniboss.value, "5": _boss.value},