完善客户端功能并同步差距文档
This commit is contained in:
@@ -55,7 +55,8 @@ func _run() -> void:
|
||||
var fp := FakeProto.new()
|
||||
get_root().add_child(fc)
|
||||
get_root().add_child(fp)
|
||||
fc.inventory = [{"cell": 4, "vnum": 11901, "count": 1}, {"cell": 5, "vnum": 27993, "count": 3}]
|
||||
fc.inventory = [{"cell": 4, "vnum": 11901, "count": 1},
|
||||
{"cell": 5, "vnum": 27993, "count": 3}, {"cell": 6, "vnum": 30001, "count": 2}]
|
||||
|
||||
var pu: Node = PrivateShopUI.new()
|
||||
get_root().add_child(pu)
|
||||
@@ -66,9 +67,13 @@ func _run() -> void:
|
||||
return
|
||||
_ck(pu._cells.size() == 40, "ItemSlot = 40-slot grid (5x8, shop.SHOP_SLOT_COUNT)")
|
||||
_ck(is_instance_valid(pu._sign), "NameLine overlaid with a LineEdit")
|
||||
_ck(pu._inv_list.get_child_count() == 2, "2 inventory candidates")
|
||||
_ck(pu._inv_list.get_child_count() == 3, "3 inventory candidates")
|
||||
_ck((pu._inv_list.get_child(0) as Button).has_method("_get_drag_data"),
|
||||
"inventory candidate supports drag data")
|
||||
_ck(not pu._drop_mouse_item({"window": 1, "cell": 99, "vnum": 300, "count": 1,
|
||||
"anti_flags": (1 << 13)}, 2), "ANTIFLAG_GIVE item cannot enter private shop")
|
||||
_ck(not pu._drop_mouse_item({"window": 1, "cell": 99, "vnum": 301, "count": 1,
|
||||
"anti_flags": (1 << 16)}, 2), "ANTIFLAG_MYSHOP item cannot enter private shop")
|
||||
|
||||
# 未上货 → 개설 무동작
|
||||
pu._ok()
|
||||
@@ -82,13 +87,14 @@ func _run() -> void:
|
||||
pu._place(3, 250000)
|
||||
_ck(pu._stock.has(3) and int(pu._stock[3]["price"]) == 250000, "stock[3] placed")
|
||||
_ck(pu._picked == null, "pick cleared after place")
|
||||
_ck(pu._inv_list.get_child_count() == 1, "placed item leaves candidate list")
|
||||
_ck(pu._inv_list.get_child_count() == 2, "placed item leaves candidate list")
|
||||
# 标准 Godot 拖放入口与点击选取共用同一个落位逻辑。
|
||||
pu._drop_slot(Vector2.ZERO, {"private_shop_entry": {"cell": 5, "vnum": 27993, "count": 3}}, 6)
|
||||
_ck(is_instance_valid(pu._price_dialog), "dragging candidate onto empty slot opens price dialog")
|
||||
pu._place(6, 100)
|
||||
_ck(pu._stock.has(6), "dragged item is retained in stock")
|
||||
|
||||
# 拿起第 2 件(cell 5)→ 落到格 0(更小格号 → 排前)
|
||||
# 拿起第 3 件(cell 6)→ 落到格 0(更小格号 → 排前)
|
||||
(pu._inv_list.get_child(0) as Button).pressed.emit()
|
||||
pu._place(0, 99)
|
||||
pu._sign.text = "Cheap swords"
|
||||
@@ -96,10 +102,11 @@ func _run() -> void:
|
||||
_ck(_has_call(fc, "open_shop", func(c):
|
||||
if String(c[1]) != "Cheap swords": return false
|
||||
var items: Array = c[2]
|
||||
if items.size() != 2: return false
|
||||
return int(items[0]["vnum"]) == 27993 and int(items[0]["display_pos"]) == 0 \
|
||||
if items.size() != 3: return false
|
||||
return int(items[0]["vnum"]) == 30001 and int(items[0]["display_pos"]) == 0 \
|
||||
and int(items[1]["vnum"]) == 11901 and int(items[1]["price"]) == 250000 \
|
||||
and int(items[1]["inv_cell"]) == 4 and int(items[1]["display_pos"]) == 3),
|
||||
and int(items[1]["inv_cell"]) == 4 and int(items[1]["display_pos"]) == 3 \
|
||||
and int(items[2]["vnum"]) == 27993 and int(items[2]["display_pos"]) == 6),
|
||||
"개설 → open_private_shop(sign, stock 按格号排序 + display_pos)")
|
||||
_ck(not pu.is_open(), "closes after 개설")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user