feat(iframe): 设计器平衡页增 player_iframe_sec 栏;_save 改合并式修复丢键
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user