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