feat(meta): 平衡页签可编辑 aether_thresholds(保存不丢字段)
This commit is contained in:
@@ -12,6 +12,7 @@ var _data: Dictionary = {}
|
||||
var _mult_spins: Dictionary = {} # key → [SpinBox ×3]
|
||||
var _miniboss: SpinBox
|
||||
var _boss: SpinBox
|
||||
var _aether: TextEdit
|
||||
var _status: Label
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -45,6 +46,10 @@ 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]]))
|
||||
add_child(_aether)
|
||||
add_child(UI.btn("💾 保存 balance.json", _save))
|
||||
_status = UI.status_label(); add_child(_status)
|
||||
|
||||
@@ -57,9 +62,13 @@ 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 out := {
|
||||
"difficulty_mults": mults,
|
||||
"boss_hp": {"4": _miniboss.value, "5": _boss.value},
|
||||
"aether_thresholds": thresholds,
|
||||
}
|
||||
if UI.save_json(PATH, out):
|
||||
UI.set_status(_status, "💾 已保存(重启 F5 生效)")
|
||||
|
||||
Reference in New Issue
Block a user