feat: complete mobile UI implementation

This commit is contained in:
shenlei
2026-09-04 19:54:33 +09:00
parent 9a4a044da5
commit b19d5b5dd3
132 changed files with 6643 additions and 180 deletions
+22
View File
@@ -231,6 +231,12 @@ func _run() -> void:
fc.friend_invite_ask.emit("Eve")
fu._invite_dialog.canceled.emit()
_ck(fc.calls.has(["friend_answer", "Eve", false]), "friend: reject incoming request")
fu.set_mobile_mode(true)
fc.friend_invite_ask.emit("MobileDave")
await process_frame
_ck(fu._invite_dialog.size == Vector2i(480, 220),
"friend: mobile confirmation uses landscape touch size")
fu._invite_dialog.canceled.emit()
# --- 商店 ---
var su: Node = ShopUI.new()
@@ -285,6 +291,7 @@ func _run() -> void:
var xu: Node = ExchangeUI.new()
get_root().add_child(xu)
xu.setup(fc, canvas)
xu.set_mobile_mode(true)
fc.exchange = {
"active": true, "partner_vid": 4321,
"self_items": [{"slot": 0, "vnum": 19, "count": 1}],
@@ -294,6 +301,12 @@ func _run() -> void:
fc.inventory = [{"cell": 7, "vnum": 901, "count": 1, "anti_flags": 0}]
fc.exchange_changed.emit()
_ck(xu.is_open(), "exchange window opens when active")
_ck(xu._mobile_inventory_scroll.visible and xu._mobile_inventory_list.get_child_count() == 1,
"exchange mobile mode shows one tap-to-offer inventory candidate")
if xu._mobile_inventory_list.get_child_count() == 1:
(xu._mobile_inventory_list.get_child(0) as Button).pressed.emit()
_ck(fc.calls.has(["ex_add_item", 1, 7, 1]),
"exchange mobile candidate tap sends item offer")
_ck(xu._self_box.get_child_count() == 1, "exchange: 1 self item row")
_ck(xu._root.get_node("PeerAccept").text == "对方: 已接受", "exchange: peer accept shown")
_ck(not xu._accept_btn.disabled, "exchange: accept enabled before server accept")
@@ -332,14 +345,23 @@ func _run() -> void:
var bu: Node = SafeboxUI.new()
get_root().add_child(bu)
bu.setup(fc, canvas)
bu.set_mobile_mode(true)
fc.safebox_open = true
fc.safebox_size = 2
fc.safebox_gold = 99999
fc.safebox = [{"cell": 3, "vnum": 27, "count": 10}]
fc.inventory = [{"cell": 4, "vnum": 901, "count": 2}]
fc.safebox_changed.emit()
_ck(bu.is_open(), "safebox opens")
_ck(bu._gold.text.contains("99999"), "safebox: gold shown")
_ck(bu._list.get_child_count() == 1, "safebox: 1 item row")
_ck(bu._mobile_inventory_scroll.visible and bu._mobile_inventory_list.get_child_count() == 1,
"safebox mobile mode shows one tap-to-deposit inventory candidate")
if bu._mobile_inventory_list.get_child_count() == 1:
(bu._mobile_inventory_list.get_child(0) as Button).pressed.emit()
_ck(fc.calls.any(func(c): return c[0] == "sb_checkin" and c[2] == 1 and c[3] == 4),
"safebox mobile candidate tap sends checkin")
_ck(bu._mobile_deposit_pending.has(4), "safebox mobile prevents duplicate checkin taps")
var out_btn: Button = null
for b in bu._list.get_child(0).find_children("*", "Button", true, false):
out_btn = b