From e490e6075a3175c43dd1bf1a909d1f0749cfbcb9 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Fri, 24 Jul 2026 09:27:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(iframe):=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=B9=B3=E8=A1=A1=E9=A1=B5=E5=A2=9E=20player=5Fiframe=5Fsec=20?= =?UTF-8?q?=E6=A0=8F=EF=BC=9B=5Fsave=20=E6=94=B9=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E5=A4=8D=E4=B8=A2=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- addons/game_designer/balance_tab.gd | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/game_designer/balance_tab.gd b/addons/game_designer/balance_tab.gd index ef49423..4216ac9 100644 --- a/addons/game_designer/balance_tab.gd +++ b/addons/game_designer/balance_tab.gd @@ -14,6 +14,7 @@ var _miniboss: SpinBox var _boss: SpinBox var _aether var _status: Label +var _iframe: SpinBox func _ready() -> void: add_child(UI.header("⚖ 平衡编辑器 — 难度乘子 & Boss 血量")) @@ -53,6 +54,11 @@ func _ready() -> void: {"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(HSeparator.new()) + var hf := HBoxContainer.new(); add_child(hf) + hf.add_child(UI.cell_label("无敌帧时长(秒) player_iframe_sec")) + _iframe = UI.spin(0.0, 2.0, 0.05, float(_data.get("player_iframe_sec", 0.5))) + hf.add_child(_iframe) add_child(UI.btn("💾 保存 balance.json", _save)) _status = UI.status_label(); add_child(_status) @@ -65,12 +71,11 @@ 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 = _aether.get_values() - var out := { - "difficulty_mults": mults, - "boss_hp": {"4": _miniboss.value, "5": _boss.value}, - "aether_thresholds": thresholds, - } + var out: Dictionary = _data.duplicate(true) # 基底保留未知键(mana_heat/infinite_spells 等) + out["difficulty_mults"] = mults + out["boss_hp"] = {"4": _miniboss.value, "5": _boss.value} + out["aether_thresholds"] = _aether.get_values() + out["player_iframe_sec"] = _iframe.value if UI.save_json(PATH, out): UI.set_status(_status, "💾 已保存(重启 F5 生效)") else: